Changeset 570 for MDRepository
- Timestamp:
- 07/05/10 15:35:36 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xqm
r301 r570 159 159 Store the collection listing in give collection. 160 160 :) 161 declare function cmd-model:store-collection-data($data as node(), $collection-path as xs:string ) as xs:string? {161 declare function cmd-model:store-collection-data($data as node(), $collection-path as xs:string, $doc-name as xs:string) as xs:string? { 162 162 let $clarin-writer := fn:doc("/db/clarin/writer.xml"), 163 163 $dummy := xdb:login($cmd-model:cmdiDatabaseURI, $clarin-writer//write-user/text(), $clarin-writer//write-user-cred/text()) 164 164 return 165 (: util:catch("org.exist.xquery.XPathException", :) xdb:store($collection-path, $ cmd-model:collectionDocName, $data)(: , ()) :)165 (: util:catch("org.exist.xquery.XPathException", :) xdb:store($collection-path, $doc-name, $data)(: , ()) :) 166 166 }; 167 167 … … 249 249 :) 250 250 declare function cmd-model:get-collections($collections as xs:string+, $format as xs:string, $max-depth as xs:integer) as item() { 251 (: fixme! - collections, is-doc-available only takes one collection.:) 252 let $dummy := if (cmd-model:is-doc-available($collections, $cmd-model:collectionDocName)) then 253 () 251 let $names := if (exists($collections[2])) then 252 ($cmd-model:commonFreqsPath, cmd-model:make-compound-doc-name($collections, "collection", $max-depth)) 254 253 else 255 let $children := for $collection-item in $collections 256 return 257 cmd-model:recurse-collections($collection-item, $max-depth) 258 return 259 cmd-model:store-collection-data(<Collections count="{count($children)}" root="{$collections}">{$children}</Collections>, $collections) 254 ($collections, $cmd-model:collectionDocName), 255 $dummy := 256 if (cmd-model:is-doc-available($names[1], $names[2])) then 257 () 258 else 259 let $children := for $collection-item in $collections 260 return 261 cmd-model:recurse-collections($collection-item, $max-depth) 262 return 263 cmd-model:store-collection-data(<Collections count="{count($children)}" root="{$collections}">{$children}</Collections>, $names[1], $names[2]) 260 264 return 261 cmd-model:serialise-as(cmd-model:get-doc($collections, $cmd-model:collectionDocName), $format)265 cmd-model:serialise-as(cmd-model:get-doc($names[1], $names[2]), $format) 262 266 }; 263 267 … … 266 270 :) 267 271 declare function cmd-model:search-retrieve($cql-query as xs:string, $collection as xs:string+, $format as xs:string, $start-item as xs:integer, $end-item as xs:integer) as item()* { 268 let $results := util:eval(fn:concat("collection('", xdb:decode($collection), "')", xdb:decode($cql-query), "/ancestor::CMD")),272 let $results := for $coll in $collection return util:eval(fn:concat("collection('", xdb:decode($coll), "')", xdb:decode($cql-query), "/ancestor::CMD")), 269 273 $result-count := fn:count($results), 270 274 $result-seq := fn:subsequence($results, $start-item, $end-item),
Note: See TracChangeset
for help on using the changeset viewer.