resource-registry/src/test/resources/json.query.example

187 lines
5.1 KiB
Plaintext

{
"type": "EService",
"consistsOf": [
{
"type": "ConsistsOf",
"propagationConstraint" : {
"add": "propagate"
},
"target": {
"type": "StateFacet",
"value": "down"
}
},
{
"type": "IsIdentifiedBy",
"target": {
"type": "SoftwareFacet",
"name": "data-transfer-service",
"group": "DataTransfer"
}
},
{
"type": "ConsistsOf",
"target": {
"type": "AccessPointFacet",
"endpoint": "http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
}
}
],
"isRelatedTo" : [
{
"type": "activates",
"source": {
"type": "HostingNode"
}
}
]
}
SELECT FROM (
TRAVERSE outV("HostingNode") FROM (
TRAVERSE inE("Activates") FROM (
TRAVERSE outV("EService") FROM (
TRAVERSE inE("ConsistsOf") FROM (
SELECT FROM (
TRAVERSE inV("AccessPointFacet") FROM (
SELECT FROM (
TRAVERSE outE("ConsistsOf") FROM (
TRAVERSE outV("EService") FROM (
TRAVERSE inE("IsIdentifiedBy") FROM (
SELECT FROM (
TRAVERSE inV("SoftwareFacet") FROM (
SELECT FROM (
TRAVERSE outE("IsIdentifiedBy") FROM (
TRAVERSE outV("EService") FROM (
SELECT FROM (
TRAVERSE inE("ConsistsOf") FROM (
SELECT FROM StateFacet WHERE value="down"
)
) WHERE propagationConstraint.add="propagate"
)
)
)
)
) WHERE name="data-transfer-service" AND group="DataTransfer"
)
)
)
)
)
) WHERE endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
)
)
)
)
)
// WHERE type="EService"
Ottimizzata rimuovendo i SELECT FROM dove non ci sono filtri da applicare sulla istanza:
SELECT FROM (
TRAVERSE outV("EService") FROM (
TRAVERSE inE("ConsistsOf") FROM (
SELECT FROM (
TRAVERSE inV("AccessPointFacet") FROM (
TRAVERSE outE("ConsistsOf") FROM (
TRAVERSE outV("EService") FROM (
TRAVERSE inE("IsIdentifiedBy") FROM (
SELECT FROM (
TRAVERSE inV("SoftwareFacet") FROM (
TRAVERSE outE("IsIdentifiedBy") FROM (
TRAVERSE outV("EService") FROM (
SELECT FROM (
TRAVERSE inE("ConsistsOf") FROM (
SELECT FROM StateFacet WHERE value="down"
)
) WHERE propagationConstraint.add="propagate"
)
)
)
) WHERE name="data-transfer-service" AND group="DataTransfer"
)
)
)
)
) WHERE endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
)
)
) WHERE type="EService"
SELECT FROM (
TRAVERSE inE("ConsistsOf").outV("EService") FROM (
SELECT FROM (
TRAVERSE inE("IsIdentifiedBy").outV("EService").outE("ConsistsOf").inV("AccessPointFacet") FROM (
SELECT FROM (
TRAVERSE outV("EService").outE("IsIdentifiedBy").inV("SoftwareFacet") FROM (
SELECT FROM (
TRAVERSE inE("ConsistsOf") FROM (
SELECT FROM StateFacet WHERE value="down"
)
) WHERE propagationConstraint.add="propagate"
)
) WHERE name="data-transfer-service" AND group="DataTransfer"
)
) WHERE endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
)
) WHERE type="EService"
// Generated from code:
SELECT FROM (
TRAVERSE outV("EService") FROM (
TRAVERSE inE("ConsistsOf") FROM (
SELECT FROM (
TRAVERSE inV("AccessPointFacet") FROM (
TRAVERSE outV("EService").outE("ConsistsOf") FROM (
TRAVERSE inE("IsIdentifiedBy") FROM (
SELECT FROM (
TRAVERSE inV("SoftwareFacet") FROM (
TRAVERSE outV("EService").outE("IsIdentifiedBy") FROM (
SELECT FROM (
TRAVERSE inE("ConsistsOf") FROM (
SELECT FROM StateFacet WHERE value="down"
)
) WHERE propagationConstraint.add="propagate"
)
)
) WHERE name="data-transfer-service" AND group="DataTransfer"
)
)
)
) WHERE endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service"
)
)
)
// This is validated by the code to get polymorphic result
// WHERE type="EService"
MATCH
{class: StateFacet, where: (value="down")} .(in("ConsistsOf"){ where: (propagationConstraint!=null) }) {class: EService}
-IsIdentifiedBy-> {class: SoftwareFacet, where: (name="data-transfer-service" AND group="DataTransfer")}
<-ConsistsOf- {class: EService, as: result}
-ConsistsOf->{class: AccessPointFacet, where: (endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service")}
RETURN result
Non funziona con propagationConstraint.add="propagate"
MATCH
{class: StateFacet, where: (value="down")} .(in("ConsistsOf"){ where: (propagationConstraint.add="propagate") }) {class: EService}
-IsIdentifiedBy-> {class: SoftwareFacet, where: (name="data-transfer-service" AND group="DataTransfer")}
<-ConsistsOf- {class: EService, as: result}
-ConsistsOf->{class: AccessPointFacet, where: (endpoint="http://pc-frosini.isti.cnr.it:8080/data-transfer-service/gcube/service")}
RETURN result