Changes

Jump to navigation Jump to search
975 bytes added ,  17:25, 13 July 2020
where $country/ethnicgroups = 'German'
order by $country/name[1]
return element { replace($country/@name, ' ', '') } {},
(: rewritten to :)
order by $country/name[1]
return element { replace($country/@name, ' ', '') } {}
</syntaxhighlight>
 
The [https://projects.cwi.nl/xmark/ XMark XML Benchmark] comes with sample auction data and a bunch of queries, some of which are suitable for index rewritings:
 
;XMark Query 1
 
<syntaxhighlight lang="xquery">
let $auction := doc('xmark')
return for $b in $auction/site/people/person[@id = "person0"]
return $b/name/text()
 
(: rewritten to :)
db:attribute('xmark', 'person0')/self::attribute(id)/parent::person/name/text()
</syntaxhighlight>
 
;XMark Query 8
 
<syntaxhighlight lang="xquery">
let $auction := doc('xmark')
return
for $p in $auction/site/people/person
let $a :=
for $t in $auction/site/closedauctions/closedauction
where $t/buyer/@person = $p/@id
return $t
return <item person='{$p/name/text()}'>{ count($a) }</item>,
 
(: rewritten to :)
db:open('xmark')/site/people/person !
<item person='{ name/text() }'>{ count(
db:attribute('xmark', @id)/self::attribute(person)/parent::buyer/parent::closed_auction
)
}</item>
</syntaxhighlight>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu