Changeset 714 for MDRepository
- Timestamp:
- 09/24/10 09:02:12 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xqm
r711 r714 46 46 let $collection := collection($cmd-model:cmdiMirrorPath), 47 47 $path-nodes := 48 if ($collections[1] =$cmd-model:collectionRoot) then48 if ($collections[1] eq $cmd-model:collectionRoot) then 49 49 util:eval(fn:concat("$collection//", $path)) 50 50 else 51 for $coll in $collections return util:eval(fn:concat("$collection// CMD[descendant::IsPartOf = '", xdb:decode($coll) ,"']//", $path))51 for $coll in $collections return util:eval(fn:concat("$collection//ft:query(descendant::IsPartOf, <query><term>", xdb:decode($coll) ,"</term></query>)//", $path, "/ancestor::CMD")) 52 52 53 53 let $path-count := count($path-nodes) … … 70 70 declare function cmd-model:values($nodes as node()*) as node()* { 71 71 let $keys := distinct-values($nodes/text()) 72 for $key at $pos in $keys[if ($cmd-model:valuesLimit eq 0) then () else (1 to $cmd-model:valuesLimit)] 72 let $values := for $key at $pos in $keys 73 73 let $kcount := count($nodes[. eq $key]) 74 74 order by lower-case($key) ascending 75 75 return <v key="{$key}" cnt="{$kcount}" /> 76 return 77 if ($cmd-model:valuesLimit eq 0) then $values 78 else 79 subsequence($values, 1, $cmd-model:valuesLimit) 76 80 }; 77 81 … … 170 174 :) 171 175 declare function cmd-model:is-result-available($collection as xs:string, $result-ref as xs:string) as xs:boolean { 172 fn:doc-available(fn:concat($collection, $result-ref, $cmd-model:xmlExt))176 fn:doc-available(fn:concat($collection, "/", $result-ref)) 173 177 }; 174 178 … … 189 193 $dummy := xdb:login($cmd-model:cmdiDatabaseURI, $clarin-writer//write-user/text(), $clarin-writer//write-user-cred/text()) 190 194 return 191 xdb:store($cmd-model:commonFreqsPath, cmd-model:make-compound-doc-name($coll-names, $type-name, xs:string($depth)), cmd-model:make-doc-element-of-type($type-name, $coll-names, $entries, xs:string($depth)))195 xdb:store($cmd-model:commonFreqsPath, $type-name, cmd-model:make-doc-element-of-type($type-name, $coll-names, $entries, xs:string($depth))) 192 196 }; 193 197 … … 295 299 API function queryModel. 296 300 :) 297 declare function cmd-model:query-model($cmd-index-path as xs:string, $collection as xs:string+, $format as xs:string, $max-depth as xs:integer) as item() {301 declare function cmd-model:query-model($cmd-index-path as xs:string, $collection as xs:string+, $format as xs:string, $max-depth as xs:integer) as item()? { 298 302 cmd-model:serialise-as(cmd-model:get-result-doc($collection, $cmd-index-path, $max-depth), $format) 299 303 }; … … 325 329 let $collection := collection($cmd-model:cmdiMirrorPath), 326 330 $results := 327 if ($collections[1] =$cmd-model:collectionRoot) then331 if ($collections[1] eq $cmd-model:collectionRoot) then 328 332 util:eval(fn:concat("$collection", xdb:decode($cql-query), "/ancestor::CMD")) 329 333 else
Note: See TracChangeset
for help on using the changeset viewer.