summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-06-02 15:12:29 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-06-02 15:12:29 +0200
commit3623ca271ca73fc4daa0405f39ae5da9977b15e4 (patch)
tree197b79adcd68e46ca4a94b46511628f010402bcf
parente9ac598af467d2537c28c38838b0930ac92fd349 (diff)
getCollByName and getOutcomeFromEvent xquery functions
-rw-r--r--src/main/resources/cristal-function-lib.xql17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/resources/cristal-function-lib.xql b/src/main/resources/cristal-function-lib.xql
index 273727f..3c6b6b3 100644
--- a/src/main/resources/cristal-function-lib.xql
+++ b/src/main/resources/cristal-function-lib.xql
@@ -13,4 +13,21 @@ declare function cristal:getCollByType($typeName as xs:string) as xs:string*
let $prodType := collection($itemColl)/Property[@name="Type"]
where $prop eq $typeName and $prodType eq "Product"
return $itemColl
+};
+
+declare function cristal:getCollByName($name 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
+};
+
+declare function cristal:getOutcomeFromEvent($coll as xs:string, $event as node()) as xs:string
+{
+ let $schemaName := $event/@SchemaName
+ let $schemaVersion := $event/@SchemaVersion
+ let $eventId := $event/@ID
+ return fn:string-join(($coll,'/','Outcome.',$schemaName,'.',$schemaVersion,'.',$eventId),'')
}; \ No newline at end of file