summaryrefslogtreecommitdiff
path: root/src/main/resources/cristal-function-lib.xql
blob: c9bdad0ecd4c4cac8218d72ac292e0abb3b998cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
declare namespace cristal "http://cristal-ise.org/";

declare function cristal:getOutcomeFromView($coll as xs:string, $view as node()) as xs:string
{ 
    string-join(($coll,'/',$view,'Outcome.',$view/Viewpoint/@SchemaName,'.',$view/Viewpoint/@SchemaVersion,'.',$view/Viewpoint/@Last) ,'') 
};


declare function cristal:getOutcomeFromEvent($coll as xs:string, $event as node()) as xs:string
{ 
    return string-join(($coll,'/','Outcome.',$event/Event/@SchemaName,'.',$event/Event/@SchemaVersion,'.',$event/Event/@ID),'') 
};

declare function cristal:getLastView($coll as xs:string, $schemaName as xs:string) as xs:string
{
	string-join(($coll,'/','ViewPoint.',$schemaName,'.last'), '')
}

declare function cristal: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
};

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
};