This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.1"; | |
declare function local:get_facet ($books as element()*, $path as xs:string ) as element()? | |
{ | |
<binding>{ | |
for $book in $books | |
let $fld := $book/*[name()=$path] | |
group by $f := $fld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.1"; | |
declare function local:get_facet ($books as element()*, $path as xs:string, $facet_type as xs:string ) as element()? | |
{ | |
<facet type="{$facet_type}">{ | |
for $book in $books | |
let $fld := $book/*[name()=$path] | |
group by $f := $fld | |
order by $f descending | |
return element {$facet_type} {attribute v {$f}, attribute number {fn:count($book)} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.1"; | |
declare function local:get_facet ($books as element()*, $path as xs:string, $facet_type as xs:string ) as element()? | |
{ | |
<facet type="{$facet_type}">{ | |
for $book in $books | |
let $fld := | |
let $vars := map{ '': document{$book} } | |
let $query := "declare namespace tei = 'http://www.tei-c.org/ns/1.0'; " || $path | |
return xquery:eval($query, $vars ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.1"; | |
for $doc in fn:collection("books")/full-text | |
let $keys := fn:tokenize( fn:base-uri($doc), "/")[4] | |
for $key in $keys | |
return fn:collection("books")//key |