TaminoClient query question

Hi there,

I tried this query but gets a NullPointerException:

TaminoResult tr = tamino.query(“VEHICLETEST[contains(@PREMAX,"abc")]”);

But this works fine:

TaminoResult tr = tamino.query(“VEHICLETEST[@PREMAX="abc"]”);

My understanding is that the XPath functions are all supported in Tamino. Am I right? If not what is the syntax for expressing “an attribute that contains a certain string”?

Any help and insights are appreciated.

Eric

hi,
this is really not an API question but a query question.
what result do the queries get when you run them in the interactive interface?

regards,
andreas f.

Andreas, Thanks for the prompt reply.

Here is the response I got from the Interactive Interface:

- <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2” xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions)”>
xql:queryVEHICLETEST[contains(PREMAX,“157.63”)]</xql:query>
- <ino:message ino:returnvalue=“8873”>
<ino:messagetext ino:code=“INOXRE8873”>Server extensions: function not found</ino:messagetext>
ino:messagelineSXS function name = contains</ino:messageline>
</ino:message>
</ino:response>

Looks like the “contains” function is not supported. I am just picking up Tamino and not quite familiar with what “server extensions” are. Do I need to install/configure/enable some extensions for this to work? And if this function is not supported, how do I query “an attribute contains a certain substring?” I know this is not an API question but nonetheless I appreciate your help on this.

Thanks,

Eric

Hi Eric,

I think that there are two ways to proceed: the easy way and the adventurous way!

The easy way is to reformulate your query into a Tamino friendly X-Query (please note the hyphen!):
  VEHICLETEST[PREMAX~=“157.63”]

This will query for VEHICLETEST documents in which the PREMAX element contains “157.63”.
(If your query is on an attribute, the name should be prefixed with an ‘@’, e.g. [@PREMAX~=“157.62”])

The adventurous way would be to install the Server Extension for extra query functions which ships with Tamino. (There is a “contains” function in this Server Extension, though I am not sure if it is exactly what you need.)

Please see the documentation on Server Extensions, and then the Advanced Concepts chapter on “Utilizing Server Extensions”. (This chapter contains a section “More examples”, in which you will find information about the Server Extension providing “…some of the XPath functions that did not find their way into X-Query”.)

I hope this helps,
Trevor.