Skip to content

Commit

Permalink
[tests] add test case for shape without matching instances in the data
Browse files Browse the repository at this point in the history
  • Loading branch information
prohde committed Sep 9, 2024
1 parent eaaaf15 commit cea9c24
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/cases/single_shape/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test Cases with a Single Shape

The test cases with a single shape consider the instances of the class `ClassA`.
The test cases with a single shape consider the instances of the class `ClassA` except for case 9 which is testing a shape that has no matching instances in the data.

The following cases are tested:
1. One constraint with a minimal cardinality of `1`
Expand All @@ -11,3 +11,4 @@ The following cases are tested:
6. Combination of two min constraints
7. Combination of two max constraints
8. Shape without constraints
9. Shape without any matching instances in the data
7 changes: 7 additions & 0 deletions tests/cases/single_shape/case9/definitions/case9.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"schemaDir": "./tests/cases/single_shape/case9/shapes/",
"groundTruth": {
"valid": [],
"invalid": []
}
}
17 changes: 17 additions & 0 deletions tests/cases/single_shape/case9/shapes/ClassX.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "ClassX",
"targetDef": {
"query": "SELECT ?x WHERE { ?x a test:ClassX }",
"class": "test:ClassX"
},
"prefix": {
"test": "<http://test.example.com/>"
},
"constraintDef": {
"conjunctions": [
[
{ "path": "test:property0", "min": 1 }
]
]
}
}
10 changes: 10 additions & 0 deletions tests/cases/single_shape/case9/shapes/ClassX.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix test: <http://test.example.com/> .
@prefix : <http://test.example.com/shapes/> .

:ClassX a sh:NodeShape;
sh:targetClass test:ClassX ;
sh:property [
sh:path test:property0 ;
sh:minCount 1
] .

0 comments on commit cea9c24

Please sign in to comment.