[topicmapmail] Associating to an association

Steve Pepper pepper@ontopia.net
Thu, 14 Nov 2002 14:08:26 +0100


At 08:04 12.11.2002 -0800, Martin Stitt wrote:
>Cool!  Thanks for the pointer.

You're welcome.

>[snip]
>
>But, what you've shown me is also a great way to cover this case.  If I 
>understand
>correctly, I could give my "represents" association instance an id value 
>and then
>reference that directly from another association, such that I would not 
>need to
>create a new topic if I didn't need it for any other purposes.

That is correct. You would use a subjectIndicatorRef that addressed the
association. In fact a topic "object" would be created by the application,
but you yourself would not have to create a topic *element*. The only
thing to be aware of if you do it this way is that the topic that reifies
the association will not have a name and will look a bit wierd in generic
applications like the Omnigator. However, if you are building your own
application that doesn't require a name, this won't be a problem.

Here's an example piece of code that would do the trick:

   <?xml version="1.0" encoding="utf-8" standalone="yes"?>
   <topicMap
     xmlns="http://www.topicmaps.org/xtm/1.0/"
     xmlns:xlink="http://www.w3.org/1999/xlink"
   >

     <topic id="foo">
       <baseName><baseNameString>foo</baseNameString></baseName>
     </topic>

     <topic id="bar">
       <baseName><baseNameString>bar</baseNameString></baseName>
     </topic>

     <association id="baz">
       <member><topicRef xlink:href="#foo"/></member>
       <member><topicRef xlink:href="#bar"/></member>
     </association>

     <association>
       <member><topicRef xlink:href="#foo"/></member>
       <member><subjectIndicatorRef xlink:href="#baz"/></member>
     </association>

   </topicMap>

Whether reifying associations is the best way to go for your application
is another matter. But I see that's a discussion you are already having
with Lars Marius.

Steve

--
Steve Pepper, Chief Executive Officer <pepper@ontopia.net>
Convenor, ISO/IEC JTC1/SC34/WG3  Editor, XTM (XML Topic Maps)
Ontopia AS, Waldemar Thranes gt. 98, N-0175 Oslo, Norway.
http://www.ontopia.net/ phone: +47-23233080 GSM: +47-90827246