diff --git a/sparqlGraphLibrary/src/test/java/com/ge/research/semtk/validate/test/ShaclRunnerTest_IT.java b/sparqlGraphLibrary/src/test/java/com/ge/research/semtk/validate/test/ShaclRunnerTest_IT.java index b6d73045d..06bc61a08 100644 --- a/sparqlGraphLibrary/src/test/java/com/ge/research/semtk/validate/test/ShaclRunnerTest_IT.java +++ b/sparqlGraphLibrary/src/test/java/com/ge/research/semtk/validate/test/ShaclRunnerTest_IT.java @@ -51,7 +51,6 @@ public void testResults() throws Exception{ // test at Info level resultsJson = runner.getResults(Severity.Info); expectedJson = Utility.getResourceAsJson(this, EXPECTED_RESULTS_FILE); - System.out.println(resultsJson); // TODO REMOVE assertEquals(((JSONArray)resultsJson.get(ShaclRunner.JSON_KEY_ENTRIES)).size(), ((JSONArray)expectedJson.get(ShaclRunner.JSON_KEY_ENTRIES)).size()); assertTrue(Utility.equals(resultsJson, expectedJson)); diff --git a/sparqlGraphLibrary/src/test/resources/DeliveryBasketExample-shacl-results.json b/sparqlGraphLibrary/src/test/resources/DeliveryBasketExample-shacl-results.json index a8858b169..6788fc4ac 100644 --- a/sparqlGraphLibrary/src/test/resources/DeliveryBasketExample-shacl-results.json +++ b/sparqlGraphLibrary/src/test/resources/DeliveryBasketExample-shacl-results.json @@ -72,174 +72,6 @@ "value": "", "messageTransformed": "Expect count <= 3 (got 4)" }, - { - "severity": "Warning", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#basket4", - "sourceShape": "http:\/\/DeliveryBasketExample#FruitBasketIncludesAtLeastTwoPeaches", - "targetType": "targetNode", - "constraint": "org.apache.jena.shacl.engine.constraint.ReportConstraint@XXXXXXXX", - "focusNode": "http:\/\/DeliveryBasketExample#basket4", - "message": "Must include at least 2 peaches", - "value": "", - "messageTransformed": "" - }, - { - "severity": "Violation", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#Address", - "sourceShape": "http:\/\/DeliveryBasketExample#AddressZipCodeConforms", - "targetType": "targetClass", - "constraint": "InConstraint[\"53217\"^^http:\/\/www.w3.org\/2001\/XMLSchema#integer, \"53217\"^^http:\/\/www.w3.org\/2001\/XMLSchema#int, \"53211\"^^http:\/\/www.w3.org\/2001\/XMLSchema#integer, \"53211\"^^http:\/\/www.w3.org\/2001\/XMLSchema#int]", - "focusNode": "http:\/\/DeliveryBasketExample#addressWithoutRecipient", - "message": "InConstraint[\"53217\"^^http:\/\/www.w3.org\/2001\/XMLSchema#integer, \"53217\"^^http:\/\/www.w3.org\/2001\/XMLSchema#int, \"53211\"^^http:\/\/www.w3.org\/2001\/XMLSchema#integer, \"53211\"^^http:\/\/www.w3.org\/2001\/XMLSchema#int] : RDF term \"10027\"^^xsd:int not in expected values", - "value": "\"10027\"^^http:\/\/www.w3.org\/2001\/XMLSchema#int", - "messageTransformed": "Expect \"10027\"^^xsd:int to be one of: \"53217\"^^http:\/\/www.w3.org\/2001\/XMLSchema#integer, \"53217\"^^http:\/\/www.w3.org\/2001\/XMLSchema#int, \"53211\"^^http:\/\/www.w3.org\/2001\/XMLSchema#integer, \"53211\"^^http:\/\/www.w3.org\/2001\/XMLSchema#int" - }, - { - "severity": "Info", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#basket100", - "sourceShape": "http:\/\/DeliveryBasketExample#URIContainsPeach", - "targetType": "targetNode", - "constraint": "Pattern[(.+)peach(.+)]", - "focusNode": "http:\/\/DeliveryBasketExample#basket100", - "message": "Pattern[(.+)peach(.+)]: Does not match: 'http:\/\/DeliveryBasketExample#basket100'", - "value": "http:\/\/DeliveryBasketExample#basket100", - "messageTransformed": "Does not match pattern (.+)peach(.+): \"http:\/\/DeliveryBasketExample#basket100\"" - }, - { - "severity": "Warning", - "path": "|", - "targetObject": "http:\/\/DeliveryBasketExample#Address", - "sourceShape": "http:\/\/DeliveryBasketExample#AddressPersonsHaveFirstLastNameOnly", - "targetType": "targetClass", - "constraint": "Pattern[^[A-Z][a-z]* [A-Z][a-z]*$]", - "focusNode": "http:\/\/DeliveryBasketExample#address1", - "message": "Pattern[^[A-Z][a-z]* [A-Z][a-z]*$]: Does not match: 'Carey careof'", - "value": "\"Carey careof\"", - "messageTransformed": "Does not match pattern ^[A-Z][a-z]* [A-Z][a-z]*$: \"Carey careof\"" - }, - { - "severity": "Violation", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#Address", - "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", - "targetType": "targetClass", - "constraint": "Xone", - "focusNode": "http:\/\/DeliveryBasketExample#addressTwoZips", - "message": "Xone has 2 conforming shapes at focusNode ", - "value": "http:\/\/DeliveryBasketExample#addressTwoZips", - "messageTransformed": "Expect to conform to exactly one of the provided shapes (conforms to 2)" - }, - { - "severity": "Warning", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#Address", - "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", - "targetType": "targetClass", - "constraint": "Disjoint[]", - "focusNode": "http:\/\/DeliveryBasketExample#addressTwoZips", - "message": "Disjoint[]: not disjoint: \"Unknown Addressee\" is in [\"Unknown Addressee\"]", - "value": "\"Unknown Addressee\"", - "messageTransformed": "Expect to be disjoint with careOfName" - }, - { - "severity": "Warning", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#Address", - "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", - "targetType": "targetClass", - "constraint": "Equals[]", - "focusNode": "http:\/\/DeliveryBasketExample#address1", - "message": "Equals[]: not equal: value node \"Rebecca Recipient\" is not in [\"Carey careof\"]", - "value": "\"Rebecca Recipient\"", - "messageTransformed": "Expect to equal careOfName" - }, - { - "severity": "Warning", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#Address", - "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", - "targetType": "targetClass", - "constraint": "Equals[]", - "focusNode": "http:\/\/DeliveryBasketExample#address1", - "message": "Equals[]: not equal: value \"Carey careof\" is not in [\"Rebecca Recipient\"]", - "value": "\"Carey careof\"", - "messageTransformed": "Expect to equal careOfName" - }, - { - "severity": "Violation", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#Address", - "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", - "targetType": "targetClass", - "constraint": "Node[]", - "focusNode": "http:\/\/DeliveryBasketExample#addressWithoutRecipient", - "message": "Node[] at focusNode ", - "value": "http:\/\/DeliveryBasketExample#addressWithoutRecipient", - "messageTransformed": "Expect to conform to shape HasAtLeastOneRecipient" - }, - { - "severity": "Violation", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#basket100", - "sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity", - "targetType": "targetNode", - "constraint": "NodeKind[IRI]", - "focusNode": "http:\/\/DeliveryBasketExample#basket100", - "message": "NodeKind[IRI] : Expected IRI for \"10\"^^xsd:double", - "value": "\"10\"^^http:\/\/www.w3.org\/2001\/XMLSchema#double", - "messageTransformed": "Expect node kind IRI for \"10\"^^xsd:double" - }, - { - "severity": "Violation", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#basket100", - "sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity", - "targetType": "targetNode", - "constraint": "DatatypeConstraint[xsd:int]", - "focusNode": "http:\/\/DeliveryBasketExample#basket100", - "message": "DatatypeConstraint[xsd:int]: Expected xsd:int : Actual xsd:double : Node \"10\"^^xsd:double", - "value": "\"10\"^^http:\/\/www.w3.org\/2001\/XMLSchema#double", - "messageTransformed": "Expect datatype xsd:int (got \"10\"^^xsd:double, type xsd:double)" - }, - { - "severity": "Violation", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#basket100", - "sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity", - "targetType": "targetNode", - "constraint": "ClassConstraint[]", - "focusNode": "http:\/\/DeliveryBasketExample#basket100", - "message": "ClassConstraint[]: Expected class : for ", - "value": "http:\/\/DeliveryBasketExample#fruit100d", - "messageTransformed": "Expect to be an instance of " - }, - { - "severity": "Violation", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#basket100", - "sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity", - "targetType": "targetNode", - "constraint": "maxCount[2]", - "focusNode": "http:\/\/DeliveryBasketExample#basket100", - "message": "maxCount[2]: Invalid cardinality: expected max 2: Got count = 4", - "value": "", - "messageTransformed": "Expect count <= 2 (got 4)" - }, - { - "severity": "Violation", - "path": "", - "targetObject": "http:\/\/DeliveryBasketExample#Address", - "sourceShape": "http:\/\/DeliveryBasketExample#AddressIsNot53217-1234", - "targetType": "targetClass", - "constraint": "Not", - "focusNode": "http:\/\/DeliveryBasketExample#addressTwoZips", - "message": "Zip code cannot be 53217-1234", - "value": "http:\/\/DeliveryBasketExample#addressTwoZips", - "messageTransformed": "" - }, { "severity": "Violation", "path": "", @@ -324,6 +156,30 @@ "value": "\"Unknown Addressee\"", "messageTransformed": "" }, + { + "severity": "Warning", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#basket4", + "sourceShape": "http:\/\/DeliveryBasketExample#FruitBasketIncludesAtLeastTwoPeaches", + "targetType": "targetNode", + "constraint": "org.apache.jena.shacl.engine.constraint.ReportConstraint@XXXXXXXX", + "focusNode": "http:\/\/DeliveryBasketExample#basket4", + "message": "Must include at least 2 peaches", + "value": "", + "messageTransformed": "" + }, + { + "severity": "Info", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#basket100", + "sourceShape": "http:\/\/DeliveryBasketExample#URIContainsPeach", + "targetType": "targetNode", + "constraint": "Pattern[(.+)peach(.+)]", + "focusNode": "http:\/\/DeliveryBasketExample#basket100", + "message": "Pattern[(.+)peach(.+)]: Does not match: 'http:\/\/DeliveryBasketExample#basket100'", + "value": "http:\/\/DeliveryBasketExample#basket100", + "messageTransformed": "Does not match pattern (.+)peach(.+): \"http:\/\/DeliveryBasketExample#basket100\"" + }, { "severity": "Warning", "path": "", @@ -336,6 +192,78 @@ "value": "", "messageTransformed": "" }, + { + "severity": "Warning", + "path": "|", + "targetObject": "http:\/\/DeliveryBasketExample#Address", + "sourceShape": "http:\/\/DeliveryBasketExample#AddressPersonsHaveFirstLastNameOnly", + "targetType": "targetClass", + "constraint": "Pattern[^[A-Z][a-z]* [A-Z][a-z]*$]", + "focusNode": "http:\/\/DeliveryBasketExample#address1", + "message": "Pattern[^[A-Z][a-z]* [A-Z][a-z]*$]: Does not match: 'Carey careof'", + "value": "\"Carey careof\"", + "messageTransformed": "Does not match pattern ^[A-Z][a-z]* [A-Z][a-z]*$: \"Carey careof\"" + }, + { + "severity": "Violation", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#Address", + "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", + "targetType": "targetClass", + "constraint": "Xone", + "focusNode": "http:\/\/DeliveryBasketExample#addressTwoZips", + "message": "Xone has 2 conforming shapes at focusNode ", + "value": "http:\/\/DeliveryBasketExample#addressTwoZips", + "messageTransformed": "Expect to conform to exactly one of the provided shapes (conforms to 2)" + }, + { + "severity": "Warning", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#Address", + "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", + "targetType": "targetClass", + "constraint": "Disjoint[]", + "focusNode": "http:\/\/DeliveryBasketExample#addressTwoZips", + "message": "Disjoint[]: not disjoint: \"Unknown Addressee\" is in [\"Unknown Addressee\"]", + "value": "\"Unknown Addressee\"", + "messageTransformed": "Expect to be disjoint with careOfName" + }, + { + "severity": "Warning", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#Address", + "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", + "targetType": "targetClass", + "constraint": "Equals[]", + "focusNode": "http:\/\/DeliveryBasketExample#address1", + "message": "Equals[]: not equal: value node \"Rebecca Recipient\" is not in [\"Carey careof\"]", + "value": "\"Rebecca Recipient\"", + "messageTransformed": "Expect to equal careOfName" + }, + { + "severity": "Warning", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#Address", + "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", + "targetType": "targetClass", + "constraint": "Equals[]", + "focusNode": "http:\/\/DeliveryBasketExample#address1", + "message": "Equals[]: not equal: value \"Carey careof\" is not in [\"Rebecca Recipient\"]", + "value": "\"Carey careof\"", + "messageTransformed": "Expect to equal careOfName" + }, + { + "severity": "Violation", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#Address", + "sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms", + "targetType": "targetClass", + "constraint": "Node[]", + "focusNode": "http:\/\/DeliveryBasketExample#addressWithoutRecipient", + "message": "Node[] at focusNode ", + "value": "http:\/\/DeliveryBasketExample#addressWithoutRecipient", + "messageTransformed": "Expect to conform to shape HasAtLeastOneRecipient" + }, { "severity": "Violation", "path": "", @@ -395,6 +323,66 @@ "message": "MinLengthConstraint[5]: String too short: p0", "value": "\"p0\"", "messageTransformed": "Expect string length >= 5 (\"p0\")" + }, + { + "severity": "Violation", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#basket100", + "sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity", + "targetType": "targetNode", + "constraint": "NodeKind[IRI]", + "focusNode": "http:\/\/DeliveryBasketExample#basket100", + "message": "NodeKind[IRI] : Expected IRI for \"10\"^^xsd:double", + "value": "\"10\"^^http:\/\/www.w3.org\/2001\/XMLSchema#double", + "messageTransformed": "Expect node kind IRI for \"10\"^^xsd:double" + }, + { + "severity": "Violation", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#basket100", + "sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity", + "targetType": "targetNode", + "constraint": "DatatypeConstraint[xsd:int]", + "focusNode": "http:\/\/DeliveryBasketExample#basket100", + "message": "DatatypeConstraint[xsd:int]: Expected xsd:int : Actual xsd:double : Node \"10\"^^xsd:double", + "value": "\"10\"^^http:\/\/www.w3.org\/2001\/XMLSchema#double", + "messageTransformed": "Expect datatype xsd:int (got \"10\"^^xsd:double, type xsd:double)" + }, + { + "severity": "Violation", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#basket100", + "sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity", + "targetType": "targetNode", + "constraint": "ClassConstraint[]", + "focusNode": "http:\/\/DeliveryBasketExample#basket100", + "message": "ClassConstraint[]: Expected class : for ", + "value": "http:\/\/DeliveryBasketExample#fruit100d", + "messageTransformed": "Expect to be an instance of " + }, + { + "severity": "Violation", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#basket100", + "sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity", + "targetType": "targetNode", + "constraint": "maxCount[2]", + "focusNode": "http:\/\/DeliveryBasketExample#basket100", + "message": "maxCount[2]: Invalid cardinality: expected max 2: Got count = 4", + "value": "", + "messageTransformed": "Expect count <= 2 (got 4)" + }, + { + "severity": "Violation", + "path": "", + "targetObject": "http:\/\/DeliveryBasketExample#Address", + "sourceShape": "http:\/\/DeliveryBasketExample#AddressIsNot53217-1234", + "targetType": "targetClass", + "constraint": "Not", + "focusNode": "http:\/\/DeliveryBasketExample#addressTwoZips", + "message": "Zip code cannot be 53217-1234", + "value": "http:\/\/DeliveryBasketExample#addressTwoZips", + "messageTransformed": "" } ] } \ No newline at end of file diff --git a/sparqlGraphLibrary/src/test/resources/DeliveryBasketExample-shacl.ttl b/sparqlGraphLibrary/src/test/resources/DeliveryBasketExample-shacl.ttl index a69fad8a4..70c5b265d 100644 --- a/sparqlGraphLibrary/src/test/resources/DeliveryBasketExample-shacl.ttl +++ b/sparqlGraphLibrary/src/test/resources/DeliveryBasketExample-shacl.ttl @@ -307,11 +307,12 @@ dbex:SubstringNotPresentConstraintComponent . ### An Address zip code must be one of 3 in a list -dbex:AddressZipCodeConforms - a sh:NodeShape; - sh:targetClass dbex:Address; - sh:property [ - sh:path dbex:zipCode; - sh:in ( "53217"^^xsd:integer "53217"^^xsd:int "53211"^^xsd:integer "53211"^^xsd:int ); - ]; - . \ No newline at end of file +### Omitting from JUnit because value inserted as #int may be queried from Fuseki as #int or #integer +#dbex:AddressZipCodeConforms +# a sh:NodeShape; +# sh:targetClass dbex:Address; +# sh:property [ +# sh:path dbex:zipCode; +# sh:in ( "53217"^^xsd:integer "53217"^^xsd:int "53211"^^xsd:integer "53211"^^xsd:int ); +# ]; +# . \ No newline at end of file