diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-01-24 11:56:03 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-01-24 11:56:03 +0100 |
| commit | dc9a24f3f587fe837355e1f78f50a53cb679756e (patch) | |
| tree | 6cca6750f7ce635f11dd33383a82de57fcb70b4e | |
| parent | bdc786935359dd18305abd03d1ed2b3ce8781b5a (diff) | |
XQuery functions from EndoTOFPET-US example. Start of standard CRISTAL
XQL function library
| -rw-r--r-- | src/main/resources/cristal-function-lib.xql | 16 |
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 |
