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> <Status>ready</Status>
</Resource> </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 return
<RESOURCE/> <RESOURCE/>

View File

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

View File

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

View File

@ -1,11 +1,18 @@
<!-- <!--
Notice: the <Resources> node must be removed in using the resource grid factory. 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/>'] declare namespace ic = 'http://gcube-system.org/namespaces/informationsystem/registry';
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())) let $_ri_type := '<RES_TYPE ISdefault ='RunningInstance'/>'
then $profiles/Profile/GHN/@UniqueID/string() let $_ri_id := '<RES_ID/>'
else $relatedghn/Profile/GHNDescription/Name/string()
for $ri in $profiles 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 return
<RESOURCE/> <RESOURCE/>

View File

@ -2,15 +2,17 @@
PARAMETS: PARAMETS:
RES_ID the ID of the Service 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 $ServiceClass := $service/Profile/Class
let $ServiceName := $service/Profile/Name let $ServiceName := $service/Profile/Name
let $ServiceVersion := $service/Profile/Version 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 := let $relatedris :=
for $ri in $riloop for $ri in $riloop
let $ghn-id := $ri/Profile/GHN/@UniqueID/string() 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 --> <!-- and $ri//Profile/Version/string() eq $ServiceVersion -->
return return
<RESOURCE/> <RESOURCE/>