Skip to content

Commit

Permalink
Omit SHACL InConstraint test from JUnit because value inserted as #in…
Browse files Browse the repository at this point in the history
…t may be queried from Fuseki as #int or #integer
  • Loading branch information
weisenje committed Oct 9, 2023
1 parent dd6a179 commit 3d09b86
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,174 +72,6 @@
"value": "",
"messageTransformed": "Expect count <= 3 (got 4)"
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#includes>",
"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": "<http:\/\/DeliveryBasketExample#zipCode>",
"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": "<http:\/\/DeliveryBasketExample#recipientName>|<http:\/\/DeliveryBasketExample#careOfName>",
"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 <http:\/\/DeliveryBasketExample#addressTwoZips>",
"value": "http:\/\/DeliveryBasketExample#addressTwoZips",
"messageTransformed": "Expect to conform to exactly one of the provided shapes (conforms to 2)"
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#recipientName>",
"targetObject": "http:\/\/DeliveryBasketExample#Address",
"sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms",
"targetType": "targetClass",
"constraint": "Disjoint[<http:\/\/DeliveryBasketExample#careOfName>]",
"focusNode": "http:\/\/DeliveryBasketExample#addressTwoZips",
"message": "Disjoint[<http:\/\/DeliveryBasketExample#careOfName>]: not disjoint: \"Unknown Addressee\" is in [\"Unknown Addressee\"]",
"value": "\"Unknown Addressee\"",
"messageTransformed": "Expect to be disjoint with careOfName"
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#recipientName>",
"targetObject": "http:\/\/DeliveryBasketExample#Address",
"sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms",
"targetType": "targetClass",
"constraint": "Equals[<http:\/\/DeliveryBasketExample#careOfName>]",
"focusNode": "http:\/\/DeliveryBasketExample#address1",
"message": "Equals[<http:\/\/DeliveryBasketExample#careOfName>]: not equal: value node \"Rebecca Recipient\" is not in [\"Carey careof\"]",
"value": "\"Rebecca Recipient\"",
"messageTransformed": "Expect to equal careOfName"
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#recipientName>",
"targetObject": "http:\/\/DeliveryBasketExample#Address",
"sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms",
"targetType": "targetClass",
"constraint": "Equals[<http:\/\/DeliveryBasketExample#careOfName>]",
"focusNode": "http:\/\/DeliveryBasketExample#address1",
"message": "Equals[<http:\/\/DeliveryBasketExample#careOfName>]: 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[<http:\/\/DeliveryBasketExample#HasAtLeastOneRecipient>]",
"focusNode": "http:\/\/DeliveryBasketExample#addressWithoutRecipient",
"message": "Node[<http:\/\/DeliveryBasketExample#HasAtLeastOneRecipient>] at focusNode <http:\/\/DeliveryBasketExample#addressWithoutRecipient>",
"value": "http:\/\/DeliveryBasketExample#addressWithoutRecipient",
"messageTransformed": "Expect to conform to shape HasAtLeastOneRecipient"
},
{
"severity": "Violation",
"path": "<http:\/\/DeliveryBasketExample#capacity>",
"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": "<http:\/\/DeliveryBasketExample#capacity>",
"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": "<http:\/\/DeliveryBasketExample#includes>",
"targetObject": "http:\/\/DeliveryBasketExample#basket100",
"sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity",
"targetType": "targetNode",
"constraint": "ClassConstraint[<http:\/\/DeliveryBasketExample#Peach>]",
"focusNode": "http:\/\/DeliveryBasketExample#basket100",
"message": "ClassConstraint[<http:\/\/DeliveryBasketExample#Peach>]: Expected class :<http:\/\/DeliveryBasketExample#Peach> for <http:\/\/DeliveryBasketExample#fruit100d>",
"value": "http:\/\/DeliveryBasketExample#fruit100d",
"messageTransformed": "Expect <http:\/\/DeliveryBasketExample#fruit100d> to be an instance of <http:\/\/DeliveryBasketExample#Peach>"
},
{
"severity": "Violation",
"path": "<http:\/\/DeliveryBasketExample#includes>",
"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": "<http:\/\/DeliveryBasketExample#address>",
Expand Down Expand Up @@ -324,6 +156,30 @@
"value": "\"Unknown Addressee\"",
"messageTransformed": ""
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#includes>",
"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": "<http:\/\/DeliveryBasketExample#includes>",
Expand All @@ -336,6 +192,78 @@
"value": "",
"messageTransformed": ""
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#recipientName>|<http:\/\/DeliveryBasketExample#careOfName>",
"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 <http:\/\/DeliveryBasketExample#addressTwoZips>",
"value": "http:\/\/DeliveryBasketExample#addressTwoZips",
"messageTransformed": "Expect to conform to exactly one of the provided shapes (conforms to 2)"
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#recipientName>",
"targetObject": "http:\/\/DeliveryBasketExample#Address",
"sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms",
"targetType": "targetClass",
"constraint": "Disjoint[<http:\/\/DeliveryBasketExample#careOfName>]",
"focusNode": "http:\/\/DeliveryBasketExample#addressTwoZips",
"message": "Disjoint[<http:\/\/DeliveryBasketExample#careOfName>]: not disjoint: \"Unknown Addressee\" is in [\"Unknown Addressee\"]",
"value": "\"Unknown Addressee\"",
"messageTransformed": "Expect to be disjoint with careOfName"
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#recipientName>",
"targetObject": "http:\/\/DeliveryBasketExample#Address",
"sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms",
"targetType": "targetClass",
"constraint": "Equals[<http:\/\/DeliveryBasketExample#careOfName>]",
"focusNode": "http:\/\/DeliveryBasketExample#address1",
"message": "Equals[<http:\/\/DeliveryBasketExample#careOfName>]: not equal: value node \"Rebecca Recipient\" is not in [\"Carey careof\"]",
"value": "\"Rebecca Recipient\"",
"messageTransformed": "Expect to equal careOfName"
},
{
"severity": "Warning",
"path": "<http:\/\/DeliveryBasketExample#recipientName>",
"targetObject": "http:\/\/DeliveryBasketExample#Address",
"sourceShape": "http:\/\/DeliveryBasketExample#AddressConforms",
"targetType": "targetClass",
"constraint": "Equals[<http:\/\/DeliveryBasketExample#careOfName>]",
"focusNode": "http:\/\/DeliveryBasketExample#address1",
"message": "Equals[<http:\/\/DeliveryBasketExample#careOfName>]: 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[<http:\/\/DeliveryBasketExample#HasAtLeastOneRecipient>]",
"focusNode": "http:\/\/DeliveryBasketExample#addressWithoutRecipient",
"message": "Node[<http:\/\/DeliveryBasketExample#HasAtLeastOneRecipient>] at focusNode <http:\/\/DeliveryBasketExample#addressWithoutRecipient>",
"value": "http:\/\/DeliveryBasketExample#addressWithoutRecipient",
"messageTransformed": "Expect to conform to shape HasAtLeastOneRecipient"
},
{
"severity": "Violation",
"path": "<http:\/\/DeliveryBasketExample#recipientName>",
Expand Down Expand Up @@ -395,6 +323,66 @@
"message": "MinLengthConstraint[5]: String too short: p0",
"value": "\"p0\"",
"messageTransformed": "Expect string length >= 5 (\"p0\")"
},
{
"severity": "Violation",
"path": "<http:\/\/DeliveryBasketExample#capacity>",
"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": "<http:\/\/DeliveryBasketExample#capacity>",
"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": "<http:\/\/DeliveryBasketExample#includes>",
"targetObject": "http:\/\/DeliveryBasketExample#basket100",
"sourceShape": "http:\/\/DeliveryBasketExample#Basket100HasTwoPeachesAndCapacity",
"targetType": "targetNode",
"constraint": "ClassConstraint[<http:\/\/DeliveryBasketExample#Peach>]",
"focusNode": "http:\/\/DeliveryBasketExample#basket100",
"message": "ClassConstraint[<http:\/\/DeliveryBasketExample#Peach>]: Expected class :<http:\/\/DeliveryBasketExample#Peach> for <http:\/\/DeliveryBasketExample#fruit100d>",
"value": "http:\/\/DeliveryBasketExample#fruit100d",
"messageTransformed": "Expect <http:\/\/DeliveryBasketExample#fruit100d> to be an instance of <http:\/\/DeliveryBasketExample#Peach>"
},
{
"severity": "Violation",
"path": "<http:\/\/DeliveryBasketExample#includes>",
"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": ""
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
];
.
### 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 );
# ];
# .

0 comments on commit 3d09b86

Please sign in to comment.