Blog
Books
Talks
Follow
Me
Search

Larsblog

A quick introduction to CXTM

<< 2006-08-04 22:27 >>

I got some questions about how CXTM actually works, so I thought I'd put together a little introduction to it. If you want to create a CXTM file for one of your own topic maps you can actually do this in Omnigator with the export plug-in.

Update 2009-02-26: The introduction has been updated to the published CXTM standard.

The idea behind CXTM is that for every XTM file there should be exactly one corresponding CXTM file. Furthermore, if two XTM files contain the same information they should produce the same CXTM output. This makes it possible to create conformance test suites using CXTM.

It's probably best explained through an example. Below is an example topic map (in LTM) that we'll turn into CXTM.

[cxtm : syntax = "CXTM"]
{cxtm, specification, "http://www.isotopicmaps.org/cxtm/cxtm.html"}
published-by(cxtm : publication, iso : publisher)

This turns into the following in CXTM:

<topicMap>
<topic number="1">
<itemIdentifiers>
<locator>#cxtm</locator>
</itemIdentifiers>
<name number="1">
<value>CXTM</value>
</name>
<occurrence number="1">
<value>http://www.isotopicmaps.org/cxtm/cxtm.html</resource>
<datatype>http://www.w3.org/2001/XMLSchema#anyURI</datatype>
<type topicref="6"></type>
</occurrence>
<rolePlayed ref="association.1.role.1"></rolePlayed></topic>
...

As you can see, this is the CXTM topic from the LTM file, but in a slightly strange notation. Note that the topic references are all numbers. The 6 above refers to the sixth topic in the file. The number attributes make it easier to see which topic this is. Note also the rolesPlayed element, which refers to an association role played by the topic (the first role in the first association).

One further thing to be aware of here is that the whitespace is also significant here. CXTM files for the same topic map need to be byte-by-byte identical, and this of course includes the whitespace. So the whitespace in the example above is as dictated by the spec.

<association number="1">
<type topicref="4"></type>
<role>
<rolePlayer topicref="1"></rolePlayer>
<type topicref="3"></type>
</role>
<role>
<rolePlayer topicref="2"></rolePlayer>
<type topicref="5"></type>
</role>
</association>

This is our published-by association, now unrecognizable, since all the topic references are numbers.

This is pretty much all there is to it, actually. There are some bits I haven't shown (internal occurrences, scope, variants, reification, ...), but they are pretty easily predictable from the above.

Similar posts

The cxtm-tests project

The cxtm-tests project has just released the first-ever release of a conformance test suite for Topic Maps implementations

Read | 2008-05-23 18:21

An XTM conformance test suite

One thing that's really needed is a conformance test suite for XTM 2.0, which can be used by implementors to verify that they've actually gotten their implementations right

Read | 2006-08-02 19:24

An introduction to XTM 2.0

Various people have asked for an introduction to XTM 2.0, since the actual standard is not very easily readable, and so I thought I would provide that

Read | 2006-12-09 14:17

Comments

No comments.

Add a comment

Name required
Email optional, not published
URL optional, published
Comment
Spam don't check this if you want to be posted
Not spam do check this if you want to be posted