[topicmapmail] Can a resourceRef be a topic
Steve Pepper
pepper@ontopia.net
Wed, 20 Feb 2002 10:40:03 +0100
At 10:04 19/02/02 +0000, Sparkes, Peter wrote:
>In a topicMap, if individual topics have a Parent/Child relationship, can
>the child relationship be expressed using:
>
> <topic id="BA">
> <occurrence>
> <scope><topicRef xlink:href="child"/></scope>
> <resourceRef xlink:href="BA1"/>
> </occurrence>
> </topic>
> where the resourceRef points to a child topic with an ID of "BA1"
Although this is syntactically correct, it flouts the topic map model. You
should not use an occurrence to express a relationship between two topics,
*unless* one of the topics happens to be an addressable information
resource that is in some way pertinent to the other topic (which does not
seem to be the case here).
To express parent-child relationships, use associations, thus:
<!-- assume topics for "parent-child", "parent", and "child" -->
<topic id="BA"/>
<topic id="BA1"/>
<association>
<instanceOf><topicRef xlink:href="#parent-child"/></instanceOf>
<member>
<roleSpec><topicRef xlink:href="#parent"/></roleSpec>
<topicRef xlink:href="#BA"/>
</member>
<member>
<roleSpec><topicRef xlink:href="#child"/></roleSpec>
<topicRef xlink:href="#BA1"/>
</member>
</association>
Or, in LTM syntax:
parent-child( [BA] : parent, [BA1] : child )
>The parent relationship can be expressed using:
>
> <topic id="BA">
> <instanceOf>
> <topicRef xlink:href="B"/>
> </instanceOf>
> </topic>
This is also incorrect: It expresses a class-instance relationship, not a
parent-child relationship. To see this, replace "BA" with "Peter" and "B"
with your father. Is your father a class? No. Are you an instance of your
father? No. Once again, an association is the way to go:
parent-child( [B] : parent, [BA] : child )
>I want to do this so that every topic contains the xlink to its parent and
>children.
If I understand correctly, you have a *syntactic* requirement for not using
association elements. In that case, the XTM syntax does not meet your
requirements and you need to devise your own syntax to do so. This need not
be a problem, since the XTM syntax is only intended for *interchange*.
However, you should be aware that you will have a redundancy problem if you
want every topic to contain links to both its parents and its children. For
example, the relationship between [B] and [BA] will be expressed twice:
* once from [B] ("my child is [BA]"), and
* once from [BA] ("my parent is [B]").
This is precisely the reason why association elements are not subelements
of topic elements in the XTM syntax: An association usually involves more
than one topic, and doesn't "belong" to any one of those topics in particular.
If your syntactic requirement is important enough and you think you can
handle the redundancy problem, devise your own syntax and generate XTM
automatically whenever you want to interchange your topic map. Otherwise,
find a satisfactory way of eliminating the syntactic requirement. (Using a
conforming topic map engine would be the best way to go.)
Best regards,
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