Changeset 709 for MDRepository
- Timestamp:
- 09/20/10 15:24:19 (14 years ago)
- Location:
- MDRepository/trunk/xquery
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xql
r708 r709 22 22 $format := request:get-parameter("format", $cmd-model:responseFormatXml), 23 23 $collection := "/db/cmdi-mirror", 24 $collection-params := request:get-parameter("collection", ()),24 $collection-params := request:get-parameter("collection", $cmd-model:collectionRoot), 25 25 $query-model-collection := 26 26 if (fn:empty($collection-params)) then fn:concat($collection, "/") … … 33 33 fn:concat($collection, "/", $coll), 34 34 $query-collections := 35 if ( fn:empty($collection-params) or $collection-params='') then35 if (matches($collection-params, "^root$") or $collection-params eq "") then 36 36 $cmd-model:collectionRoot 37 37 else -
MDRepository/trunk/xquery/cmd-model.xqm
r707 r709 87 87 88 88 :) 89 declare function cmd-model:recurse-collections-model($collection as xs:string, $type-name as xs:string, $depth as xs:integer ) as item()* {89 declare function cmd-model:recurse-collections-model($collection as xs:string, $type-name as xs:string, $depth as xs:integer, $name as xs:string) as item()* { 90 90 let $children := xdb:get-child-collections($collection) 91 91 return … … 94 94 for $child in $children 95 95 return 96 cmd-model:recurse-collections-model(fn:concat($collection, '/', xs:string($child)), $type-name, $depth ),97 $current := cmd-model:create-doc($collection, $type-name, $depth )96 cmd-model:recurse-collections-model(fn:concat($collection, '/', xs:string($child)), $type-name, $depth, $name), 97 $current := cmd-model:create-doc($collection, $type-name, $depth, $name) 98 98 return ($current, $child-results) 99 99 else 100 cmd-model:create-doc($collection, $type-name, $depth )100 cmd-model:create-doc($collection, $type-name, $depth, $name) 101 101 }; 102 102 … … 139 139 140 140 :) 141 declare function cmd-model:create-doc($collections as xs:string+, $type-name as xs:string, $depth as xs:integer ) as xs:string* {141 declare function cmd-model:create-doc($collections as xs:string+, $type-name as xs:string, $depth as xs:integer, $name as xs:string) as xs:string* { 142 142 (: if newer data available :) 143 cmd-model:store-result($collections, cmd-model:elem($collections, $type-name, $depth), $ type-name, $depth)143 cmd-model:store-result($collections, cmd-model:elem($collections, $type-name, $depth), $name, $depth) 144 144 (:else () :) 145 145 }; … … 153 153 () 154 154 else 155 cmd-model:create-doc($collections, $type-name, $depth )155 cmd-model:create-doc($collections, $type-name, $depth, $name) 156 156 return 157 157 cmd-model:get-doc($cmd-model:commonFreqsPath, $name) … … 223 223 :) 224 224 declare function cmd-model:make-compound-doc-name($coll-names as xs:string+, $type-name as xs:string, $depth as xs:string) as xs:string { 225 let $name-prefix := fn:concat($type-name, $depth) 226 return 227 fn:concat($name-prefix, "-", util:hash(string-join($coll-names, ""), "MD5"), $cmd-model:xmlExt) 225 let $name-prefix := fn:concat($type-name, $depth), 226 $sorted-names := for $coll in $coll-names order by $coll ascending return $coll 227 return 228 fn:concat($name-prefix, "-", util:hash(string-join($sorted-names, ""), "MD5"), $cmd-model:xmlExt) 228 229 }; 229 230 … … 322 323 :) 323 324 declare function cmd-model:search-retrieve($cql-query as xs:string, $collection as xs:string+, $format as xs:string, $start-item as xs:integer, $end-item as xs:integer) as item()* { 324 (: let $results := for $coll in $collection return util:eval(fn:concat("collection('", xdb:decode($coll), "')", xdb:decode($cql-query), "/ancestor::CMD")), :) 325 let $results := 326 if ($collection[1]=$cmd-model:collectionRoot) then 327 util:eval(fn:concat("collection('", $cmd-model:cmdiMirrorPath, "')", xdb:decode($cql-query), "/ancestor::CMD")) 328 else 329 for $coll in $collection return util:eval(fn:concat("collection('", $cmd-model:cmdiMirrorPath, "')", xdb:decode($cql-query), "/ancestor::CMD", "[.//IsPartOf='", xdb:decode($coll) ,"']")) 325 let $results := 326 if ($collection[1] = $cmd-model:collectionRoot) then 327 util:eval(fn:concat("collection('", $cmd-model:cmdiMirrorPath, "')", xdb:decode($cql-query), "/ancestor::CMD")) 328 else 329 for $coll in $collection return util:eval(fn:concat("collection('", $cmd-model:cmdiMirrorPath, "')", xdb:decode($cql-query), "/ancestor::CMD[descendant::IsPartOf = '", xdb:decode($coll) ,"']")) 330 330 331 331 let $result-count := fn:count($results),
Note: See TracChangeset
for help on using the changeset viewer.