updated queries from SVN Branch part 2

This commit is contained in:
Massimiliano Assante 2020-09-25 12:40:45 +02:00
parent 628ba14f41
commit 02fa846148
5 changed files with 24 additions and 13 deletions

View File

@ -12,7 +12,9 @@
<Status>ready</Status>
</Resource>
-->
for $ris in collection('/db/Profiles/RunningInstance')//Resource
where $ris//Resource/Profile/GHN/@UniqueID/string() eq '<RES_ID/>'
declare namespace ic = 'http://gcube-system.org/namespaces/informationsystem/registry';
for $ris in collection('/db/Profiles/RunningInstance')//Document/Data/ic:Profile/Resource
where $ris/Profile/GHN/@UniqueID/string() eq '<RES_ID/>'
return
<RESOURCE/>

View File

@ -2,7 +2,7 @@
{$ris/ID}
{$ris/Profile/ServiceName}
{$ris/Profile/ServiceClass}
<ServiceVersion>{$ris//Resource/@version/string()}</ServiceVersion>
<ServiceVersion>{$ris/@version/string()}</ServiceVersion>
<MainVersion>{$ris/Profile/Version/text()}</MainVersion>
<Status>{$ris/Profile/DeploymentData/Status/text()}</Status>
</Resource>

View File

@ -1,7 +1,7 @@
<Resources>
<Resource>
<Key>ID</Key>
<Value>{$ri//Resource/ID/string()}</Value>
<Value>{$ri/ID/string()}</Value>
</Resource>
<Resource>
<Key>ServiceStatus</Key>

View File

@ -1,11 +1,18 @@
<!--
Notice: the <Resources> node must be removed in using the resource grid factory.
-->
let $profiles := collection('/db/Profiles/<RES_TYPE ISdefault ='RunningInstance'/>')//Resource[ID/string() eq '<RES_ID/>']
let $relatedghn := collection('/db/Profiles/GHN')//Resource[ID/string() eq $profiles/Profile/GHN/@UniqueID/string()]
let $ghn-name := if (empty($relatedghn/Profile/GHNDescription/Name/string()))
then $profiles/Profile/GHN/@UniqueID/string()
else $relatedghn/Profile/GHNDescription/Name/string()
for $ri in $profiles
declare namespace ic = 'http://gcube-system.org/namespaces/informationsystem/registry';
let $_ri_type := '<RES_TYPE ISdefault ='RunningInstance'/>'
let $_ri_id := '<RES_ID/>'
let $ri_docname := concat('/db/Profiles/RunningInstance/',$_ri_id)
let $ri := doc($ri_docname)//Document/Data/ic:Profile/Resource
let $ghn-id := $ri/Profile/GHN/@UniqueID/string()
let $ghn_docname := concat('/db/Profiles/GHN/',$ri/Profile/GHN/@UniqueID/string())
let $relatedghn := doc($ghn_docname)//Document/Data/ic:Profile/Resource
let $_ghn-name := $relatedghn/Profile/GHNDescription/Name/string()
let $ghn-name := if (empty($_ghn-name)) then $ghn-id else $_ghn-name
return
<RESOURCE/>

View File

@ -2,15 +2,17 @@
PARAMETS:
RES_ID the ID of the Service
-->
let $service := collection('/db/Profiles/Service')//Resource//Resource[ID/text() eq '<RES_ID/>']
-->
declare namespace ic = 'http://gcube-system.org/namespaces/informationsystem/registry';
let $service := collection('/db/Profiles/Service')//Document/Data/ic:Profile/Resource[ID/text() eq '<RES_ID/>']
let $ServiceClass := $service/Profile/Class
let $ServiceName := $service/Profile/Name
let $ServiceVersion := $service/Profile/Version
let $riloop := collection('/db/Profiles/RunningInstance')//Resource[Profile/ServiceClass/string() eq $ServiceClass and Profile/ServiceName/string() eq $ServiceName]
let $riloop := collection('/db/Profiles/RunningInstance')//Document/Data/ic:Profile/Resource[Profile/ServiceClass/string() eq $ServiceClass and Profile/ServiceName/string() eq $ServiceName]
let $relatedris :=
for $ri in $riloop
let $ghn-id := $ri/Profile/GHN/@UniqueID/string()
let $ghn := collection('/db/Profiles/GHN')//Resource[ID/string() eq $ghn-id]
let $ghn := doc(concat('/db/Profiles/GHN',$ghn-id))//Document/Data/ic:Profile/Resource
<!-- and $ri//Profile/Version/string() eq $ServiceVersion -->
return
<RESOURCE/>