Blog
Books
Talks
Follow
Me
Search

Larsblog

An introduction to XTM 2.0

<< 2006-12-09 14:17 >>

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. This posting is just a simple walk-through of the syntax with examples. People have also asked for an explanation of the differences with version 1.0, and I'll do a separate posting on that later when time allows.

Let's look at how you'd wrap the topic map first:

<topicMap version="2.0" xmlns="http://www.topicmaps.org/xtm/">

  <!-- topics and associations go here -->

</topicMap>

As you can see, this is pretty much as in XTM 1.0, so let's move on to a simple topic example.

<topic id="xtm">
  <subjectIdentifier href="http://psi.example.org/xtm/2.0"/>
  <instanceOf>
    <topicRef href="#syntax"/>
  </instanceOf>
  <name>
    <value>XTM 2.0</value>
  </name>
  <occurrence>
    <type>
      <topicRef href="#status"/>
    </type>
    <resourceData>International Standard</resourceData>
  </occurrence>
</topic>

I think this example is pretty much self-explanatory for anyone who knows Topic Maps already. One thing to note here is that the reason I use topicRef elements everywhere to reference topics is that XTM 2.0 doesn't allow any other form of topic reference. I'm not adding any examples of the scope element, as it is identical to the way it was in XTM 1.0.

Below is an example of an association.

<association>
  <type>
    <topicRef href="#specified-in"/>
  </type>
  <role>
    <type>
      <topicRef href="#specified"/>
    </type>
    <topicRef href="#xtm"/>
  </role>
  <role>
    <type>
      <topicRef href="#specification"/>
    </type>
    <topicRef href="#xtm-spec"/>
  </role>
</association>

Again, I think this is self-explanatory. Note that for each role you can only have a single player, unlike in XTM 1.0.

We've now shown all the main constructs, but there are some variations left, so let's go through those as well.

<topic id="xtm-spec">
  <subjectLocator href="http://www.isotopicmaps.org/sam/sam-xtm/"/>
  <instanceOf>
    <topicRef href="#specification"/>
  </instanceOf>
  <name>
    <value>XTM 2.0 specification</value>
  </name>
  <occurrence>
    <type>
      <topicRef href="#publication-date"/>
    </type>
    <resourceData datatype="http://www.w3.org/2001/XMLSchema#date"
        >2006-06-19</resourceData>
  </occurrence>
</topic>

Here you can see an example of a topic that represents a resource (it has a subject locator), and also an example of a datatyped occurrence value.

Reification is quite simple to do. Let's say you want to create a topic reifying the example topic map. To do that, just write as follows:

<topicMap version="2.0"
          xmlns="http://www.topicmaps.org/xtm/"
          reifier="#tmtopic">

<topic id="tmtopic">
  <name>
    <value>XTM 2.0 Example Topic Map</value>
  </name>
</topic>

<!-- ... -->

As you can see, reification is done by referring from the reified construct (in this case the topic map) to the topic reifying it.

This leaves only the mergeMap element, which is still in XTM. Using it you can merge another XTM 2.0 file into the current one, as follows:

<mergeMap href="other.xtm"/>

Note that this shows the complete mergeMap element. Unlike in XTM 1.0 there isn't anything more you can do with it.

That's pretty much the whole syntax. I've left out variant names and item identifiers, but other than that this should provide everything you need to create XTM 2.0 topic maps. If you want more examples you may want to look at Topincs, which can export XTM 2.0 files.

Similar posts

Why XTM 2.0 is different from 1.0

Many people have asked what the changes between versions 1.0 and 2.0 of XTM are, and what the rationales for the various changes are

Read | 2006-12-16 19:17

A quick introduction to CXTM

I got some questions about how CXTM actually works, so I thought I'd put together a little introduction to it

Read | 2006-08-04 22:27

ISO meeting in Atlanta, day 2

Day 2 started with a presentation by Naito-san about a proposal from him and Komachi-san about a standard format for publishing PSIs

Read | 2005-11-14 00:35

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