Changeset 711 for MDRepository


Ignore:
Timestamp:
09/20/10 16:04:17 (14 years ago)
Author:
ljo
Message:

cmd-model - some initial cleanup before new refactoring.

Location:
MDRepository/trunk/xquery
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MDRepository/trunk/xquery/cmd-model.xql

    r710 r711  
    1010at "xmldb:exist:///db/clarin/cmd-model.xqm";
    1111
    12 (: path="olac/OLAC/The_LINGUIST_List_Language_Resources", q="MDGroup.Actors.Actor", maxdepth=4 :)
    1312
    1413declare function local:cmd-model() as item()* {
  • MDRepository/trunk/xquery/cmd-model.xqm

    r709 r711  
    4343};
    4444
    45 declare function cmd-model:elem-r($collection as xs:string+, $path as xs:string, $max-depth as xs:integer, $depth as xs:integer) as element() {
    46   (: let $path-nodes := util:eval(fn:concat("collection('", $collection, "')//", $path)) :)
    47         let $path-nodes :=
    48                 if ($collection[1]=$cmd-model:collectionRoot) then
    49                                 util:eval(fn:concat("collection('", $cmd-model:cmdiMirrorPath, "')//", $path))
    50                         else
    51                                 for $coll in $collection return util:eval(fn:concat("collection('", $cmd-model:cmdiMirrorPath, "')//CMD[.//IsPartOf='", xdb:decode($coll) ,"']//", $path))
     45declare function cmd-model:elem-r($collections as xs:string+, $path as xs:string, $max-depth as xs:integer, $depth as xs:integer) as element() {
     46  let $collection := collection($cmd-model:cmdiMirrorPath),
     47    $path-nodes :=
     48    if ($collections[1] = $cmd-model:collectionRoot) then
     49      util:eval(fn:concat("$collection//", $path))
     50    else
     51      for $coll in $collections return util:eval(fn:concat("$collection//CMD[descendant::IsPartOf = '", xdb:decode($coll) ,"']//", $path))
    5252
    5353  let $path-count := count($path-nodes)
     
    322322  API function searchRetrieve.
    323323:)
    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()* {
    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"))
     324declare function cmd-model:search-retrieve($cql-query as xs:string, $collections as xs:string+, $format as xs:string, $start-item as xs:integer, $end-item as xs:integer) as item()* {
     325  let $collection := collection($cmd-model:cmdiMirrorPath),
     326    $results :=
     327    if ($collections[1] = $cmd-model:collectionRoot) then
     328      util:eval(fn:concat("$collection", xdb:decode($cql-query), "/ancestor::CMD"))
    328329    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      for $coll in $collections return util:eval(fn:concat("$collection", xdb:decode($cql-query), "/ancestor::CMD[descendant::IsPartOf = '", xdb:decode($coll) ,"']"))
    330331
    331332    let $result-count := fn:count($results),
Note: See TracChangeset for help on using the changeset viewer.