Write in XQuery the following queries for the DBLP application and run them:
for $p in /dblp/*[author = "Moshe Y. Vardi"] order by xs:integer($p/year) descending return $p
for $p in /dblp/*[author = "Moshe Y. Vardi"] order by count($p/author) descending return $p
for $a in distinct-values(/dblp/book/author)
order by $a  
return 
<author>{$a}</author>
let $q := for $p in /dblp/*
          order by count($p/author)  descending
          return $p
return $q[1]          
(: compute the maximum number of authors :)
let $count := for $c in /dblp/* 
              return count($c/author)
let $max := max($count)              
(: find the papers with that number of authors :)
for $p in /dblp/*
where count($p/author) = $max  
return <pub authors="{$max}">{$p}</pub>
for $proc in /dblp/proceedings[editor = "Moshe Y. Vardi"] let $inproc := /dblp/inproceedings[crossref = $proc/@key] return ($proc, $inproc)
for $proc in /dblp/proceedings[editor = "Moshe Y. Vardi"]
let $inproc := /dblp/inproceedings[crossref = $proc/@key]
return <proceedings size="{count($inproc)}">{$proc/*}</proceedings>
for $hit score $score in /dblp/*[title contains text "XML"]
order by $score descending
return <hit score="{$score}">{$hit}</hit>
for $hit score $relevance in /dblp/inproceedings[title contains text "XML"]
let $authors := count($hit/author)
let $score := $relevance * $authors 
order by $score descending
return <hit relevance="{$relevance}" authors="{$authors}" score="{$score}">{$hit}</hit>
declare function local:avgh($doc as node()*, $author as xs:string) as xs:decimal
{
  let $pub := for $x in $doc/dblp/*[author=$author]
              order by xs:integer($x/@cites) descending
              return $x
  let $auth :=  for $n in (1 to count($pub))
                where xs:integer($pub[$n]/@cites) >= $n
                return count($pub[$n]/author)
  return avg($auth)
};