node comparison: is, <<, >> - porovnává identitu a pořadí nodů v dokumentu
node contructors
je možné vytvářet nové uzly, atributy, hodnoty apod. na základě již existujících
direct constructors: <movies>{ count(//movie) }</movies> - přímý zápis XML (prostě začnu psát daný element a do něj pomocí složených závorek XQuery zápis)
computed constructors: element movies { count(//movie) } - dynamické vytváření
element - for nodes
attribute - for attributes
text - for text nodes
FLWOR expressions
for, let, where, order by, return
for loop also contains optional positional variables, which provide an ordinal number of the current item
proměnné označuji jako v PHP ($movies = //movie)
umožňují pokročilou práci s cykly
switch expressions
conditional expressions
také jsou možné podmínky (if - then - else)
větev else je povinná
mohu vložit prázdnou sequence (else ())
quantified expressions
používají se v rámci klauzule where
some - alespoň jeden
every - pro všechny
some $a in //movie/actors satisfies $a = 'Barta'
boolean expressions
including and, or, not… ve where klauzule
primary expressions
literály
# Node constructor<movies><count>{ count(//movie) }</count>{for $m in //moviereturn<movie year="{ data($m/@year) }">{ $m/title/text() }</movie>}</movies># Alternative syntaxelement movies { element count { count(//movie) }, for $m in //movie return element movie { attribute year { data($m/@year) }, text { $m/title/text() } }}# FLWOR# najdi titulky filmů natočených v roce 2000 a později, mají max 3 herce a rating je lepší než průměrlet $r := avg(//movie/@rating)for $m in //movie[@rating >= $r]let $a := count($m/actor)where ($a <= 3) and ($m/@year >= 2000)order by $a ascending, $m/title descendingreturn $m/title# Conditionsif (count(//movie) > 0)then <movies>{ string-join(//movie/title, ", ") }</movies>else ()# Quantified expressionsfor $m in //movie where some $a in $m/actor satisfies $a = "Ivan Trojan" return $m/title/text()