A topic map consists of a collection of topics. A topic is a proxy for anything that the topic map author wishes to document in his or her topic map. As already indicated, the thing that a topic represents can be:
Figure 2, below, shows the distinction between a topic and the object or concept that the topic represents in the real world. An author has in his or her mind the subject to be documented and creates a topic. The topic is a machine representation of the subject which can now be stored, queried and manipulated by the computer.
Figure 2 - Representing the real world with topic maps
Characteristics is a collective term used to describe the three properties which a topic may have which together form the collection of assertions that the topic map author has made about the subject that the topic represents.
The following example shows the representation of a simple topic map consisting of a single topic. Note that the <topicMap> element defines the default namespace as the namespace defined for XTM 1.0 and the namespace for XLink. In later examples I will omit the XML declaration and the namespace declaration to save space. To save space, I have not included the full text of the XTM DTD in this article, but it is available to online on the TopicMaps.Org site at http://www.topicmaps.org/xtm/1.0/
<?xml version="1.0"?>
<topicMap xmlns="http://www.topicmaps.org/xtm/1.0/"
xmlns="http://www.w3.org/1999/xlink">
<topic id="xzyyz">
<baseName>
<baseNameString>Redmond Computers Inc.</baseNameString>
</baseName>
<occurrence>
<resourceRef xlink:href="http://www.redmondcomputers.com/"/>
</occurrence>
<occurrence>
<resourceData>1977</resourceData>
</occurrence>
</topic>
</topicMap>
Sample 1 - A simple topic map
Some points to note about the XTM syntax introduced in this example:
<topic> element has an id attribute. I have deliberately used a value bearing no relation to the topic itself. The id attribute is simply a syntactical construct that will allow us to make references to the topic later; beyond this it has absolutely no meaning to a topic map processor. All elements defined by the XTM 1.0 DTD have an id attribute, enabling any part of the topic map document to be referenced if need be, but the id attribute value is only required for the <topic> element.<baseNameString> element, which is in turn contained within a <baseName> element. As you might expect, this indicates that there are further properties of a base name that we have not yet discussed.<occurrence> the reference to the occurrence resource itself is contained in a <resourceRef> element. The <resourceRef> element is declared in the XTM DTD as an XLink simple link. It is this use of XLink (and its use in all the other reference constructs in the XTM DTD) which requires the declaration of the XLink namespace. The second of the occurrences shows the use of the <resourceData> element to provide the occurrence data "in-line" with the topic map. This makes it somewhat easier to add meta-data to topics.| Up: Topic Map Basics | |
| Next: Types | |