diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql new file mode 100644 index 00000000..20993bfc --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql @@ -0,0 +1,30 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql new file mode 100644 index 00000000..38b6f86d --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -0,0 +1,32 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact.sparql new file mode 100644 index 00000000..8a2497de --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact.sparql @@ -0,0 +1,33 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql new file mode 100644 index 00000000..8a99274f --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql @@ -0,0 +1,33 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql new file mode 100644 index 00000000..1fc1fd62 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql @@ -0,0 +1,33 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql new file mode 100644 index 00000000..fdef4f77 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -0,0 +1,34 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql index 72bf82ed..b64194a4 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql @@ -5,7 +5,8 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We should avoid restrictions that can be inferred from other restrictions. Here we check min cardinality restrictions. + SELECT ?error WHERE @@ -20,12 +21,13 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction1 owl:minQualifiedCardinality ?minCardinality1. ?restriction2 owl:minQualifiedCardinality ?minCardinality2. - {?property1 rdfs:subPropertyOf+ ?property2.} UNION {?property1 rdfs:subPropertyOf* ?property2. FILTER (?property1 = ?property2)} + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} {?restrictingClass1 rdfs:subClassOf+ ?restrictingClass2.} UNION {?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restrictingClass1 = ?restrictingClass2)} FILTER (?restriction1 != ?restriction2) FILTER (?minCardinality1 >= ?minCardinality2) FILTER (?minCardinality1 != 0) + FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " min ", STR(?minCardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) BIND (CONCAT(STR(afn:localname(?property2)), " min ", STR(?minCardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) - BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete min cardinality restriction <", ?restriction2String, "> because of min cardinality restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql new file mode 100644 index 00000000..e1729db8 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql @@ -0,0 +1,29 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql new file mode 100644 index 00000000..0a6ce0d8 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -0,0 +1,30 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql new file mode 100644 index 00000000..5a782d87 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql @@ -0,0 +1,29 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# 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), ) + 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) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql index 9e66c5dc..95b2d46f 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We should avoid restrictions that can be inferred from other restrictions. Here we check someValues restrictions. SELECT ?error @@ -19,10 +19,11 @@ WHERE ?restriction2 owl:onProperty ?property2. ?restriction1 owl:someValuesFrom ?restrictingClass1. ?restriction2 owl:someValuesFrom ?restrictingClass2. - {?property1 rdfs:subPropertyOf+ ?property2.} UNION {?property1 rdfs:subPropertyOf* ?property2. FILTER (?property1 = ?property2)} + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} {?restrictingClass1 rdfs:subClassOf+ ?restrictingClass2.} UNION {?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restrictingClass1 = ?restrictingClass2)} FILTER (?restriction1 != ?restriction2) + FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete someValues restriction <", ?restriction2String, "> because of someValues restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file