From cea9c246bd6a9da093d5a15e27336b990c422a35 Mon Sep 17 00:00:00 2001 From: Philipp Rohde Date: Mon, 9 Sep 2024 09:07:48 +0200 Subject: [PATCH] [tests] add test case for shape without matching instances in the data --- tests/cases/single_shape/README.md | 3 ++- .../single_shape/case9/definitions/case9.json | 7 +++++++ .../cases/single_shape/case9/shapes/ClassX.json | 17 +++++++++++++++++ .../cases/single_shape/case9/shapes/ClassX.ttl | 10 ++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/cases/single_shape/case9/definitions/case9.json create mode 100644 tests/cases/single_shape/case9/shapes/ClassX.json create mode 100644 tests/cases/single_shape/case9/shapes/ClassX.ttl diff --git a/tests/cases/single_shape/README.md b/tests/cases/single_shape/README.md index 233f8f5..9132663 100644 --- a/tests/cases/single_shape/README.md +++ b/tests/cases/single_shape/README.md @@ -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` @@ -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 diff --git a/tests/cases/single_shape/case9/definitions/case9.json b/tests/cases/single_shape/case9/definitions/case9.json new file mode 100644 index 0000000..c1da8c1 --- /dev/null +++ b/tests/cases/single_shape/case9/definitions/case9.json @@ -0,0 +1,7 @@ +{ + "schemaDir": "./tests/cases/single_shape/case9/shapes/", + "groundTruth": { + "valid": [], + "invalid": [] + } +} diff --git a/tests/cases/single_shape/case9/shapes/ClassX.json b/tests/cases/single_shape/case9/shapes/ClassX.json new file mode 100644 index 0000000..96ef20d --- /dev/null +++ b/tests/cases/single_shape/case9/shapes/ClassX.json @@ -0,0 +1,17 @@ +{ + "name": "ClassX", + "targetDef": { + "query": "SELECT ?x WHERE { ?x a test:ClassX }", + "class": "test:ClassX" + }, + "prefix": { + "test": "" + }, + "constraintDef": { + "conjunctions": [ + [ + { "path": "test:property0", "min": 1 } + ] + ] + } +} diff --git a/tests/cases/single_shape/case9/shapes/ClassX.ttl b/tests/cases/single_shape/case9/shapes/ClassX.ttl new file mode 100644 index 0000000..c8b9c1f --- /dev/null +++ b/tests/cases/single_shape/case9/shapes/ClassX.ttl @@ -0,0 +1,10 @@ +@prefix sh: . +@prefix test: . +@prefix : . + +:ClassX a sh:NodeShape; + sh:targetClass test:ClassX ; + sh:property [ + sh:path test:property0 ; + sh:minCount 1 + ] .