Changeset 670 for MDRepository
- Timestamp:
- 09/06/10 10:32:40 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xqm
r657 r670 91 91 cmd-model:recurse-collections($child-doc, $child-name, $child-doc//Header/MdSelfLink, $child/@id, $depth - 1) 92 92 return 93 <c n="{$parent}" handle="{$handle}" proxy-id="{$proxy-id}" cnt=" {sum($child-results/*:c/@cnt)}" sub-colls="{count($child-results)}" >{$child-results}</c>93 <c n="{$parent}" handle="{$handle}" proxy-id="{$proxy-id}" cnt="-1" sub-colls="{count($child-results)}" >{$child-results}</c> 94 94 else 95 95 <c n="{$parent}" handle="{$handle}" proxy-id="{$proxy-id}" cnt="{count(collection(concat(util:collection-name($collection/CMD[1]/root()), "/../"))//CMD[not(//ResourceType[. = "Metadata"])])}"></c> … … 165 165 declare function cmd-model:store-collection-data($data as node(), $collection-path as xs:string, $doc-name as xs:string) as xs:string? { 166 166 let $clarin-writer := fn:doc("/db/clarin/writer.xml"), 167 $dummy := xdb:login($cmd-model:cmdiDatabaseURI, $clarin-writer//write-user/text(), $clarin-writer//write-user-cred/text()) 167 $dummy := xdb:login($cmd-model:cmdiDatabaseURI, $clarin-writer//write-user/text(), $clarin-writer//write-user-cred/text()), 168 $store := (: util:catch("org.exist.xquery.XPathException", :) xdb:store($collection-path, $doc-name, $data),(: , ()) :) 169 $stored-doc := doc(concat($collection-path, "/", $doc-name)), 170 $coll-count := update value $stored-doc/Collections/@count with sum($stored-doc//c[not(c)]/@cnt) 168 171 return 169 (: util:catch("org.exist.xquery.XPathException", :) xdb:store($collection-path, $doc-name, $data)(: , ()) :) 172 for $i in $stored-doc//c[c] 173 return update value $i/@cnt with sum($i//c[not(c)]/@cnt) 174 170 175 }; 171 176 … … 273 278 cmd-model:recurse-collections($collection-doc, ($collection-doc//Corpus/Name, $collection-doc//Session/Name, "UNKNOWN")[1], $collection-doc//MdSelfLink, "", $max-depth) 274 279 return 275 cmd-model:store-collection-data(<Collections count=" {count($children/@cnt)}" root="{$collections}">{$children}</Collections>, $names[1], $names[2])280 cmd-model:store-collection-data(<Collections count="-1" sub-colls="{count($children)}" root="{$collections}">{$children}</Collections>, $names[1], $names[2]) 276 281 return 277 282 cmd-model:serialise-as(cmd-model:get-doc($names[1], $names[2]), $format)
Note: See TracChangeset
for help on using the changeset viewer.