- Timestamp:
- 01/22/10 12:26:09 (14 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
MDService/trunk/xquery/cmd-model.xql
r138 r139 1 declare namespace m = "http://www.vronk.net/metares";1 xquery version "1.0"; 2 2 3 3 (: … … 8 8 at "xmldb:exist:///db/clarin/cmd-model.xqm"; 9 9 10 declare function m:elem($collection as xs:string, $path as xs:string, $depth as xs:integer) as element() { 11 let $path-nodes := util:eval(fn:concat("collection('", $collection, "')", $path)) 12 let $path-count := count($path-nodes) 13 14 let $subs := distinct-values($path-nodes/child::element()/name()) 15 let $text-nodes := $path-nodes//text() 16 let $text-count := count($text-nodes) 17 let $text-count-distinct := count(distinct-values($text-nodes)) 18 return 19 <elem path="{$path}" count="{$path-count}" count_text="{$text-count}" count_distinct_text="{$text-count-distinct}" > 20 { if ($depth > 0) then 21 for $elname in $subs[. != ''] 22 return 23 m:elem($collection, concat($path, '/', $elname), $depth - 1) 24 else 'maxdepth' 25 }</elem> 26 }; 27 28 declare function m:paths($n) { 29 for $el in $n 30 return <elem name="{$el/name()}" > { 31 for $anc in $el/parent::element() 32 return util:node-xpath($anc) 33 }</elem> 34 }; 35 36 37 cmd-model:recurse-collections-model("/db/cmdi-mirror/olac/OLAC/The_LINGUIST_List_Language_Resources", "//MDGroup/Actors/Actor", 4) 38 (: cmd-model:get-result-doc("/db/cmdi-mirror/silang_data", "Actor", 4) :) 39 (: cmd-model:recurse-collections-model("/db/cmdi-mirror", "//MDGroup/Actors/Actor", 4) :) 40 (: m:elem("/db/cmdi-mirror/donated_corpora", '//MDGroup/Actors/Actor', 4) :) 41 (: m:paths(//Name) :) 10 (: cmd-model:recurse-collections-model("/db/cmdi-mirror/olac/OLAC/The_LINGUIST_List_Language_Resources", "//MDGroup/Actors/Actor", 4) :) 11 cmd-model:get-result-doc("/db/cmdi-mirror/silang_data", "Actor", 4)
Note: See TracChangeset
for help on using the changeset viewer.