Springe direkt: zur Navigationzum Inhaltzur Sidebar

Archiv für 'Topic Maps'

Importing topic maps with QuaaxTMIO

07.11.2010

Last week, version 0.5.4 of the QuaaxTM PHP Topic Maps engine was released which, finally, brought XTM 2.1 read/write support via the QuaaxTMIO library. QuaaxTM now provides a basic tool set of Topic Maps technologies enabling PHP developers to build subject centric applications on the LAMP stack.

An essential feature is the import of topic maps. Topic maps (TMDM instances) can be serialized to one of the various Topic Maps syntaxes such as XTM 1.0/2.0/2.1, CTM, LTM, AsTMa=, or JTM to allow data interchange. Let’s see how to import a publicly available topic map from Maiana using the QuaaxTMIO library; I choose Lutz Maicher‘s  topic map about Donald Duck in XTM 2.1 for the following example.

QuaaxTM has to be set up like described in README (maybe you’d like to tun the PHPUnit tests afterwards). You’ll need three classes then which you have to require_once:

  • TopicMapSystemFactory.class.php (from lib/phptmapi2.0/core)
  • PHPTMAPITopicMapHandler.class.php (from lib/quaaxtmio/src/in)
  • XTM201TopicMapReader.class.php (from lib/quaaxtmio/src/in)

First, get a TopicMapSystem:
$tmSystemFactory = TopicMapSystemFactory::newInstance();
// QuaaxTM specific feature
$tmSystemFactory->setFeature(
VocabularyUtils::QTM_FEATURE_AUTO_DUPL_REMOVAL, false
);
$tmSystem = $tmSystemFactory->newTopicMapSystem();

Import the topic map using the XTM 2.0/2.1 parser and a topic map handler:

$tmHandler = new PHPTMAPITopicMapHandler($tmSystem, 'http://localhost/topicmaps/1');
$reader = new XTM201TopicMapReader($tmHandler);
$reader->readFile(
'http://maiana.topicmapslab.de/u/lmaicher/tm/ducks/download.xtm'
);

Finally access the imported topic map via PHPTMAPI 2.0:

$tm = $tmSystem->getTopicMap('http://localhost/topicmaps/1');
$topics = $tm->getTopics();
echo count($topics);// 278

Yet another QuaaxTM release – 0.5.3

09.10.2010

There has been yet another release of the PHP Topic Maps engine QuaaxTM. Version 0.5.3 comes with JTM 1.0 import and export (via QuaaxTMIO library). Import of brand new JTM 1.1 is also supported. Download latest version here.

QuaaxTM 0.52 released

01.09.2010

All details in this post on the Topic Maps mailing list.

PHPTMAPI CXTM writer

23.08.2010

Some days ago, I have committed a CXTM writer to QuaaxTM’s SVN. This writer is part of the QuaaxTMIO library. What is Canonical XTM, or CXTM for short?

“[...] The format is an XML format, and has the property that it guarantees that two equivalent Topic Maps Data Model instances [ISO/IEC 13250-2] will always produce byte-by-byte identical serializations [...] CXTM thus enables direct comparison of two topic maps to determine equality by comparison of their canonical serializations.” [1]

The CXTM-tests project provides a test suite based upon the various Topic Maps syntaxes which allows easy verification of Topic Maps software’s standards compliance.

The purpose (and advantage) of using CXTM tests in the context of deserialization and serialization of topic maps is obvious. It is possible to test the readers and writers for spec./standards conformity while, at the same time, the Topic Maps engine the readers and writers are working against is tested for Topic Maps Data Model (TMDM) compliance. Engines using CXTM tests are more reliable (from the standards perspective) than engines which are not using CXTM tests. This is the USP of CXTM.

QuaaxTM now passes all tests via reading the valid XTM 2.0 sources from the CXTM test suite and writing the respective CXTM using the XTM 2.0 parser and the CXTM writer. Both components are not yet officially released but committed to the SVN and ready to be checked out. Version 0.51 can be simply replaced by the SVN content.

As QuaaxTMIO only depends on PHPTMAPI the CXTM writer can be used by any PHPTMAPI implementation. The API is trivial:

$writer = new PHPTMAPICXTMWriter($tmLocator);
$cxtm = $writer->write($topicMap);

$tmLocator is the topic map’s locator as defined in http://phptmapi.sourceforge.net/2.0/docs/core/TopicMapSystem.html#createTopicMap; $topicMap is an implementation of PHPTMAPI TopicMap.

Two prerequisites have to be considered: The writer as well as the XTM 2.0 parser use PEAR’s Net_URL2 and, the writer exclusively, uses PHP’s Normalizer.

Happy CXTMing!

[1] http://www.isotopicmaps.org/cxtm/cxtm.html

You are currently browsing the archives for the Topic Maps category.

Creative Commons License
This work is licensed under a
Creative Commons Attribution-Share Alike 2.5 License.
t8d blogged mit WordPress