Changeset 654 for MDRepository
- Timestamp:
- 08/25/10 14:23:00 (14 years ago)
- Location:
- MDRepository/trunk/xquery
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xql
r571 r654 22 22 $format := request:get-parameter("format", $cmd-model:responseFormatXml), 23 23 $collection := "/db/cmdi-mirror", 24 $query-model-collection := fn:concat($collection, "/", if (fn:empty(request:get-parameter("collection", ()))) then "silang_data" else ""), 24 $collection-params := request:get-parameter("collection", ()), 25 $query-model-collection := 26 if (fn:empty($collection-params)) then fn:concat($collection, "/") 27 else 28 for $coll in $collection-params 29 return 30 if (starts-with($coll, "test-")) then 31 $coll 32 else 33 fn:concat($collection, "/", $coll), 25 34 $query-collections := 26 if (fn:empty( request:get-parameter("collection", ()))) then35 if (fn:empty($collection-params)) then 27 36 $collection 28 37 else 29 for $coll in request:get-parameter("collection", ()) 30 return fn:concat($collection, "/", $coll), 38 for $coll in $collection-params 39 return 40 if (starts-with($coll, "test-")) then 41 $coll 42 else 43 fn:concat($collection, "/", $coll), 31 44 $max-depth as xs:integer := xs:integer(request:get-parameter("maxdepth", 1)) 32 45 return -
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 -
MDRepository/trunk/xquery/cmd-stats.xql
r641 r654 6 6 <item label="ResourceProxy - Resource" >count(//ResourceProxy[ResourceType='Resource'])</item>, 7 7 <item label="ResourceProxy - Metadata" >count(//ResourceProxy[ResourceType='Metadata'])</item>, 8 <item label="CMD with MD , Res" >count((//CMD[.//ResourceType='Resource'], //CMD[.//ResourceType='Metadata']))</item>,8 <item label="CMD with MD and Res (fixme!)" >count((//CMD[.//ResourceType='Resource'], //CMD[.//ResourceType='Metadata']))</item>, 9 9 <item label="CMD without " >count(//CMD[not(.//ResourceType='Resource')][not(.//ResourceType='Metadata')])</item>, 10 10 <item label="CMD with relative Resource (starts-with('.'))" >count(//CMD[.//ResourceType='Resource'][starts-with(.//ResourceRef,'.')])</item>,
Note: See TracChangeset
for help on using the changeset viewer.