-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #604 from edmcouncil/additional_hygiene_test_for_o…
…bsolete_restrictions Additional hygiene test for obsolete restrictions
- Loading branch information
Showing
11 changed files
with
292 additions
and
6 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We should avoid restrictions that can be inferred from other restrictions. Here we check exact and min cardinality restrictions. | ||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf ?restriction1. | ||
?class rdfs:subClassOf ?restriction2. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction1 owl:onClass ?restrictingClass1. | ||
?restriction2 owl:onClass ?restrictingClass2. | ||
?restriction1 owl:qualifiedCardinality ?cardinality1. | ||
?restriction2 owl:minQualifiedCardinality ?cardinality2. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?cardinality1 >= ?cardinality2) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " exactly ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " min ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete min cardinality restriction <", ?restriction2String, "> because of exact cardinality restriction <", ?restriction1String, ">.") as ?error) | ||
} |
32 changes: 32 additions & 0 deletions
32
etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. Here we check remote exact and min cardinality restrictions. | ||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf+ ?restriction1. | ||
?superClass rdfs:subClassOf ?restriction1. | ||
?class rdfs:subClassOf ?restriction2. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction1 owl:onClass ?restrictingClass1. | ||
?restriction2 owl:onClass ?restrictingClass2. | ||
?restriction1 owl:qualifiedCardinality ?cardinality1. | ||
?restriction2 owl:minQualifiedCardinality ?cardinality2. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?cardinality1 >= ?cardinality2) | ||
FILTER (?cardinality1 > 0) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " exactly ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " min ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND (CONCAT("WARN: Class ", STR(?class), " may inherit obsolete min cardinality restriction <", ?restriction2String, "> because of exact cardinality restriction <", ?restriction1String, ">", " from class ", STR(?restrictingClass1)) as ?error) | ||
} |
33 changes: 33 additions & 0 deletions
33
etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We may want to avoid restrictions that can be inferred from other restrictions. Here we check exact and max cardinality restrictions. | ||
|
||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf ?restriction1. | ||
?class rdfs:subClassOf ?restriction2. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction1 owl:onClass ?restrictingClass1. | ||
?restriction2 owl:onClass ?restrictingClass2. | ||
?restriction1 owl:maxQualifiedCardinality ?cardinality1. | ||
?restriction2 owl:qualifiedCardinality ?cardinality2. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?restriction1 != ?restriction2) | ||
FILTER (?cardinality1 >= ?cardinality2) | ||
FILTER (?cardinality1 > 0) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " max ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " exactly ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete max cardinality restriction <", ?restriction1String, "> because of exact cardinality restriction <", ?restriction2String, ">.") as ?error) | ||
} |
33 changes: 33 additions & 0 deletions
33
etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. Here we check remote exact and max cardinality restrictions. | ||
|
||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf+ ?restriction2. | ||
?superClass rdfs:subClassOf ?restriction2. | ||
?class rdfs:subClassOf ?restriction1. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction1 owl:onClass ?restrictingClass1. | ||
?restriction2 owl:onClass ?restrictingClass2. | ||
?restriction1 owl:maxQualifiedCardinality ?cardinality1. | ||
?restriction2 owl:qualifiedCardinality ?cardinality2. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?cardinality1 >= ?cardinality2) | ||
FILTER (?cardinality1 > 0) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " max ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " exactly ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete max cardinality restriction <", ?restriction1String, "> because of exact cardinality restriction <", ?restriction2String, ">", " from class ", STR(?superClass)) as ?error) | ||
} |
33 changes: 33 additions & 0 deletions
33
etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We should avoid restrictions that can be inferred from other restrictions. Here we check max cardinality restrictions. | ||
|
||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf ?restriction1. | ||
?class rdfs:subClassOf ?restriction2. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction1 owl:onClass ?restrictingClass1. | ||
?restriction2 owl:onClass ?restrictingClass2. | ||
?restriction1 owl:maxQualifiedCardinality ?cardinality1. | ||
?restriction2 owl:maxQualifiedCardinality ?cardinality2. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?restriction1 != ?restriction2) | ||
FILTER (?cardinality1 >= ?cardinality2) | ||
FILTER (?cardinality2 > 0) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " max ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete max cardinality restriction <", ?restriction1String, "> because of max cardinality restriction <", ?restriction2String, ">.") as ?error) | ||
} |
34 changes: 34 additions & 0 deletions
34
etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. Here we check remote exact and max cardinality restrictions. | ||
|
||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf+ ?restriction2. | ||
?superClass rdfs:subClassOf ?restriction2. | ||
?class rdfs:subClassOf ?restriction1. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction1 owl:onClass ?restrictingClass1. | ||
?restriction2 owl:onClass ?restrictingClass2. | ||
?restriction1 owl:maxQualifiedCardinality ?cardinality1. | ||
?restriction2 owl:maxQualifiedCardinality ?cardinality2. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?restriction1 != ?restriction2) | ||
FILTER (?cardinality1 >= ?cardinality2) | ||
FILTER (?cardinality2 > 0) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " max ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete max cardinality restriction <", ?restriction1String, "> because of max cardinality restriction <", ?restriction2String, ">", " from class ", STR(?superClass)) as ?error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...sting/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We should avoid restrictions that can be inferred from other restrictions. Here we check someValues and exact cardinality restrictions. | ||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf ?restriction1. | ||
?class rdfs:subClassOf ?restriction2. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction2 owl:onClass ?restrictingClass2. | ||
?restriction2 owl:someValuesFrom ?restrictingClass2. | ||
?restriction1 owl:qualifiedCardinality ?cardinality1. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?cardinality1 > 0) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " exact ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete someValues restriction <", ?restriction2String, "> because of exact cardinality restriction <", ?restriction1String, ">.") as ?error) | ||
} |
30 changes: 30 additions & 0 deletions
30
...ygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. Here we check remote someValues and exact cardinality restrictions. | ||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf+ ?restriction1. | ||
?superClass rdfs:subClassOf ?restriction2. | ||
?class rdfs:subClassOf ?restriction2. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction2 owl:onClass ?restrictingClass2. | ||
?restriction2 owl:someValuesFrom ?restrictingClass2. | ||
?restriction1 owl:qualifiedCardinality ?cardinality1. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?cardinality1 > 0) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " exact ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete someValues restriction <", ?restriction1String, "> because of exact cardinality restriction <", ?restriction2String, ">", " from class ", STR(?superClass)) as ?error) | ||
} |
29 changes: 29 additions & 0 deletions
29
...testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
prefix owl: <http://www.w3.org/2002/07/owl#> | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix afn: <http://jena.apache.org/ARQ/function#> | ||
|
||
## | ||
# banner We should avoid restrictions that can be inferred from other restrictions. Here we check someValues and min cardinality restrictions. | ||
|
||
SELECT ?error ?class | ||
WHERE | ||
{ | ||
?class rdfs:subClassOf ?restriction1. | ||
?class rdfs:subClassOf ?restriction2. | ||
?restriction1 rdf:type owl:Restriction. | ||
?restriction2 rdf:type owl:Restriction. | ||
?restriction1 owl:onProperty ?property1. | ||
?restriction2 owl:onProperty ?property2. | ||
?restriction1 owl:onClass ?restrictingClass1. | ||
?restriction2 owl:someValuesFrom ?restrictingClass2. | ||
?restriction1 owl:minQualifiedCardinality ?cardinality1. | ||
{?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} | ||
?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. | ||
FILTER (?cardinality1 > 0) | ||
FILTER regex(str(?class), <HYGIENE_TESTS_FILTER_PARAMETER>) | ||
BIND (CONCAT(STR(afn:localname(?property1)), " min ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) | ||
BIND (CONCAT(STR(afn:localname(?property2)), " someValuesFrom ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) | ||
BIND (CONCAT("PRODERROR: Class ", STR(?class), " has obsolete someValues restriction <", ?restriction2String, "> because of min cardinality restriction <", ?restriction1String, ">.") as ?error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters