- Timestamp:
- 02/03/10 23:33:28 (14 years ago)
- Location:
- MDService/trunk/xquery
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService/trunk/xquery/cmd-model.xql
r139 r174 4 4 $Id$ 5 5 :) 6 import module namespace request="http://exist-db.org/xquery/request"; 6 7 7 8 import module namespace cmd-model = "http://spraakbanken.gu.se/clarin/xquery/model" … … 9 10 10 11 (: 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) 12 13 declare function local:cmd-model() as item()* { 14 let $action := request:get-parameter("operation", ""), 15 $cmd-index := request:get-parameter("q", "MDGroup/Actors/Actor"), 16 $cmd-index-path := 17 if (fn:contains($cmd-index, ".")) then 18 fn:translate($cmd-index, ".", "/") 19 else 20 $cmd-index, 21 $format := request:get-parameter("format", "xml"), 22 $path := fn:concat("/db/cmdi-mirror/", request:get-parameter("path", "silang_data")), 23 $max-depth as xs:integer := xs:integer(request:get-parameter("maxdepth", 1)) 24 25 return 26 cmd-model:get-result-doc($path, $cmd-index-path, $max-depth) 27 }; 28 29 local:cmd-model() -
MDService/trunk/xquery/cmd-model.xqm
r125 r174 11 11 declare variable $cmd-model:cmdiMirrorPath as xs:string {"/db/cmdi-mirror"}; 12 12 13 declare variable $cmd-model:typeActorPath as xs:string {"//MDGroup/Actors/Actor"}; 13 declare variable $cmd-model:typeActorPath as xs:string {"MDGroup/Actors/Actor"}; 14 declare variable $cmd-model:typeActorPath0 as xs:string {"Actor"}; 14 15 15 16 declare variable $cmd-model:typeActorPathElementPrefix as xs:string {"actor"}; … … 20 21 21 22 declare function cmd-model:elem($collection as xs:string, $path as xs:string, $depth as xs:integer) as element() { 22 let $path-nodes := util:eval(fn:concat("collection('", $collection, "') ", $path))23 let $path-nodes := util:eval(fn:concat("collection('", $collection, "')//", $path)) 23 24 let $path-count := count($path-nodes) 24 25 … … 28 29 let $text-count-distinct := count(distinct-values($text-nodes)) 29 30 return 30 <elem path="{ $path}" count="{$path-count}" count_text="{$text-count}" count_distinct_text="{$text-count-distinct}" >31 <elem path="{fn:concat("//", $path)}" count="{$path-count}" count_text="{$text-count}" count_distinct_text="{$text-count-distinct}" > 31 32 { if ($depth > 0) then 32 33 for $elname in $subs[. != ''] … … 82 83 cmd-model:create-doc($collection, $type-name, $depth) 83 84 return 84 fn:doc(fn:concat($collection, "/", $ type-name, xs:string($depth), $cmd-model:xmlExt))85 fn:doc(fn:concat($collection, "/", $new-name, xs:string($depth), $cmd-model:xmlExt)) 85 86 }; 86 87 … … 163 164 if ($type-name eq $cmd-model:typeActorPath) then 164 165 fn:concat($cmd-model:typeActorPathElementPrefix, $cmd-model:docTypeSuffix) 166 else if ($type-name eq $cmd-model:typeActorPath0) then 167 fn:concat($cmd-model:typeActorPathElementPrefix, $cmd-model:docTypeSuffix) 165 168 else 166 169 ()
Note: See TracChangeset
for help on using the changeset viewer.