Sunday 21 November 2010

Example of Topic Maps

  •  Making a topic map
Create a topic map about XML, where it can be founded topics representing 'the XML Recommendation', 'the W3C', and 'Tim Bray'.
The types of the topics should be 'standard', 'standards body', and 'person'.
The relationship between the XML Recommendation and the W3C is called 'publishing', while the relationship between the Recommendation and Tim Bray is one of 'authorship'. So in the 'authorship' association Tim Bray plays the role of 'author' while the XML Recommendation plays the role of 'work'.
For "Tim Bray", occurrences should be his home page. 

To create a topic map for the example above we can start by defining topics for the three topic types. This is done as follows:

<topicMap xmlns="http://www.topicmaps.org/xtm/1.0/"
          xmlns:xlink="http://www.w3.org/1999/xlink">

  <topic id="person">
    <baseName>
      <baseNameString>Person</baseNameString>
    </baseName>
  </topic>

  <topic id="standards-body">
    <baseName>
      <baseNameString>Standards body</baseNameString>
    </baseName>
  </topic>

  <topic id="standard">
    <baseName>
      <baseNameString>Standard</baseNameString>
    </baseName>
  </topic>

</topicMap>

This gives us three topics suitable for use as topic types in our topic map. The baseName elements give the topics names that can be used to display the topics. The next step is to add one topic to be used as an occurrence type and our three instance topics, complete with names and occurrences. (The fragment below should be inserted inside the topicMap element above. The order of topic elements in topic maps is irrelevant.)

 
  <topic id="xml-rec">
    <instanceOf>
      <topicRef xlink:href="#standard"/>
    </instanceOf>
    <baseName>
      <baseNameString>The XML Recommendation</baseNameString>
    </baseName>
  </topic>

  <topic id="tim-bray">
    <instanceOf>
      <topicRef xlink:href="#person"/>
    </instanceOf>
    <baseName>
      <baseNameString>Tim Bray</baseNameString>
    </baseName>
  </topic>

  <topic id="homepage">
    <baseName>
      <baseNameString>Homepage</baseNameString>
    </baseName>
  </topic>

  <topic id="w3c">
    <instanceOf>
      <topicRef xlink:href="#standards-body"/>
    </instanceOf>
    <baseName>
      <baseNameString>World Wide Web Consortium</baseNameString>
    </baseName>
    <occurrence>
      <instanceOf>
        <topicRef xlink:href="#homepage"/>
      </instanceOf>
      <resourceRef xlink:href="http://www.w3.org"/>
    </occurrence>
  </topic>

The first two topic elements create topics for the XML Recommendation and Tim Bray, making them instances of the "standard" and "person" topic types we defined earlier. Notice how instanceOf is used to provide the class and topicRef is used to point to the topic that defines the class. Then we define the occurrence type "homepage" and finally a topic for the W3C, which is of type "standards-body" and even has a "homepage" occurrence. The resourceRef element inside the occurrence gives the URI of the resource that is the occurrence.
Finally, we are ready to create topics for the association and role types and create the corresponding associations in order to complete the topic map. The fragment below does just this. 

 <topic id="authorship">
    <baseName>
      <baseNameString>Authorship</baseNameString>
    </baseName>
  </topic>

  <topic id="author">
    <baseName>
      <baseNameString>Author</baseNameString>
    </baseName>
  </topic>

  <topic id="work">
    <baseName>
      <baseNameString>Work</baseNameString>
    </baseName>
  </topic>

  <association>
    <instanceOf>
      <topicRef xlink:href="#authorship"/>   
    </instanceOf>

    <member>
      <roleSpec>
        <topicRef xlink:href="#author"/>
      </roleSpec>
      <topicRef xlink:href="#tim-bray"/>
    </member>

    <member>
      <roleSpec>
        <topicRef xlink:href="#work"/>
      </roleSpec>
      <topicRef xlink:href="#xml-rec"/>
    </member>
  </association>

  •  How to Use Topic Maps

     
    For creating a topic map there are three main approaches
    • Have humans author the topic maps manually. This usually gives very high-quality and rich topic maps, but at the cost of human labor. This is appropriate for some projects, while prohibitively expensive for others.
    •  Automatically generate the topic map from existing source data. This can give very good results if the existing data are well-structured (sound familiar?); if not, there are various natural-language processing tools that might help.
    •  Automatically produce the topic map from structured source data like XML, RDBMSs, LDAP servers, and more specialized applications.






No comments:

Post a Comment