Help with ID/Indexing


I need help with the following:

I have a document stored in tamino which roughly ressembles this:

The document has an associated schema.
The Individuals must be unique. Individuals get added by updating the document. How do I need to implement IDs/indexes in order for Tamino to (automatically if possible) generate a unique ID for each individual? Many thanks in advance!

Hi there.

At the moment there is no “unique constraint” in Tamino.
There are two attributes that will be unique - one which is provided by Tamino, the other that you must supply.

When a document is inserted into Tamino, the document is assigned an ino:id. This value (a number) will be unique for a doctype.
However, this will be assigned for your document, not for each element.

When inserting a document into Tamino, you are able to specify a value for the ino:docname attribure. This attribute is also at the doctype level, and must be unique for the doctype. If you specify a non-unique value for ino:docname, Tamino raise an error.

If you have the possibility to modify the schema, perhaps you should remodel so that the “wrapper” node is removed, and then store documents into Tamino.

I never recommend people to build applications on the ino:id attribute without first fully understanding how it works. When you insert a document into Tamino, it is assigned an ino:id. If you insert the same document five times, then you will have five documents stored in Tamino - with five different ino:id’s.
This should already be enough information to see that the ino:id is not computed from the document’s content, just allocated from a pool.
If you un-load all the documents from Tamino, then re-load them later, they might get different ino:id’s than they previously had.
(Which would be fairly tragic if the ino:id were being used to reference other documents…)

However, if your requirement is just that there is a unique identifier, you could use ino:id.

If you need to compute some unique identifier, you should have a look at writing a “Server Extension” (SXS) to create the identifier at insert time.

I hope that helps,

Thanks for your answer!

If I understood this correctly, there is currently no way of keeping my current document structure (the ‘individuals’ element is itself part of a larger structure…) and creating a unique identifier for each ‘individual’ element. Or do the SXS allow for this? Where is SXS documented in detail? Again, many thanks!

Hello again.

Since I don’t know your data design - or your intentions for its usage - I won’t say that you have to change your document structure!
Maybe there are advantages for querying/retrieval/updating if you store many small documents, but perhaps this doesn’t fit your scenario.

You can find more details on Server Extensions in the Tamino documentation. A good starting point is probably this page:
   C:\Program Files\Software AG\Tamino\Tamino\Help\SERVEXT\SEPREF.HTM
   (Or wherever you find this page in your installation…)