Hello!
We attempt to utilize a ?generic model? for storing xml documents and have problems when trying to index certain elements or attributes that has the same name but different values. Example of our stored xml document looks like following (MarcXML-document):
http://www.it.jyu.fi/users/juklewa/example.xml
Consider following for the example document:
We want to get an instance from the database that has datafield element that has attribute named ?tag? that has value ?100?. Under datafield element must be subfield element and that element contains attribute named code and the code attribute has value ?a?. Also subfield element must have value ?Kauppinen, Janne?.
The Xpath would look like this (works just fine):
/collection[(.//datafield/@tag=‘100’) and (.//subfield/@code=‘a’) and (.//subfield ~=‘Kauppinen, Janne’)]
and the part of the xml document that is referred to looks like this (a part from the example):
Kauppinen, Janne
Problem:
At the moment the query check out (of course) every datafield and subfield elements and their attributes because they have the same names. The queries need only subset of those elements for example just like in the earlier mentioned query (.//datafield/@tag=‘100’). It takes about 40 seconds to do that query because we have more than 51 000 documents like that in our database and every element and attribute values are checked?
Question:
Is it possible to index documents and their elements or attributes at the same way as Xpath-language is used to query documents with name-value pairs?
We are using Tamino Server 3.1.2 if you need this information.
Hi Tomasz,
I guess the performance-problem com from the fact that the query engine gives up using the indexing if you specify “.//”.
Is is a problem for you to use a fully qualified path ? - like:
http://localhost/tamino/DB/collection?_XQL=datafield[(@tag=‘100’) and (subfield/@code=‘a’) and (subfield ~=‘Kauppinen, Janne’)]
This will definitely make life easier for the query engine.
If this is not a viable road, pls explain and perhaps attach schema and a few sample docs.
Finn