Changeset 654 for MDRepository/trunk/xquery/cmd-model.xqm
- Timestamp:
- 08/25/10 14:23:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xqm
r626 r654 84 84 let $child-results := 85 85 for $child in $children 86 let $child-doc := doc(concat(util:collection-name($child/root()), "/", $child/ResourceRef)),86 let $child-doc := if (empty($child/unresolvable-uri)) then doc(concat(util:collection-name($child/root()), "/", $child/ResourceRef)) else (), 87 87 $child-name := ($child-doc//Corpus/Name, $child-doc//Session/Name, "UNKNOWN")[1] 88 return if (empty($child-doc)) then <no-target proxy-id="{$child/@id}">{<proxy>{$child}</proxy>, <in-document>{concat(util:collection-name($child/root()), "/", util:document-name($child/root()))}</in-document>}</no-target>else88 return if (empty($child-doc)) then () (:<no-target proxy-id="{$child/@id}">{<proxy>{$child}</proxy>, <in-document>{concat(util:collection-name($child/root()), "/", util:document-name($child/root()))}</in-document>}</no-target> :) else 89 89 cmd-model:recurse-collections($child-doc, $child-name, $child-doc//Header/MdSelfLink, $child/@id, $depth - 1) 90 90 return … … 225 225 226 226 227 227 (: 228 Get the resource by handle or by path. 229 :) 230 declare function cmd-model:get-resource-by-handle-or-collection-path($id as xs:string) as node()? { 231 (: fixme! - urldecode $id when we decide to pass them encoded from the client. :) 232 if (starts-with($id, "test-")) then 233 collection($cmd-model:cmdiMirrorPath)//MdSelfLink[. = $id]/ancestor::CMD 234 else 235 collection($id)//IsPartOf[. = "root"]/ancestor::CMD 236 }; 228 237 229 238 (: … … 253 262 let $names := if (exists($collections[2])) then 254 263 ($cmd-model:commonFreqsPath, cmd-model:make-compound-doc-name($collections, "collection", $max-depth)) 264 else if (starts-with($collections, "test-")) then 265 ($cmd-model:commonFreqsPath, cmd-model:make-compound-doc-name($collections, "collection", $max-depth)) 255 266 else 256 267 ($collections, concat($cmd-model:collectionDocName, xs:string($max-depth))), … … 259 270 () 260 271 else 261 let $children := for $collection-item in $collections262 let $collection-item-docs := collection(concat($collection-item, "/", "Corpusstructure"))272 let $children := 273 for $collection-item in $collections 263 274 return 264 for $collection-doc in $collection-item-docs//CMDreturn275 for $collection-doc in cmd-model:get-resource-by-handle-or-collection-path($collection-item) return 265 276 cmd-model:recurse-collections($collection-doc, ($collection-doc//Corpus/Name, $collection-doc//Session/Name, "UNKNOWN")[1], $collection-doc//MdSelfLink, "", $max-depth) 266 277 return
Note: See TracChangeset
for help on using the changeset viewer.