[topicmapmail] Merging associations

Murray Altheim murray06 at altheim.com
Sun Sep 17 18:33:48 EDT 2006


Quoting Lars Heuer <heuer at semagia.com>:

> Hi Murray,
> hi Joril,
>
> I still suspect that TopicMap.mergeIn(Association) (and
> TopicMap.mergeIn(Topic)) is something I like to have in TMAPI. But I
> like to understand the semantics of the copy operation.
>
> Think of these topic maps (using [AsTMa2]):
>
> Topic map A:
>
>       john isa person
>       http://en.wikipedia.org/wiki/John_Lennon  # Subject identifier
>                                                 # of john
>
>       member-of isa contained-in
>
>       member-of(group: the-beatles, member: john)
>
> Topic map B:
>
>       john
>       http://en.wikipedia.org/wiki/John_Lennon  # Subject identifier
>                                                 # of john
>
> Now I like to copy the "member-of" association from topic map A to
> topic map B.
>
> Questions:
> - Is the topic "contained-in" and that "member-of" is and instance of
>   "contained-in" also copied to B?
> - Is the information that "john isa person" added to B?
> - Must the topics "group", "the-beatles", "member", "member-of" exist
>   in the topic map B to be successfully copied?
>
> [AsTMa2]<http://astma.it.bond.edu.au/astma=-spec-2.0r1.0.dbk>

Lars,

I suspect your scenario is potentially in error. Generally speaking,
you'll be copying entire Topic Maps, not just an Association. As in
the recent discussion, explicitly-available Topics will already have
been merged, so Associations between those Topics are not much of an
issue -- you just link them up. The question is more about what
happens to Associations that don't already point to local Topics. So
in the below TopicMap, there'd be no issues:

    <topic id="walks" />
    <topic id="boy" />
    <topic id="dog" />

    <association>
       <instanceOf>
         <topicRef xlink:href="#walks" />
       </instanceOf>
       <member>
         <topicRef xlink:href="#boy" />
       </member>
       <member>
         <topicRef xlink:href="#dog" />
       </member>
    </association>

but let's say that the "Dog" topic is not a local reference:

       <member>
         <topicRef
    xlink:href="http://www.cyc.com/cycdoc/vocab/biology-vocab.html#Dog" />
       </member>

So the mergeAssociation() method would not have merged a Topic for this.
There's two approaches to this. One would be to simply bring the URI
reference along with the merge, e.g., the resulting Association would
look like:

    <association>
       <instanceOf>
         <topicRef xlink:href="#walks" />
       </instanceOf>
       <member>
         <topicRef xlink:href="#boy" />
       </member>
       <member>
         <topicRef
    xlink:href="http://www.cyc.com/cycdoc/vocab/biology-vocab.html#Dog" />
       </member>
    </association>

Pretty simple.

But wait! Any engine worth its salt (or mustard, or whatever condiment
a Topic Map engine is worth) might have reified the reference upon not
finding such a local Topic, so one would then find (as a result of a
merge):

    <topic id="walks" />

    <topic id="boy" />

    <topic id="x45769-00-86"><!-- reified Topic -->
       <subjectIdentity>
         <subjectIndicatorRef>
        <topicRef
    xlink:href="http://www.cyc.com/cycdoc/vocab/biology-vocab.html#Dog" />
         </subjectIndicatorRef>
       </subjectIdentity>
    </topic>

    <association>
       <instanceOf>
         <topicRef xlink:href="#walks" />
       </instanceOf>
       <member>
         <topicRef xlink:href="#boy" />
       </member>
       <member>
         <topicRef xlink:href="#x45769-00-86" />
       </member>
    </association>

The big question becomes what to do with that <topicRef> URI. Without
dereferencing the URI (it could point to literally anything), we can
use it as a subject indicator, an occurrence of the Topic, or what?
If it's pointing into another Topic Map, we might be able to discern
if the URI is itself a valid subject indicator.

There's a third possibility, which would be to use the base URI of
the source TopicMap to provide a URI reference (link) in the merged
TopicMap back to the source TopicMap. I know some people don't like
using base URIs, and sometimes they're not a good idea. But if the
author has explicitly provided one, it might mean that the TopicMap
is meant to have a canonical location (as when used to create a PSI
set) and they it'd be safe to simply append the XTM IDs to the base
URI as Topic references in the merged TopicMap.

In any case, what to do with the URI is really a different issue. If
this question is solely about the recursiveness of merging Associations,
then I think it's just a matter of reifying Topics as necessary, or
leaving the URI references from the source Association alone, i.e.,
just leave them still containing <topicRef> elements linking to their
original addresses; they're still valid.

I *think* this is the solution here, if I'm understanding the question
correctly.

Murray

...........................................................................
Murray Altheim <murray06 at altheim.com>                              ===  = =
http://www.altheim.com/murray/                                     = =  ===
SGML Grease Monkey, Banjo Player, Wantanabe Zen Monk               = =  = =

        In the evening
        The rice leaves in the garden
        Rustle in the autumn wind
        That blows through my reed hut.  -- Minamoto no Tsunenobu



More information about the topicmapmail mailing list