how to use the reserved word about every,some,empy,distinct

Can anyone tell me if Tamino 4.1 XQuery implements W3c XQuery quantified expressios:
some and every? And distinct function?
If not, any suggestion on how to implement the quantified semantic in Tamino XQuery?
for example,
1.for $a in distinct-values (input()/article/prolog/dateline/date)
let $b := input()/article/prolog/dateline[date=$a]


for $a in input()/article[@id=“8”]/body/section
$p in input()/article[@id=“8”]/body/section
[. >> $a][1]


3.for $a in input()/article
where some $b in $a/body/abstract/p satisfies
(contains($b, “the”) and contains($b, “hockey”))

Thanks in advancd,
Best regards,

Hi Gavinzheng,

with version 4.2 Tamino supports the distinct-values() function and
thus your no. 1 should work. In 4.1 it does not, so please upgrade
if possible.

No. 3 works too but needs to be adopted since we do not support
quantified expressions. Since a predicate in XQuery has an implicit
any semantic, there is a workaround here as follows:

for $a in input()/article
where $a/body/abstract/p[contains(., “the”) and contains(., “hockey”)]
return $a/prolog/title

things are more complicated with ‘every’ expressions. One idea is to
test whether the total numer of p elements and the number of those
fulfilling the required condition are equal. This should work in both
4.1 and 4.2 alike.

Your no. 2 is tough. We do not support node comparison (i.e. >>).
There are lots of workarounds here which are also not supported:
the sibling axes, the ‘at’ expression in for clauses, etc. The only
way I managed in Tamino is concatenating all section headers into a
string separating them with a certain text marker, inserting a special
marker for ‘introduction’ and cutting the required bit out with
substring functions. The following worked for me :

for $a in input()/article[@id=“8”]/body/section/@heading
return (string($a),(“xxx”)[$a=“Introduction”],“yyy”)), “”),

substring-after() and substring-before() are added with 4.2 thus an
upgrade is required.


to Juliane:
Thanks you very much.
And in the document of Tamino,I found that ‘empty’,‘some’ and ‘every’ are the reserved word,so I think it should be implement in 4.1 version,and as you say,

for $a in input()/article
where some $b in $a/body/abstract/p satisfies
(contains($b, “the”) and contains($b, “hockey”))

can be writen as
for $a in input()/article
where $a/body/abstract/p[contains(., “the”) and contains(., “hockey”)]
return $a/prolog/title

but if the “some” change to “erery”,how can I implement it? and how to use empty? for example,

for $a in input()/article/prolog
where empty ($a/genre)


Thanks you very much,
best regards,

Hi GavinZheng,

where every $b in $a/body/abstract/p satisfies
(contains($b, “the”) and contains($b, “hockey”))

can be rewritten as

where count($a/body/abstract/p)
= count($a/body/abstract/p[contains(.,“the”) and contains(.,“hockey”)])

The fact that a word is reserved in Tamino 4.1 does not necessarily
mean that it is already implemented. We do that to enable implementing
it in subsequent versions without ruining existing user queries.

empty() is also not yet implemented, use count() = 0 instead.
In your case just $a/genre instead of empty($a/genr) will do since an
empty sequence is treated as false when cast to boolean.


Thank you very much!
Best regards,

btw,when I query the xml ,if the result is so big,how can I litmit the size,for example,in many API,we can use setFetchSize method to limit the result size every time,then call next method to get next size result,but I can’t find the method in Tamino API,how can I implement it?must I write the query statement?
for example,when the result is very big,it will throws the execption as following:

[Query:main:141] – NestedException:Tamino access failure (INOXYE9291, Transaction aborted because it has taken too long)