Changeset 681 for MDRepository
- Timestamp:
- 09/08/10 21:05:29 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xqm
r670 r681 84 84 let $child-results := 85 85 for $child in $children 86 let $child-doc := if (empty($child/unresolvable-uri)) then doc(concat(util:collection-name($child/root()), "/", $child/ResourceRef)) else (), 87 $child-name := ($child-doc//Corpus/Name, $child-doc//Session/Name, "UNKNOWN")[1] 86 let $child-doc := if (empty($child/unresolvable-uri)) then 87 cmd-model:get-resource-by-handle-or-collection-path(util:collection-name($child/root()), $child/ResourceRef) else (), 88 $child-name := ($child-doc//Corpus/Name, $child-doc//Session/Name, $child-doc//Collection/GeneralInfo/Name, "UNKNOWN")[1] 88 89 return 89 90 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> :) … … 235 236 Get the resource by handle or by path. 236 237 :) 237 declare function cmd-model:get-resource-by-handle-or-collection-path($id as xs:string) as node()* { 238 (: fixme! - urldecode $id when we decide to pass them encoded from the client. :) 239 if (starts-with($id, "test-")) then 240 collection($cmd-model:cmdiMirrorPath)//MdSelfLink[. = xdb:decode($id)]/ancestor::CMD 238 declare function cmd-model:get-resource-by-handle-or-collection-path($id as xs:string, $doc-name as xs:string?) as node()* { 239 if (starts-with($id, "test-") or starts-with($id, "clarin.at") or starts-with($doc-name, "clarin.at")) then 240 collection($cmd-model:cmdiMirrorPath)//MdSelfLink[. = xdb:decode(($doc-name, $id)[1])]/ancestor::CMD 241 else if (empty($doc-name)) then 242 collection($id)//IsPartOf[. = "root"]/ancestor::CMD 241 243 else 242 collection($id)//IsPartOf[. = "root"]/ancestor::CMD244 doc(concat($id, "/", $doc-name)) 243 245 }; 244 246 … … 275 277 for $collection-item in $collections 276 278 return 277 for $collection-doc in cmd-model:get-resource-by-handle-or-collection-path($collection-item ) return279 for $collection-doc in cmd-model:get-resource-by-handle-or-collection-path($collection-item, ()) return 278 280 cmd-model:recurse-collections($collection-doc, ($collection-doc//Corpus/Name, $collection-doc//Session/Name, "UNKNOWN")[1], $collection-doc//MdSelfLink, "", $max-depth) 279 281 return
Note: See TracChangeset
for help on using the changeset viewer.