Changeset 696 for MDRepository
- Timestamp:
- 09/15/10 07:58:46 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xqm
r695 r696 36 36 37 37 38 declare function cmd-model:elem($collection as xs:string, $path as xs:string, $depth as xs:integer) as element() { 39 cmd-model:elem-r($collection, $path, $depth, $depth) 38 declare function cmd-model:elem($collections as xs:string+, $path as xs:string, $depth as xs:integer) as element() { 39 (: fixme! - handle multiple collections :) 40 cmd-model:elem-r($collections, $path, $depth, $depth) 40 41 }; 41 42 … … 130 131 131 132 :) 132 declare function cmd-model:create-doc($collection as xs:string, $type-name as xs:string, $depth as xs:integer) as xs:string* {133 declare function cmd-model:create-doc($collections as xs:string+, $type-name as xs:string, $depth as xs:integer) as xs:string* { 133 134 (: if newer data available :) 134 cmd-model:store-result($collection , cmd-model:elem($collection, $type-name, $depth), $type-name, $depth)135 cmd-model:store-result($collections, cmd-model:elem($collections, $type-name, $depth), $type-name, $depth) 135 136 (:else () :) 136 137 }; … … 139 140 140 141 :) 141 declare function cmd-model:get-result-doc($collection as xs:string, $type-name as xs:string, $depth as xs:integer) as item()* { 142 let $name-last := text:groups($type-name, "/(\w+)$")[last()], 143 $new-name := if (fn:empty($name-last)) then $type-name else $name-last, 144 $dummy := if (cmd-model:is-result-available($collection, fn:concat("/", $new-name, xs:string($depth)))) then 142 declare function cmd-model:get-result-doc($collections as xs:string+, $type-name as xs:string, $depth as xs:integer) as item()* { 143 let $name := cmd-model:make-compound-doc-name($collections, "values", xs:string($depth)), 144 $dummy := if (cmd-model:is-result-available($cmd-model:commonFreqsPath, $name))) then 145 145 () 146 146 else 147 cmd-model:create-doc($collection , $type-name, $depth)148 return 149 fn:doc(fn:concat($collection, "/", $new-name, xs:string($depth), $cmd-model:xmlExt))147 cmd-model:create-doc($collections, $type-name, $depth) 148 return 149 cmd-model:get-doc($cmd-model:commonFreqsPath, $name) 150 150 }; 151 151 … … 181 181 $dummy := xdb:login($cmd-model:cmdiDatabaseURI, $clarin-writer//write-user/text(), $clarin-writer//write-user-cred/text()) 182 182 return 183 184 if (fn:exists($coll-names[2])) then 185 (: Det gÀller fler Àn en samling. :) 186 xdb:store($cmd-model:commonFreqsPath, cmd-model:make-compound-doc-name($coll-names, $type-name, $depth), cmd-model:make-doc-element-of-type($type-name, $coll-names, $entries, $depth)) 187 else 188 (: Det gÀller endast en samling. :) 189 let $dummy := util:log('debug', fn:concat('Stores ', $type-name, ' in ', $coll-names)) 190 return xdb:store($coll-names, cmd-model:make-doc-name($coll-names, $type-name, xs:string($depth), fn:false()), cmd-model:make-doc-element-of-type($type-name, (), $entries, xs:string($depth))) 191 }; 192 193 (: 194 Store the collection listing in give collection. 183 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, $depth)) 184 }; 185 186 (: 187 Store the collection listing for given collection. 195 188 :) 196 189 declare function cmd-model:store-collection-data($data as node(), $collection-path as xs:string, $doc-name as xs:string) as xs:string? {
Note: See TracChangeset
for help on using the changeset viewer.