summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-01-24 11:56:03 +0100
committerAndrew Branson <andrew.branson@cern.ch>2014-01-24 11:56:03 +0100
commitdc9a24f3f587fe837355e1f78f50a53cb679756e (patch)
tree6cca6750f7ce635f11dd33383a82de57fcb70b4e
parentbdc786935359dd18305abd03d1ed2b3ce8781b5a (diff)
XQuery functions from EndoTOFPET-US example. Start of standard CRISTAL
XQL function library
-rw-r--r--src/main/resources/cristal-function-lib.xql16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/resources/cristal-function-lib.xql b/src/main/resources/cristal-function-lib.xql
new file mode 100644
index 0000000..3fd719d
--- /dev/null
+++ b/src/main/resources/cristal-function-lib.xql
@@ -0,0 +1,16 @@
+declare function local:getOutcomeFromView($coll as xs:string, $view as node()) as xs:string
+{
+ let $schemaName := $view/@SchemaName
+ let $schemaVersion := $view/@SchemaVersion
+ let $eventId := $view/@Last
+ return fn:string-join(($coll,'/','Outcome.',$schemaName,'.',$schemaVersion,'.',$eventId),'')
+};
+
+declare function local:getCollByType($typeName as xs:string) as xs:string*
+{
+ for $prop in //Property[@name="CfCName"]
+ let $itemColl := util:collection-name($prop)
+ let $prodType := collection($itemColl)/Property[@name="Type"]
+ where $prop eq $typeName and $prodType eq "Product"
+ return $itemColl
+}; \ No newline at end of file