From e64e3b9dc4343d0d05c9e347246183f1202dfeee Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 20 Oct 2021 12:05:34 +0200 Subject: [PATCH] Added logical and conditional operators --- .../query/json/base/JsonQueryERElement.java | 120 ++++++++++++------ .../json/base/QueryConditionalOperator.java | 7 + .../json/base/entities/JsonQueryFacet.java | 2 +- .../json/base/entities/JsonQueryResource.java | 2 +- .../base/relations/JsonQueryConsistsOf.java | 2 +- .../base/relations/JsonQueryIsRelatedTo.java | 2 +- .../resourceregistry/query/JsonQueryTest.java | 6 +- src/test/resources/queries/query1.query | 2 +- src/test/resources/queries/query2.query | 2 +- src/test/resources/queries/query3.query | 2 +- src/test/resources/queries/query4.query | 2 +- src/test/resources/queries/query5.json | 22 ++++ src/test/resources/queries/query5.query | 1 + 13 files changed, 123 insertions(+), 49 deletions(-) create mode 100644 src/test/resources/queries/query5.json create mode 100644 src/test/resources/queries/query5.query diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/JsonQueryERElement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/JsonQueryERElement.java index 374a15e..e35eb4a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/JsonQueryERElement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/JsonQueryERElement.java @@ -6,6 +6,7 @@ import java.util.Set; import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; +import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode; import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode; import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.Direction; @@ -74,88 +75,131 @@ public abstract class JsonQueryERElement { public abstract StringBuffer analize(StringBuffer stringBuffer) throws SchemaNotFoundException, InvalidQueryException, SchemaException, ResourceRegistryException; - protected StringBuffer addConstraint(JsonNode jsonNode, QueryLogicalOperator queryLogicalOperator, String fieldNamePrefix) throws InvalidQueryException { + protected StringBuffer addConstraints(JsonNode jsonNode, QueryLogicalOperator queryLogicalOperator, String fieldNamePrefix) throws InvalidQueryException { StringBuffer stringBuffer = new StringBuffer(); - ObjectNode objectNode = jsonNode.deepCopy(); - objectNode.remove(fieldNamesToRemove); - - Iterator iterator = objectNode.fieldNames(); - if(queryLogicalOperator==null) { queryLogicalOperator = QueryLogicalOperator.AND; } - boolean first = true; + JsonNode copiedJsonNode = jsonNode.deepCopy(); - while(iterator.hasNext()) { - String fieldName = iterator.next(); + if(jsonNode.isObject()) { + ObjectNode objectNode = (ObjectNode) copiedJsonNode; + objectNode.remove(fieldNamesToRemove); - if(first) { - first = false; - }else { - stringBuffer.append(queryLogicalOperator.getLogicalOperator()); + Iterator iterator = objectNode.fieldNames(); + + boolean first = true; + + while(iterator.hasNext()) { + String fieldName = iterator.next(); + if(first) { + first = false; + }else { + stringBuffer.append(queryLogicalOperator.getLogicalOperator()); + } + JsonNode node = objectNode.get(fieldName); + stringBuffer.append(evaluateNode(node, fieldName, fieldNamePrefix)); + } + } + + if(jsonNode.isArray()) { + ArrayNode arrayNode = (ArrayNode) copiedJsonNode; + Iterator iterator = arrayNode.iterator(); + boolean first = true; + while(iterator.hasNext()) { + if(first) { + first = false; + }else { + stringBuffer.append(queryLogicalOperator.getLogicalOperator()); + } + JsonNode node = iterator.next(); + stringBuffer.append(evaluateNode(node, null, fieldNamePrefix)); } - - JsonNode node = objectNode.get(fieldName); - stringBuffer.append(evaluateNode(node, fieldName, fieldNamePrefix)); } return stringBuffer; } - protected StringBuffer evaluateNode(JsonNode jsonNode, String fieldName, String fieldNamePrefix) throws InvalidQueryException { StringBuffer stringBuffer = new StringBuffer(); if(QueryLogicalOperator.getOperators().contains(fieldName)) { QueryLogicalOperator queryLogicalOperator = QueryLogicalOperator.getQueryLogicalOperator(fieldName); - stringBuffer.append(addConstraint(jsonNode, queryLogicalOperator, fieldNamePrefix)); + stringBuffer.append("("); + stringBuffer.append(addConstraints(jsonNode, queryLogicalOperator, fieldNamePrefix)); + stringBuffer.append(")"); return stringBuffer; } if(QueryConditionalOperator.getOperators().contains(fieldName)) { QueryConditionalOperator queryConditionalOperator = QueryConditionalOperator.getQueryComparisonOperator(fieldName); - } - - if(jsonNode.isArray()) { - return stringBuffer; + if(queryConditionalOperator == QueryConditionalOperator.IN) { + throw new UnsupportedOperationException(); + } + + StringBuffer key = getKey(null, fieldNamePrefix); + StringBuffer value = getValue(jsonNode); + stringBuffer.append(addCondition(queryConditionalOperator, key, value)); + return stringBuffer; } if(jsonNode.isObject()) { StringBuffer newPrefix = new StringBuffer(); - if(fieldNamePrefix!=null) { + if(fieldNamePrefix!=null && fieldNamePrefix.compareTo("")!=0) { newPrefix.append(fieldNamePrefix); - newPrefix.append("."); + if(fieldName!=null && fieldName.compareTo("")!=0) { + newPrefix.append("."); + } + } + + if(fieldName!=null && fieldName.compareTo("")!=0) { + newPrefix.append(fieldName); } - newPrefix.append(fieldName); - stringBuffer.append(addConstraint(jsonNode, null, newPrefix.toString())); + stringBuffer.append(addConstraints(jsonNode, null, newPrefix.toString())); return stringBuffer; } if(jsonNode.isTextual() || jsonNode.isNumber()) { - addNameToCompare(stringBuffer, fieldName, fieldNamePrefix); - String value = jsonNode.asText(); - addValueToMatch(stringBuffer, jsonNode, value); + StringBuffer key = getKey(fieldName, fieldNamePrefix); + StringBuffer value = getValue(jsonNode); + stringBuffer.append(addCondition(QueryConditionalOperator.EQ, key, value)); } return stringBuffer; } - protected StringBuffer addNameToCompare(StringBuffer stringBuffer, String fieldName, String fieldNamePrefix) { - if(fieldNamePrefix!=null) { - stringBuffer.append(fieldNamePrefix); - stringBuffer.append("."); - } - stringBuffer.append(fieldName); - stringBuffer.append("="); + protected StringBuffer addCondition(QueryConditionalOperator queryConditionalOperator, StringBuffer key, StringBuffer value) { + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(key); + stringBuffer.append(queryConditionalOperator.getConditionalOperator()); + stringBuffer.append(value); return stringBuffer; } - protected StringBuffer addValueToMatch(StringBuffer stringBuffer, JsonNode gotJoJsonNode, String value) { - if(gotJoJsonNode.isNumber()) { + + protected StringBuffer getKey(String fieldName, String fieldNamePrefix) { + StringBuffer stringBuffer = new StringBuffer(); + if(fieldNamePrefix!=null) { + stringBuffer.append(fieldNamePrefix); + if(fieldName!=null && fieldName.compareTo("")!=0) { + stringBuffer.append("."); + } + } + if(fieldName!=null) { + stringBuffer.append(fieldName); + } + return stringBuffer; + } + + protected StringBuffer getValue(JsonNode jsonNode) { + StringBuffer stringBuffer = new StringBuffer(); + + String value = jsonNode.asText(); + if(jsonNode.isNumber()) { stringBuffer.append(value); } else { stringBuffer.append("\""); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/QueryConditionalOperator.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/QueryConditionalOperator.java index 7a24b81..3879e33 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/QueryConditionalOperator.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/QueryConditionalOperator.java @@ -33,6 +33,13 @@ public enum QueryConditionalOperator { return operator; } + public String getConditionalOperator() { + return conditionalOperator; + } + + public String getDescription() { + return description; + } private static Set operators; private static Map operatorByKey; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/entities/JsonQueryFacet.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/entities/JsonQueryFacet.java index 3aaa552..35ec4dd 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/entities/JsonQueryFacet.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/entities/JsonQueryFacet.java @@ -57,7 +57,7 @@ public class JsonQueryFacet extends JsonQueryEntity { // Size 1 means that only '@class' property is present if(size > 1) { newBuffer.append(" WHERE "); - newBuffer.append(addConstraint(jsonNode, null, null)); + newBuffer.append(addConstraints(jsonNode, null, null)); } return newBuffer; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/entities/JsonQueryResource.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/entities/JsonQueryResource.java index b310855..7954014 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/entities/JsonQueryResource.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/entities/JsonQueryResource.java @@ -78,7 +78,7 @@ public class JsonQueryResource extends JsonQueryEntity { newBuffer.append("SELECT FROM ( "); newBuffer.append(stringBuffer); newBuffer.append(") WHERE "); - newBuffer.append(addConstraint(jsonNode, null, null)); + newBuffer.append(addConstraints(jsonNode, null, null)); stringBuffer = newBuffer; } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/relations/JsonQueryConsistsOf.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/relations/JsonQueryConsistsOf.java index 210fea2..c038113 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/relations/JsonQueryConsistsOf.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/relations/JsonQueryConsistsOf.java @@ -82,7 +82,7 @@ public class JsonQueryConsistsOf extends JsonQueryRelation { // Size 2 means that only '@class' and 'target' properties are present if(size > 2) { consistsOfBuffer.append(") WHERE "); // Close ) SELECT - consistsOfBuffer.append(addConstraint(jsonNode, null, null)); + consistsOfBuffer.append(addConstraints(jsonNode, null, null)); } if(!jsonNode.has(ConsistsOf.SOURCE_PROPERTY)) { diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/relations/JsonQueryIsRelatedTo.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/relations/JsonQueryIsRelatedTo.java index 031add0..1379eb4 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/relations/JsonQueryIsRelatedTo.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/json/base/relations/JsonQueryIsRelatedTo.java @@ -66,7 +66,7 @@ public class JsonQueryIsRelatedTo extends JsonQueryRelation { stringBuffer.append(" )"); // Close ) SELECT } stringBuffer.append(" WHERE "); - stringBuffer.append(addConstraint(jsonNode, null, null)); + stringBuffer.append(addConstraints(jsonNode, null, null)); } return stringBuffer; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/query/JsonQueryTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/query/JsonQueryTest.java index 32eeb46..c6867ee 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/query/JsonQueryTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/query/JsonQueryTest.java @@ -34,7 +34,7 @@ public class JsonQueryTest extends ContextTest { File queriesDirectory = getQueriesDirectory(); - for(int i=1; i<5; i++) { + for(int i=1; i<6; i++) { File jsonQueryFile = new File(queriesDirectory, "query" + i + ".json"); ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(jsonQueryFile); @@ -63,10 +63,10 @@ public class JsonQueryTest extends ContextTest { } } - // @Test + @Test public void testSingleCreateQuery() throws Exception { File queriesDirectory = getQueriesDirectory(); - File jsonQueryFile = new File(queriesDirectory, "query4.json"); + File jsonQueryFile = new File(queriesDirectory, "query5.json"); ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(jsonQueryFile); logger.info("Going to test the following JSON query {}", jsonNode.toString()); diff --git a/src/test/resources/queries/query1.query b/src/test/resources/queries/query1.query index 7d89dc9..4ec262d 100644 --- a/src/test/resources/queries/query1.query +++ b/src/test/resources/queries/query1.query @@ -1 +1 @@ -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 ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( SELECT FROM ( TRAVERSE outV("HostingNode") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("CPUFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates WHERE header.uuid="d3f58e52-5346-47bc-b736-9d77a0b554ce")))) WHERE vendor="GenuineIntel"))) WHERE header.uuid="5fbc1a56-d450-4f0f-85c1-9b1684581717"))))) 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 header.uuid="0255b7ec-e3da-4071-b456-9a2907ece1db" +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 ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( SELECT FROM ( TRAVERSE outV("HostingNode") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("CPUFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates WHERE header.uuid = "d3f58e52-5346-47bc-b736-9d77a0b554ce")))) WHERE vendor = "GenuineIntel"))) WHERE header.uuid = "5fbc1a56-d450-4f0f-85c1-9b1684581717"))))) 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 header.uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" \ No newline at end of file diff --git a/src/test/resources/queries/query2.query b/src/test/resources/queries/query2.query index 9f2b237..f8b77cb 100644 --- a/src/test/resources/queries/query2.query +++ b/src/test/resources/queries/query2.query @@ -1 +1 @@ -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 ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( SELECT FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates WHERE header.uuid="d3f58e52-5346-47bc-b736-9d77a0b554ce")) WHERE header.uuid="5fbc1a56-d450-4f0f-85c1-9b1684581717"))))) 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")) \ No newline at end of file +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 ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( SELECT FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates WHERE header.uuid = "d3f58e52-5346-47bc-b736-9d77a0b554ce")) WHERE header.uuid = "5fbc1a56-d450-4f0f-85c1-9b1684581717"))))) 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")) \ No newline at end of file diff --git a/src/test/resources/queries/query3.query b/src/test/resources/queries/query3.query index d861ab7..4d80ab9 100644 --- a/src/test/resources/queries/query3.query +++ b/src/test/resources/queries/query3.query @@ -1 +1 @@ -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 ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( TRAVERSE outV("HostingNode") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("CPUFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates)))) WHERE vendor="GenuineIntel"))))))) 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")) \ No newline at end of file +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 ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE inV("EService") FROM ( TRAVERSE outE("Activates") FROM ( TRAVERSE outV("HostingNode") FROM ( TRAVERSE inE("ConsistsOf") FROM ( SELECT FROM ( TRAVERSE inV("CPUFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( TRAVERSE outV("HostingNode") FROM ( SELECT FROM Activates)))) WHERE vendor = "GenuineIntel"))))))) 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")) \ No newline at end of file diff --git a/src/test/resources/queries/query4.query b/src/test/resources/queries/query4.query index ec0b449..736344d 100644 --- a/src/test/resources/queries/query4.query +++ b/src/test/resources/queries/query4.query @@ -1 +1 @@ -SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM ( SELECT FROM EService) WHERE header.uuid="0255b7ec-e3da-4071-b456-9a2907ece1db"))) WHERE value="down" \ No newline at end of file +SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM ( SELECT FROM EService) WHERE header.uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db"))) WHERE value = "down" \ No newline at end of file diff --git a/src/test/resources/queries/query5.json b/src/test/resources/queries/query5.json new file mode 100644 index 0000000..1d9e346 --- /dev/null +++ b/src/test/resources/queries/query5.json @@ -0,0 +1,22 @@ +{ + "@class": "StateFacet", + "value": "down", + "_in": { + "@class": "ConsistsOf", + "source" : { + "@class" : "EService", + "header": { + "$or": [ + {"$and": { + "uuid" : "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925", + "createdBy": {"$ne": "luca.frosini"} + }}, + {"$and": { + "uuid" : "0255b7ec-e3da-4071-b456-9a2907ece1db", + "createdBy": "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080" + }} + ] + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/queries/query5.query b/src/test/resources/queries/query5.query new file mode 100644 index 0000000..b40492c --- /dev/null +++ b/src/test/resources/queries/query5.query @@ -0,0 +1 @@ +SELECT FROM ( TRAVERSE inV("StateFacet") FROM ( TRAVERSE outE("ConsistsOf") FROM ( SELECT FROM ( SELECT FROM EService) WHERE ((header.uuid = "aec0ef31-c735-4a4c-b2f4-57dfbd2fe925" AND header.createdBy <> "luca.frosini") OR (header.uuid = "0255b7ec-e3da-4071-b456-9a2907ece1db" AND header.createdBy = "DataTransfer:data-transfer-service:pc-frosini.isti.cnr.it_8080"))))) WHERE value = "down" \ No newline at end of file