[topicmapmail] Newbie question about ResourceData. Somehow re lated with XTM Datatypes I think

Stuart Brown sbrown@extenza.com
Wed, 11 Dec 2002 11:47:01 -0000


Hi Marius,

> I want to build a web site.
> The structure of the site (topicmap) is clear.
> The text that describe one topic is not plain text to be able to be 
> modelled as an internal occurence (resourceData or something 
> like this).
> 1. The client needs some formating of this page. Some of the pages 
> contain texts like: Romania has 23 mil citisens.
> In this case, 23 mentioned here is automaticaly extracted from the 
> topicmaps (Romania.inhabitantsCount = 23000000).
> 
> 2. In description of topic Romania you can also have links to another 
> topic (for example link to NATO).

Formatting:
I use namespaces to include formatting in resourceData. If you hack together
a schema view of the XTM DTD, you can alter the resourceData declaration to
permit any attributes from your chosen namespace. So my resultant XML looks
something like:

<xtm:resourceData>
 <tei:p>This is a <tei:gi>p</tei:gi> from the TEI namespace.</tei:p>
</xtm:resourceData>

Links between topics
When one topic relates to another, in any way you should express this with
an association element, rather than as a occurrence of the topic. Thus, to
say the UK is a member of NATO, you can do the following:

<topic id="country.UK">
 <instanceOf>
  <topicRef xlink:href="#country"/>
 </instanceOf>
</topic>

<topic id="alliance.NATO">
 <instanceOf>
  <topicRef xlink:href="#alliance"/>
 </instanceOf>
</topic>

<association id="UK.isPartyTo.NATO">
 <instanceOf>
  <topicRef xlink:href="#isPartyTo">
 </instanceOf>
 <member>
  <roleSpec>
   <topicRef xlink:href="#signatory"/>
  </roleSpec>
  <topicRef xlink:href="#country.UK">
 </member>
 <member>
  <roleSpec>
   <topicRef xlink:href="#treaty"/>
  </roleSpec>
  <topicRef xlink:href="#alliance.NATO">
 </member>
</association>

Having said this, I have to admit that I sometimes cheat a little. If there
is an inline reference in my resourceData to another topic, then I use a
cross reference element from my DTD to point to it, as well as creating an
association to record that fact. This enables me to create links more easily
on an HTML web rendering:

<topic id="country.UK">
 <instanceOf>
  <topicRef xlink:href="#country"/>
 </instanceOf>
 <occurrence>
  <instanceOf>
   <topicRef xlink:href="#prose.description">
  </instanceOf>
  <resourceData>
   <tei:p>The UK is a signatory to <tei:ref
target="#alliance.NATO">NATO</tei:ref>.</tei:p>
  <resourceData>
 </occurrence>
</topic>

<association>
 <instanceOf>
  <topicRef xlink:href="#inlineReference"/>
 </instanceOf>
 <member>
  <roleSpec>
   <topicRef xlink:href="#referer">
  </roleSpec>
  <xlink:href="#country.UK"/>
 </member>
 <member>
  <roleSpec>
   <topicRef xlink:href="#referenceTarget">
  </roleSpec>
  <xlink:href="#alliance.NATO"/>
 </member>
 <member>
  <roleSpec>
   <topicRef xlink:href="#associationType">
  </roleSpec>
  <topicRef xlink:href="#isPartyTo"/>
 </member>
</association>

This of course duplicates my actual isPartyTo association, but I prefer to
keep it this way as it enables me to keep track of where, and why, I make
inline references irrespective of the actual association.

Hope this helps,

Stuart