From dc9a24f3f587fe837355e1f78f50a53cb679756e Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 24 Jan 2014 11:56:03 +0100 Subject: XQuery functions from EndoTOFPET-US example. Start of standard CRISTAL XQL function library --- src/main/resources/cristal-function-lib.xql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/resources/cristal-function-lib.xql 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 -- cgit v1.2.3