source: MDService/trunk/xquery/cmd-model.xql @ 174

Last change on this file since 174 was 174, checked in by ljo, 14 years ago

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)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1012 bytes
Line 
1xquery version "1.0";
2
3(:
4 $Id: cmd-model.xql 174 2010-02-03 23:33:28Z ljo $
5:)
6import module namespace request="http://exist-db.org/xquery/request";
7
8import module namespace cmd-model = "http://spraakbanken.gu.se/clarin/xquery/model"
9at "xmldb:exist:///db/clarin/cmd-model.xqm";
10
11(: cmd-model:recurse-collections-model("/db/cmdi-mirror/olac/OLAC/The_LINGUIST_List_Language_Resources", "//MDGroup/Actors/Actor", 4) :)
12
13declare function local:cmd-model() as item()* {
14  let $action :=  request:get-parameter("operation", ""),
15    $cmd-index := request:get-parameter("q", "MDGroup/Actors/Actor"),
16    $cmd-index-path := 
17    if (fn:contains($cmd-index, ".")) then
18      fn:translate($cmd-index, ".", "/") 
19    else
20      $cmd-index,
21    $format := request:get-parameter("format", "xml"),
22    $path := fn:concat("/db/cmdi-mirror/", request:get-parameter("path", "silang_data")),
23    $max-depth as xs:integer := xs:integer(request:get-parameter("maxdepth", 1))
24
25    return
26    cmd-model:get-result-doc($path, $cmd-index-path, $max-depth)
27};
28
29local:cmd-model()
Note: See TracBrowser for help on using the repository browser.