[topicmapmail] TMDM serialization

Lars Marius Garshol larsga at garshol.priv.no
Thu Sep 27 11:01:14 EDT 2007


* Borislav Iordanov
>
> I have a couple of question regarding XML serialization of topics maps
> represented in TMDM 2.0. I'm working on a topic maps implementation  
> and I'd like the implementation to be able to read an XMT 2.0 file,  
> store it and then export the exact same file.

I should emphasize here that this is very much *not* a goal of TMDM.  
If we were to support this we'd have to basically preserve the entire  
XTM file byte-by-byte, and we would have no model.

Consider things like:

  - number of <topic> elements and what was inside each,
  - comments,
  - character encoding,
  - upper vs lower case in character references (&#xAF; vs &#xaf;),
  - ...

and you quickly realize that, well, this is not a reasonable  
requirement. At least not the way you stated it. You may of course  
have meant something slightly different.

The requirement that the specifications *do* support is that if you  
import an XTM 2.0 file, then export and reimport, you can be sure  
that the two imports will give equal TMDM instances. In other words:  
TMDM implicitly defines what information in an XTM 2.0 file is  
relevant, and which information is not relevant.

So:

> 1) The id attribute of the topic tag found in the original file  
> gets bundled into an item identifier in the TMDM. Given that a  
> topic may have multiple item identifiers, how to recover the  
> original id during export?

According to the TMDM there is no concept of an "original id". In  
other words: you don't need to do this, because it has no consequence  
which ID you choose.

> 2) Similarly, when I have to include an href attribute in, say, a  
> topicRef tag during export, which of the possible subject  
> identifiers or item identifiers to output?

Same thing here.

> I guess XML serialization is considered implementation dependent so  
> I'm free to do whatever seems best, right?

Yes, so long as a reimport will give the same TMDM instance you  
started with.

> The only thing that bugs me a little bit is the fact the topic id  
> attribute is mandatory in XMT 2.0, but then it's not even part of  
> the data model!

It's there. It's just one of the item identifiers.

--Lars M.


More information about the topicmapmail mailing list