Ignore:
Timestamp:
02/03/10 23:33:28 (14 years ago)
Author:
ljo
Message:

queryModel() now taking parameters q (eg MDGroup.Actors.Actor), maxdepth (n default 1), path (material name path eg silang_data or olac/OLAC/The_LINGUIST_List_Language_Resources) and format (only default xml)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MDService/trunk/xquery/cmd-model.xqm

    r125 r174  
    1111declare variable $cmd-model:cmdiMirrorPath as xs:string {"/db/cmdi-mirror"};
    1212
    13 declare variable $cmd-model:typeActorPath as xs:string {"//MDGroup/Actors/Actor"};
     13declare variable $cmd-model:typeActorPath as xs:string {"MDGroup/Actors/Actor"};
     14declare variable $cmd-model:typeActorPath0 as xs:string {"Actor"};
    1415
    1516declare variable $cmd-model:typeActorPathElementPrefix as xs:string {"actor"};
     
    2021
    2122declare function cmd-model:elem($collection as xs:string, $path as xs:string, $depth as xs:integer) as element() {
    22   let $path-nodes := util:eval(fn:concat("collection('", $collection, "')", $path))
     23  let $path-nodes := util:eval(fn:concat("collection('", $collection, "')//", $path))
    2324  let $path-count := count($path-nodes)
    2425   
     
    2829  let $text-count-distinct := count(distinct-values($text-nodes))
    2930  return
    30         <elem path="{$path}" count="{$path-count}" count_text="{$text-count}"  count_distinct_text="{$text-count-distinct}" >
     31        <elem path="{fn:concat("//", $path)}" count="{$path-count}" count_text="{$text-count}"  count_distinct_text="{$text-count-distinct}" >
    3132        { if ($depth > 0) then
    3233            for $elname in $subs[. != '']
     
    8283      cmd-model:create-doc($collection, $type-name, $depth)
    8384    return
    84       fn:doc(fn:concat($collection, "/", $type-name, xs:string($depth), $cmd-model:xmlExt))
     85      fn:doc(fn:concat($collection, "/", $new-name, xs:string($depth), $cmd-model:xmlExt))
    8586};
    8687
     
    163164  if ($type-name eq $cmd-model:typeActorPath) then
    164165    fn:concat($cmd-model:typeActorPathElementPrefix, $cmd-model:docTypeSuffix)
     166  else if ($type-name eq $cmd-model:typeActorPath0) then
     167    fn:concat($cmd-model:typeActorPathElementPrefix, $cmd-model:docTypeSuffix)
    165168  else
    166169    ()
Note: See TracChangeset for help on using the changeset viewer.