OT - Re: [xquery-talk] Define no-overlaps constraint based on two integers (range index?)

Adam Retter adam.retter at googlemail.com
Wed Jun 3 12:27:21 PDT 2009

As you broaden your question to ask about "*any* database", I can give
you a brief overview of how this could be done in the eXist XML Native

The functionality to restrict the ability to store a document based on
criteria in other documents (in this case  start and end value
attributes) could be defined in a Trigger, this Trigger could be
implemented in either XQuery or Java.

If the Trigger was written in XQuery you could take advantage of
configurable indexes in eXist to speed up your search of 'overlapping
documents', to do so you would create a range indexes on both the
start and end attributes.

If you wish to further discuss the functionality available in eXist to
achieve this, may I suggest that the eXist mailing list would be
better suited.

Cheers Adam.

2009/6/3 Michael Ludwig <mlu at as-guides.com>:
> I have a lot of documents in an XML database (Oracle Berkeley DB XML),
> which look like this:
>  <doc start="100123" end="100456">Huhu</doc>
> Do you see any possibility to define an index on a database (on *any*
> database) such that no two documents with an overlapping period from
> @start to @end can exist? Both @start and @end are integers. Given the
> above document, no document may start or end in the interval between
> 100123 and 100456.
> I know this problem is rather general, unrelated to XQuery, and not
> even specific to DBXML, of which I've already consulted the forum:
> http://forums.oracle.com/forums/message.jspa?messageID=3482507
> I also know this problem could have an XQuery solution coded at the
> application level, based on equality indices on @start and @end.
> Pointers to better places to ask this are as welcome as hints to a
> solution. I'm not sure what this kind of index is called; I thought of
> "contiguity index", or "range index", or "interval index", but can't
> find much in Google. Does anyone know?
> Michael Ludwig
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

Adam Retter

More information about the talk mailing list