XQuery Join using Java API

I am using Tamino 4.2.1 trial version along with TaminoAPI4J that came with the distribution.

Not sure if the question belongs here. But I am trying to query across collections in a Tamino database. What do I have to do?

If i initialise the TXMLObjectAccessor to a particular connection, how do I issue an XQuery that references a document in another collection. I am a bit confused about syntax here.

Thanks in advance
Vyom

Hello Vyom,

this is quite straightforward: use the “collection” function to return documents from another collection.

You have probably seen a lot of example queries which use the “input” function to specify a set of documents in Tamino… The “collection” function can be used in the same way - the only difference is that “collection” takes a parameter: the name of the collection to read the documents from.

So, if you have established a connection to “MyColl_A” in your program, the following XQuery would return [all of the] documents from “MyColl_Z”:

   for $others in collection("MyColl_Z")
   return $others


You can filter the set of documents in the same ways as with the “input” function: putting a path expression after the function, e.g. collection(“MyColl_Z”)/MyDoc[@id=“007”], or with a WHERE clause.

I hope that helps.
Trevor.

Hi,

I’ve tried to execute a query using two different collections, but i got a problem with the function “collection”… I can’t find the java class that contains that function … ??? Where is it?

Thanks in advance,

Malena

Oops!

It works! I changed a piece of code…

Malena