From c5531d7c54a2810895dedb6132036162d104034d Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Tue, 28 Nov 2023 16:57:54 +0100 Subject: [PATCH] JSON queries has been switched to match queries --- .../json/base/entities/JsonQueryFacet.java | 34 ++++++++++---- .../json/base/entities/JsonQueryResource.java | 11 +++-- .../base/relations/JsonQueryConsistsOf.java | 34 ++++++++++++-- .../base/relations/JsonQueryIsRelatedTo.java | 35 ++++++++++++-- .../queries/JsonQueryTest.java | 10 ++-- .../resources/queries/query4.match.oquery | 12 ++--- .../resources/queries/query5.match.oquery | 9 ++-- .../resources/queries/query6.match.oquery | 2 +- .../resources/queries/query7.match.oquery | 11 ++--- .../resources/queries/query8.match.oquery | 38 +++++++-------- .../resources/queries/query9.match.oquery | 47 ++++++++----------- 11 files changed, 150 insertions(+), 93 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/entities/JsonQueryFacet.java b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/entities/JsonQueryFacet.java index 5922d37..674bb7d 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/entities/JsonQueryFacet.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/entities/JsonQueryFacet.java @@ -96,16 +96,30 @@ public class JsonQueryFacet extends JsonQueryEntity { throws SchemaException, ResourceRegistryException { StringBuffer newBuffer = new StringBuffer(); + boolean traverseBack = this.traverseBack; if(jsonNode.has(_SOURCE)) { if(!entryPoint) { throw new InvalidQueryException(_SOURCE + " property cannot be used in a facet if it is not the entry object"); } + traverseBack = true; + JsonNode consistsOfNode = jsonNode.get(_SOURCE); JsonQueryConsistsOf jsonQueryConsistsOf = new JsonQueryConsistsOf(consistsOfNode); jsonQueryConsistsOf.setTraverseBack(traverseBack); - jsonQueryConsistsOf.setDirection(Direction.OUT); + jsonQueryConsistsOf.setDirection(Direction.IN); + jsonQueryConsistsOf.setBreadcrumb(childrenBreadcrumb); newBuffer = jsonQueryConsistsOf.createMatchQuery(newBuffer); + newBuffer.append("\n\t"); + newBuffer.append(".inV('"); + newBuffer.append(type); + newBuffer.append("')"); + newBuffer.append(" { where: ($matched."); + newBuffer.append(alias); + newBuffer.append(" == $currentMatch)}"); + + traverseBack = false; + /* Need to substract 1 from size otherwise * it add WHERE at the end because _in * is not a property to be used for a WHERE compare @@ -153,15 +167,15 @@ public class JsonQueryFacet extends JsonQueryEntity { buffer.append(newBuffer); - if(traverseBack) { - buffer.append("\n\t"); - buffer.append(".outV('"); - buffer.append(type); - buffer.append("')"); - buffer.append(" { where: ($matched."); - buffer.append(alias); - buffer.append(" == $currentMatch)}"); - } +// if(traverseBack) { +// buffer.append("\n\t"); +// buffer.append(".inV('"); +// buffer.append(type); +// buffer.append("')"); +// buffer.append(" { where: ($matched."); +// buffer.append(alias); +// buffer.append(" == $currentMatch)}"); +// } return buffer; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/entities/JsonQueryResource.java b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/entities/JsonQueryResource.java index f0b1a5c..d36a7b8 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/entities/JsonQueryResource.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/entities/JsonQueryResource.java @@ -130,10 +130,14 @@ public class JsonQueryResource extends JsonQueryEntity { consistsOfSize = consistsOfArray.size(); } + int total = consistsOfSize; + ArrayNode isRelatedToArray = (ArrayNode) jsonNode.get(Resource.IS_RELATED_TO_PROPERTY); if(isRelatedToArray!=null && isRelatedToArray.size()>0) { --size; isRelatedToSize = isRelatedToArray.size(); + total += isRelatedToSize; + for(int i=0; i0) { + + if(entryPoint && i<(total-1)) { newBuffer.append("\n"); } } @@ -192,14 +196,13 @@ public class JsonQueryResource extends JsonQueryEntity { newBuffer.append(" { where: ($matched."); newBuffer.append(getAlias(true)); newBuffer.append(" == $currentMatch)}"); - if(i<(consistsOfSize-1)) { + if(entryPoint && i<(consistsOfSize-1)) { newBuffer.append("\n"); } } } } - StringBuffer buffer = new StringBuffer(); if(!entryPoint) { diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/relations/JsonQueryConsistsOf.java b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/relations/JsonQueryConsistsOf.java index 4e928c4..1e73248 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/relations/JsonQueryConsistsOf.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/relations/JsonQueryConsistsOf.java @@ -143,6 +143,8 @@ public class JsonQueryConsistsOf extends JsonQueryRelation { throws SchemaException, ResourceRegistryException { int childrenPosition = 0; + boolean traverseBack = this.traverseBack; + StringBuffer newBuffer = new StringBuffer(); if(jsonNode.has(ConsistsOf.TARGET_PROPERTY)) { --size; @@ -150,9 +152,22 @@ public class JsonQueryConsistsOf extends JsonQueryRelation { JsonQueryFacet jsonQueryFacet = new JsonQueryFacet(facetJsonNode); jsonQueryFacet.setBreadcrumb(childrenBreadcrumb); jsonQueryFacet.setPosition(childrenPosition++); - jsonQueryFacet.setTraverseBack(false); - jsonQueryFacet.setDirection(Direction.IN); + jsonQueryFacet.setTraverseBack(true); + Direction direction = Direction.IN; + jsonQueryFacet.setDirection(direction); newBuffer = jsonQueryFacet.createMatchQuery(newBuffer); + + newBuffer.append("\n\t"); + newBuffer.append("."); + newBuffer.append(direction.name().toLowerCase()); + newBuffer.append("E('"); + newBuffer.append(type); + newBuffer.append("') "); + newBuffer.append(" { where: ($matched."); + newBuffer.append(getAlias(true)); + newBuffer.append(" == $currentMatch)}"); + + traverseBack = false; } if(jsonNode.has(ConsistsOf.SOURCE_PROPERTY)) { @@ -162,8 +177,21 @@ public class JsonQueryConsistsOf extends JsonQueryRelation { jsonQueryResource.setBreadcrumb(childrenBreadcrumb); jsonQueryResource.setPosition(childrenPosition++); jsonQueryResource.setTraverseBack(true); - jsonQueryResource.setDirection(Direction.OUT); + Direction direction = Direction.OUT; + jsonQueryResource.setDirection(direction); newBuffer = jsonQueryResource.createMatchQuery(newBuffer); + + newBuffer.append("\n\t"); + newBuffer.append("."); + newBuffer.append(direction.name().toLowerCase()); + newBuffer.append("E('"); + newBuffer.append(type); + newBuffer.append("') "); + newBuffer.append(" { where: ($matched."); + newBuffer.append(getAlias(true)); + newBuffer.append(" == $currentMatch)}"); + + traverseBack = false; } StringBuffer buffer = new StringBuffer(); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/relations/JsonQueryIsRelatedTo.java b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/relations/JsonQueryIsRelatedTo.java index aea2eb3..4ac4192 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/relations/JsonQueryIsRelatedTo.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/queries/json/base/relations/JsonQueryIsRelatedTo.java @@ -214,27 +214,56 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation { int childrenPosition = 0; + boolean traverseBack = this.traverseBack; + StringBuffer newBuffer = new StringBuffer(); if(jsonNode.has(ConsistsOf.TARGET_PROPERTY)) { --size; JsonNode targetJsonNode = jsonNode.get(IsRelatedTo.TARGET_PROPERTY); JsonQueryResource jsonQueryResource = new JsonQueryResource(targetJsonNode); - jsonQueryResource.setDirection(Direction.IN); + Direction direction = Direction.IN; + jsonQueryResource.setDirection(direction); jsonQueryResource.setBreadcrumb(childrenBreadcrumb); jsonQueryResource.setPosition(childrenPosition++); jsonQueryResource.setTraverseBack(true); newBuffer = jsonQueryResource.createMatchQuery(newBuffer); + + newBuffer.append("\n\t"); + newBuffer.append("."); + newBuffer.append(direction.name().toLowerCase()); + newBuffer.append("E('"); + newBuffer.append(type); + newBuffer.append("') "); + newBuffer.append(" { where: ($matched."); + newBuffer.append(getAlias(true)); + newBuffer.append(" == $currentMatch)}"); + + traverseBack = false; + } if(jsonNode.has(ConsistsOf.SOURCE_PROPERTY)) { --size; JsonNode sourceJsonNode = jsonNode.get(IsRelatedTo.SOURCE_PROPERTY); JsonQueryResource jsonQueryResource = new JsonQueryResource(sourceJsonNode); - jsonQueryResource.setDirection(Direction.OUT); + Direction direction = Direction.OUT; + jsonQueryResource.setDirection(direction); jsonQueryResource.setBreadcrumb(childrenBreadcrumb); jsonQueryResource.setPosition(childrenPosition++); jsonQueryResource.setTraverseBack(true); newBuffer = jsonQueryResource.createMatchQuery(newBuffer); + + newBuffer.append("\n\t"); + newBuffer.append("."); + newBuffer.append(direction.name().toLowerCase()); + newBuffer.append("E('"); + newBuffer.append(type); + newBuffer.append("') "); + newBuffer.append(" { where: ($matched."); + newBuffer.append(getAlias(true)); + newBuffer.append(" == $currentMatch)}"); + + traverseBack = false; } StringBuffer buffer = new StringBuffer(); @@ -288,7 +317,7 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation { buffer.append(type); buffer.append("') "); buffer.append(" { where: ($matched."); - buffer.append(alias); + buffer.append(getAlias(true)); buffer.append(" == $currentMatch)}"); } diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/queries/JsonQueryTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/queries/JsonQueryTest.java index d7616eb..9f6b6be 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/queries/JsonQueryTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/queries/JsonQueryTest.java @@ -73,7 +73,7 @@ public class JsonQueryTest extends ContextTest { } @Test - public void testJsonQueries() throws Exception { + public void testQueries() throws Exception { ContextTest.setContextByName(DEVVRE); File queriesDirectory = getQueriesDirectory(); @@ -115,9 +115,9 @@ public class JsonQueryTest extends ContextTest { } @Test - public void testSingleCreateQuery() throws Exception { + public void testSingleQuery() throws Exception { File queriesDirectory = getQueriesDirectory(); - File jsonQueryFile = new File(queriesDirectory, "query9.json"); + File jsonQueryFile = new File(queriesDirectory, "query2.json"); ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(jsonQueryFile); logger.info("Going to test the following JSON query {}", jsonNode.toString()); @@ -225,7 +225,7 @@ public class JsonQueryTest extends ContextTest { } @Test - public void testSingleMatchQuery() throws Exception { + public void testSingleProjectionQuery() throws Exception { File queriesDirectory = getProjectionQueriesDirectory(); File jsonQueryFile = new File(queriesDirectory, "HostingNode-query.json"); ObjectMapper objectMapper = new ObjectMapper(); @@ -255,7 +255,7 @@ public class JsonQueryTest extends ContextTest { } @Test - public void testMatchQueries() throws Exception { + public void testProjectionQueries() throws Exception { File queriesDirectory = getProjectionQueriesDirectory(); FilenameFilter filenameFilter = new FilenameFilter() { diff --git a/src/test/resources/queries/query4.match.oquery b/src/test/resources/queries/query4.match.oquery index 4f947b8..39881e6 100644 --- a/src/test/resources/queries/query4.match.oquery +++ b/src/test/resources/queries/query4.match.oquery @@ -1,15 +1,11 @@ -DA FIXARE - SELECT EXPAND(ret) FROM ( MATCH {class: StateFacet, as: statefacet0, where: (($currentMatch['@class'] INSTANCEOF 'StateFacet') AND (statefacet0.value = "down"))} - DOVREBBE ESSERE consistsof00 e tutto di conseguenza - .outE('ConsistsOf') { as: consistsof0, where: ($currentMatch['@class'] INSTANCEOF 'ConsistsOf')} - .outV('EService') { as: eservice00, where: (($currentMatch['@class'] INSTANCEOF 'EService') AND (eservice00.id = "93995af0-4f95-4816-a53e-3e1bc27ef475"))} -MANCA -> .outE('ConsistsOf') { where: ($matched.consistsof0 == $currentMatch)} -MANCA -> .inV('StateFacet') { where: ($matched.statefacet0 == $currentMatch)} - + .inE('ConsistsOf') { as: consistsof00, where: ($currentMatch['@class'] INSTANCEOF 'ConsistsOf')} + .outV('EService') { as: eservice000, where: (($currentMatch['@class'] INSTANCEOF 'EService') AND (eservice000.id = "93995af0-4f95-4816-a53e-3e1bc27ef475"))} + .outE('ConsistsOf') { where: ($matched.consistsof00 == $currentMatch)} + .inV('StateFacet') { where: ($matched.statefacet0 == $currentMatch)} RETURN DISTINCT(statefacet0) as ret ) \ No newline at end of file diff --git a/src/test/resources/queries/query5.match.oquery b/src/test/resources/queries/query5.match.oquery index 05adbf5..a6a6d3e 100644 --- a/src/test/resources/queries/query5.match.oquery +++ b/src/test/resources/queries/query5.match.oquery @@ -2,11 +2,10 @@ SELECT EXPAND(ret) FROM ( MATCH {class: StateFacet, as: statefacet0, where: (($currentMatch['@class'] INSTANCEOF 'StateFacet') AND (statefacet0.value = "down"))} - DOVREBBE ESSERE consistsof00 - .outE('ConsistsOf') { as: consistsof0, where: ($currentMatch['@class'] INSTANCEOF 'ConsistsOf')} - .outV('EService') { as: eservice00, where: (($currentMatch['@class'] INSTANCEOF 'EService') AND (((eservice00.id = "93995af0-4f95-4816-a53e-3e1bc27ef475" AND eservice00.metadata.createdBy <> "luca.frosini") OR (eservice00.id = "bd4402a0-2b72-41c5-a970-321343649e7d" AND eservice00.metadata.createdBy = "DataTransfer:data-transfer-service:smartexecutor1.dev.int.d4science.net_80"))))} -MANCA -> .outE('ConsistsOf') { where: ($matched.consistsof0 == $currentMatch)} -MANCA -> .inV('StateFacet') { where: ($matched.statefacet0 == $currentMatch)} + .inE('ConsistsOf') { as: consistsof00, where: ($currentMatch['@class'] INSTANCEOF 'ConsistsOf')} + .outV('EService') { as: eservice000, where: (($currentMatch['@class'] INSTANCEOF 'EService') AND (((eservice000.id = "93995af0-4f95-4816-a53e-3e1bc27ef475" AND eservice000.metadata.createdBy <> "luca.frosini") OR (eservice000.id = "bd4402a0-2b72-41c5-a970-321343649e7d" AND eservice000.metadata.createdBy = "DataTransfer:data-transfer-service:smartexecutor1.dev.int.d4science.net_80"))))} + .outE('ConsistsOf') { where: ($matched.consistsof00 == $currentMatch)} + .inV('StateFacet') { where: ($matched.statefacet0 == $currentMatch)} RETURN DISTINCT(statefacet0) as ret ) \ No newline at end of file diff --git a/src/test/resources/queries/query6.match.oquery b/src/test/resources/queries/query6.match.oquery index 7e5092e..9c6a1ab 100644 --- a/src/test/resources/queries/query6.match.oquery +++ b/src/test/resources/queries/query6.match.oquery @@ -27,5 +27,5 @@ SELECT EXPAND(ret) FROM ( .outV('EService') { where: ($matched.eservice0 == $currentMatch)} RETURN - DISTINCT(eservice0) as ret + DISTINCT(eservice0) as ret ) \ No newline at end of file diff --git a/src/test/resources/queries/query7.match.oquery b/src/test/resources/queries/query7.match.oquery index 084a83f..975e33d 100644 --- a/src/test/resources/queries/query7.match.oquery +++ b/src/test/resources/queries/query7.match.oquery @@ -1,14 +1,11 @@ -DA FIXARE - SELECT EXPAND(ret) FROM ( MATCH {class: StateFacet, as: statefacet0, where: ($currentMatch['@class'] INSTANCEOF 'StateFacet')} - DOVREBBE ESSERE consistsof00 - .outE('ConsistsOf') { as: consistsof0, where: ($currentMatch['@class'] INSTANCEOF 'ConsistsOf')} - .outV('EService') { as: eservice00, where: (($currentMatch['@class'] INSTANCEOF 'EService') AND (((eservice00.id = "93995af0-4f95-4816-a53e-3e1bc27ef475" AND eservice00.metadata.createdBy <> "luca.frosini") OR (eservice00.id = "bd4402a0-2b72-41c5-a970-321343649e7d" AND eservice00.metadata.createdBy = "DataTransfer:data-transfer-service:smartexecutor1.dev.int.d4science.net_80"))))} -MANCA -> .inE('ConsistsOf') { where: ($matched.consistsof0 == $currentMatch)} -MANCA -> .inV('StateFacet') { where: ($matched.statefacet0 == $currentMatch)} + .inE('ConsistsOf') { as: consistsof00, where: ($currentMatch['@class'] INSTANCEOF 'ConsistsOf')} + .outV('EService') { as: eservice000, where: (($currentMatch['@class'] INSTANCEOF 'EService') AND (((eservice000.id = "93995af0-4f95-4816-a53e-3e1bc27ef475" AND eservice000.metadata.createdBy <> "luca.frosini") OR (eservice000.id = "bd4402a0-2b72-41c5-a970-321343649e7d" AND eservice000.metadata.createdBy = "DataTransfer:data-transfer-service:smartexecutor1.dev.int.d4science.net_80"))))} + .outE('ConsistsOf') { where: ($matched.consistsof00 == $currentMatch)} + .inV('StateFacet') { where: ($matched.statefacet0 == $currentMatch)} RETURN DISTINCT(statefacet0) as ret ) \ No newline at end of file diff --git a/src/test/resources/queries/query8.match.oquery b/src/test/resources/queries/query8.match.oquery index 81b864b..3f2abc9 100644 --- a/src/test/resources/queries/query8.match.oquery +++ b/src/test/resources/queries/query8.match.oquery @@ -1,23 +1,21 @@ - -DA FIXARE - SELECT EXPAND(ret) FROM ( -MATCH - {class: CallsFor, as: callsfor0, where: ($currentMatch['@class'] INSTANCEOF 'CallsFor')} - - .inV('VirtualService') { as: virtualservice00, where: ($currentMatch['@class'] INSTANCEOF 'VirtualService')} - .outE('IsIdentifiedBy') { as: isidentifiedby000, where: ($currentMatch['@class'] INSTANCEOF 'IsIdentifiedBy')} - .inV('SoftwareFacet') { as: softwarefacet0000, where: (($currentMatch['@class'] INSTANCEOF 'SoftwareFacet') AND (softwarefacet0000.group = "org.gcube.data-catalogue" AND softwarefacet0000.name = "catalogue-virtual-service"))} - .inE('IsIdentifiedBy') { where: ($matched.isidentifiedby000 == $currentMatch)} - .outV('VirtualService') { where: ($matched.virtualservice00 == $currentMatch)} -MANCA -> .inE('CallsFor') { where: ($matched.callsfor0 == $currentMatch)} + MATCH + {class: CallsFor, as: callsfor0, where: ($currentMatch['@class'] INSTANCEOF 'CallsFor')} - .outV('EService') { as: eservice01, where: ($currentMatch['@class'] INSTANCEOF 'EService')} - .outE('IsIdentifiedBy') { as: isidentifiedby010, where: ($currentMatch['@class'] INSTANCEOF 'IsIdentifiedBy')} - .inV('SoftwareFacet') { as: softwarefacet0100, where: (($currentMatch['@class'] INSTANCEOF 'SoftwareFacet') AND (softwarefacet0100.group = "org.gcube.data-catalogue" AND softwarefacet0100.name = "gcat"))} - .inE('IsIdentifiedBy') { where: ($matched.isidentifiedby010 == $currentMatch)} - .outV('EService') { where: ($matched.eservice01 == $currentMatch)} -MANCA -> .outE('CallsFor') { where: ($matched.callsfor0 == $currentMatch)} -RETURN - DISTINCT(callsfor0) as ret + .inV('VirtualService') { as: virtualservice00, where: ($currentMatch['@class'] INSTANCEOF 'VirtualService')} + .outE('IsIdentifiedBy') { as: isidentifiedby000, where: ($currentMatch['@class'] INSTANCEOF 'IsIdentifiedBy')} + .inV('SoftwareFacet') { as: softwarefacet0000, where: (($currentMatch['@class'] INSTANCEOF 'SoftwareFacet') AND (softwarefacet0000.group = "org.gcube.data-catalogue" AND softwarefacet0000.name = "catalogue-virtual-service"))} + .inE('IsIdentifiedBy') { where: ($matched.isidentifiedby000 == $currentMatch)} + .outV('VirtualService') { where: ($matched.virtualservice00 == $currentMatch)} + .inE('CallsFor') { where: ($matched.callsfor0 == $currentMatch)} + + .outV('EService') { as: eservice01, where: ($currentMatch['@class'] INSTANCEOF 'EService')} + .outE('IsIdentifiedBy') { as: isidentifiedby010, where: ($currentMatch['@class'] INSTANCEOF 'IsIdentifiedBy')} + .inV('SoftwareFacet') { as: softwarefacet0100, where: (($currentMatch['@class'] INSTANCEOF 'SoftwareFacet') AND (softwarefacet0100.group = "org.gcube.data-catalogue" AND softwarefacet0100.name = "gcat"))} + .inE('IsIdentifiedBy') { where: ($matched.isidentifiedby010 == $currentMatch)} + .outV('EService') { where: ($matched.eservice01 == $currentMatch)} + .outE('CallsFor') { where: ($matched.callsfor0 == $currentMatch)} + + RETURN + DISTINCT(callsfor0) as ret ) \ No newline at end of file diff --git a/src/test/resources/queries/query9.match.oquery b/src/test/resources/queries/query9.match.oquery index dcbcc66..ce799ac 100644 --- a/src/test/resources/queries/query9.match.oquery +++ b/src/test/resources/queries/query9.match.oquery @@ -1,30 +1,23 @@ SELECT EXPAND(ret) FROM ( -MATCH - {class: SimpleFacet, as: simplefacet0, where: ($currentMatch['@class'] INSTANCEOF 'SimpleFacet')} - - DOVREBBE ESSERE consistsof00 e tutto di conseguenza - .outE('ConsistsOf') { as: consistsof0, where: ($currentMatch['@class'] INSTANCEOF 'ConsistsOf')} - .outV('Configuration') { as: configuration00, where: ($currentMatch['@class'] INSTANCEOF 'Configuration')} - .inE('IsCustomizedBy') { as: iscustomizedby000, where: ($currentMatch['@class'] INSTANCEOF 'IsCustomizedBy')} - .outV('VirtualService') { as: virtualservice0000, where: ($currentMatch['@class'] INSTANCEOF 'VirtualService')} - .outE('IsIdentifiedBy') { as: isidentifiedby00000, where: ($currentMatch['@class'] INSTANCEOF 'IsIdentifiedBy')} - .inV('SoftwareFacet') { as: softwarefacet000000, where: (($currentMatch['@class'] INSTANCEOF 'SoftwareFacet') AND (softwarefacet000000.group = "org.gcube.data-catalogue" AND softwarefacet000000.name = "catalogue-virtual-service"))} - .inE('IsIdentifiedBy') { where: ($matched.isidentifiedby00000 == $currentMatch)} - .outV('VirtualService') { where: ($matched.virtualservice0000 == $currentMatch)} - .outE('IsCustomizedBy') { where: ($matched.iscustomizedby000 == $currentMatch)} - .inV('Configuration') { where: ($matched.configuration00 == $currentMatch)} -MANCA -> .outE('ConsistsOf') { where: ($matched.consistsof0 == $currentMatch)} -MANCA -> .inV('SimpleFacet') { where: ($matched.simplefacet0 == $currentMatch)} + MATCH + {class: SimpleFacet, as: simplefacet0, where: ($currentMatch['@class'] INSTANCEOF 'SimpleFacet')} - - .outE('IsIdentifiedBy') { as: isidentifiedby001, where: ($currentMatch['@class'] INSTANCEOF 'IsIdentifiedBy')} - .inV('IdentifierFacet') { as: identifierfacet0010, where: (($currentMatch['@class'] INSTANCEOF 'IdentifierFacet') AND (identifierfacet0010.value = "gcat-configuration"))} - .inE('IsIdentifiedBy') { where: ($matched.isidentifiedby001 == $currentMatch)} - .outV('Configuration') { where: ($matched.configuration00 == $currentMatch)} -MANCA -> .outE('ConsistsOf') { where: ($matched.consistsof0 == $currentMatch)} -MANCA -> .inV('SimpleFacet') { where: ($matched.simplefacet0 == $currentMatch)} - - -RETURN - DISTINCT(simplefacet0) as ret + .inE('ConsistsOf') { as: consistsof00, where: ($currentMatch['@class'] INSTANCEOF 'ConsistsOf')} + .outV('Configuration') { as: configuration000, where: ($currentMatch['@class'] INSTANCEOF 'Configuration')} + .inE('IsCustomizedBy') { as: iscustomizedby0000, where: ($currentMatch['@class'] INSTANCEOF 'IsCustomizedBy')} + .outV('VirtualService') { as: virtualservice00000, where: ($currentMatch['@class'] INSTANCEOF 'VirtualService')} + .outE('IsIdentifiedBy') { as: isidentifiedby000000, where: ($currentMatch['@class'] INSTANCEOF 'IsIdentifiedBy')} + .inV('SoftwareFacet') { as: softwarefacet0000000, where: (($currentMatch['@class'] INSTANCEOF 'SoftwareFacet') AND (softwarefacet0000000.group = "org.gcube.data-catalogue" AND softwarefacet0000000.name = "catalogue-virtual-service"))} + .inE('IsIdentifiedBy') { where: ($matched.isidentifiedby000000 == $currentMatch)} + .outV('VirtualService') { where: ($matched.virtualservice00000 == $currentMatch)} + .outE('IsCustomizedBy') { where: ($matched.iscustomizedby0000 == $currentMatch)} + .inV('Configuration') { where: ($matched.configuration000 == $currentMatch)} + .outE('IsIdentifiedBy') { as: isidentifiedby0001, where: ($currentMatch['@class'] INSTANCEOF 'IsIdentifiedBy')} + .inV('IdentifierFacet') { as: identifierfacet00010, where: (($currentMatch['@class'] INSTANCEOF 'IdentifierFacet') AND (identifierfacet00010.value = "gcat-configuration"))} + .inE('IsIdentifiedBy') { where: ($matched.isidentifiedby0001 == $currentMatch)} + .outV('Configuration') { where: ($matched.configuration000 == $currentMatch)} + .outE('ConsistsOf') { where: ($matched.consistsof00 == $currentMatch)} + .inV('SimpleFacet') { where: ($matched.simplefacet0 == $currentMatch)} + RETURN + DISTINCT(simplefacet0) as ret ) \ No newline at end of file