Changeset 714 for MDRepository


Ignore:
Timestamp:
09/24/10 09:02:12 (14 years ago)
Author:
ljo
Message:

cmd-model. xqm - fixed wrong names for value cache docs.

File:
1 edited

Legend:

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

    r711 r714  
    4646  let $collection := collection($cmd-model:cmdiMirrorPath),
    4747    $path-nodes :=
    48     if ($collections[1] = $cmd-model:collectionRoot) then
     48    if ($collections[1] eq $cmd-model:collectionRoot) then
    4949      util:eval(fn:concat("$collection//", $path))
    5050    else
    51       for $coll in $collections return util:eval(fn:concat("$collection//CMD[descendant::IsPartOf = '", xdb:decode($coll) ,"']//", $path))
     51      for $coll in $collections return util:eval(fn:concat("$collection//ft:query(descendant::IsPartOf, <query><term>", xdb:decode($coll) ,"</term></query>)//", $path, "/ancestor::CMD"))
    5252
    5353  let $path-count := count($path-nodes)
     
    7070declare function cmd-model:values($nodes as node()*) as node()* {
    7171let $keys := distinct-values($nodes/text())
    72 for $key at $pos in $keys[if ($cmd-model:valuesLimit eq 0) then () else (1 to $cmd-model:valuesLimit)]
     72let $values := for $key at $pos in $keys
    7373  let $kcount := count($nodes[. eq $key])
    7474    order by lower-case($key) ascending
    7575    return <v key="{$key}" cnt="{$kcount}" />
     76return
     77  if ($cmd-model:valuesLimit eq 0) then $values
     78  else
     79  subsequence($values, 1, $cmd-model:valuesLimit)
    7680};
    7781
     
    170174:)
    171175declare function cmd-model:is-result-available($collection as xs:string, $result-ref as xs:string) as xs:boolean {
    172   fn:doc-available(fn:concat($collection, $result-ref, $cmd-model:xmlExt))
     176  fn:doc-available(fn:concat($collection, "/", $result-ref))
    173177};
    174178
     
    189193    $dummy := xdb:login($cmd-model:cmdiDatabaseURI, $clarin-writer//write-user/text(), $clarin-writer//write-user-cred/text())
    190194    return
    191         xdb:store($cmd-model:commonFreqsPath, cmd-model:make-compound-doc-name($coll-names, $type-name, xs:string($depth)), cmd-model:make-doc-element-of-type($type-name, $coll-names, $entries, xs:string($depth)))
     195        xdb:store($cmd-model:commonFreqsPath, $type-name, cmd-model:make-doc-element-of-type($type-name, $coll-names, $entries, xs:string($depth)))
    192196};
    193197
     
    295299  API function queryModel.
    296300:)
    297 declare function cmd-model:query-model($cmd-index-path as xs:string, $collection as xs:string+, $format as xs:string, $max-depth as xs:integer) as item() {
     301declare function cmd-model:query-model($cmd-index-path as xs:string, $collection as xs:string+, $format as xs:string, $max-depth as xs:integer) as item()? {
    298302        cmd-model:serialise-as(cmd-model:get-result-doc($collection, $cmd-index-path, $max-depth), $format)
    299303};
     
    325329  let $collection := collection($cmd-model:cmdiMirrorPath),
    326330    $results :=
    327     if ($collections[1] = $cmd-model:collectionRoot) then
     331    if ($collections[1] eq $cmd-model:collectionRoot) then
    328332      util:eval(fn:concat("$collection", xdb:decode($cql-query), "/ancestor::CMD"))
    329333    else
Note: See TracChangeset for help on using the changeset viewer.