Skip to content

Commit

Permalink
implemented API index request
Browse files Browse the repository at this point in the history
fixes #4
  • Loading branch information
bwbohl committed Sep 30, 2014
1 parent 21c635b commit cd8ac91
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions modules/index.xql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:
: ## Description & License
:
: This query is to implement the Annotator Store API index functionality
: This query is implements the Annotator Store API index functionality
:
: This program is free software: you can redistribute it and/or modify
: it under the terms of the GNU General Public License as published by
Expand All @@ -28,18 +28,11 @@ declare namespace json="http://www.json.org";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

import module namespace xqjson="http://xqilla.sourceforge.net/lib/xqjson";

import module namespace exanore="https://www.exanore.com" at "eXanore.xqm";
import module namespace exanoreParam="http://www.eXanore.com/param" at "params.xqm";

(: Switch to JSON serialization :)
(: [{ba}, {"ba2"}] :)
(:declare option output:method "json";:)
(:declare option output:media-type "application/json";:)
declare option exist:serialize "method=text media-type=text/plain";

declare variable $annots2json := element json {attribute type {'array'},for $file in fn:collection($exanoreParam:dataCollectionURI || '?=*.xml')[1] return element item { attribute type {'object'}, $file//json/*}};
(: data_depr [1]//annotation return exanore:annot2json-xml3($annot):)
let $annots := <json type="array">{for $json in xmldb:xcollection($exanoreParam:dataCollectionURI)/root() return $json}</json>

xqjson:serialize-json($annots2json)
(:$annots2json:)
return xqjson:serialize-json($annots)

0 comments on commit cd8ac91

Please sign in to comment.