[sc34wg3] How to process <mergeMap> and added scopes?

Lars Marius Garshol sc34wg3@isotopicmaps.org
Tue, 17 Jan 2006 19:15:11 +0100


* Geir Ove Gr=F8nmo
>
> The current XTM specification document does not include <mergeMap>
> anymore, but I suspect that the previous definition of <mergeMap> was
> severely underspecified. That is definitely true for the original XTM
> 1.0 document.

You can see for yourself whether the previous draft had specified =20
this in sufficient detail or not:

   http://www.isotopicmaps.org/sam/sam-xtm/2005-07-20/

You'll quickly find that the added themes add considerable complexity =20=

to the document and the processing. :-)

> Here are a few XTM documents that one should consider the result of
> having processed:
>
> 1. Does added scope apply to nested <mergeMap>s?

According to the 2005-07-20 draft: yes.

> Example: what is the result of processing document A? How many =20
> scoping topics does the base name with id=3D"bn" have?
>
>   A:
>   <topicMap>
>     <mergeMap xlink:href=3D"B"/>
>       <topicRef xlink:href=3D"#theme1"/>
>     </mergeMap>
>   </topicMap>
>
>   B:
>   <topicMap>
>     <mergeMap xlink:href=3D"C">
>       <topicRef xlink:href=3D"#theme2"/>
>     </mergeMap>
>   </topicMap>
>
>   C:
>   <topicMap>
>     <topic>
>       <baseName id=3D"bn1"><baseNameString>My topic</baseNameString></=20=

> baseName
>     </topic>
>   </topicMap>

bn1 will here have two scoping topics.

> 2. What happens if nested <mergeMap>s are recursive and added scopes
> are used? Example: what is the result of processing document D?
>
>   D:
>   <topicMap>
>     <mergeMap xlink:href=3D"E"/>
>       <topicRef xlink:href=3D"#theme2"/>
>     </mergeMap>
>   </topicMap>
>
>   E:
>   <topicMap>
>     <mergeMap xlink:href=3D"D">
>       <topicRef xlink:href=3D"#theme1"/>
>     </mergeMap>
>   </topicMap>

The 2005-07-20 algorithm, if implemented exactly as specified, would =20
here give you an infinite loop, probably terminated by an OutOfMemory =20=

at some point. I consider that insufficient punishment for creating =20
such an XTM file, but specifying a harsher sentence in the standard =20
is difficult.

Seriously: this should probably be considered an error. How to detect =20=

it reliably would require some thinking.

> 3. What happens if multiple <mergeMap>s reference the same document
> with different added scopes? Example: what is the result of processing
> document F?
>
>   F:
>   <topicMap>
>     <mergeMap xlink:href=3D"G"/>
>       <topicRef xlink:href=3D"#theme1"/>
>     </mergeMap>
>     <mergeMap xlink:href=3D"G"/>
>       <topicRef xlink:href=3D"#theme2"/>
>     </mergeMap>
>   </topicMap>
>
>   G:
>   <topicMap>
>     <topic>
>       <baseName id=3D"bn2"><baseNameString>My topic</baseNameString></=20=

> baseName
>     </topic>
>   </topicMap>

The result here (again according to 2005-07-20) would be that the =20
topic in G would get two different topic names with different scopes.

> 4. What happens if a <mergeMap>s reference the current document with
> added scopes? Example: what is the result of processing document H?

I consider this the same as your example #2, in principle.

--
Lars Marius Garshol, Ontopian               http://www.ontopia.net
+47 98 21 55 50                             http://www.garshol.priv.no