From a28f352e2fcca7361c94fb68454b51b321d3189d Mon Sep 17 00:00:00 2001 From: mereolog Date: Mon, 15 Apr 2024 17:13:31 +0200 Subject: [PATCH 01/17] three new checks for restrictions added Signed-off-by: mereolog --- ...stHygiene_obsolete_restrictions_max.sparql | 31 +++++++++++++++++++ ...bsolete_restrictions_min&exact copy.sparql | 31 +++++++++++++++++++ ...ene_obsolete_restrictions_min&exact.sparql | 31 +++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact copy.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql 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..e6b42039 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql @@ -0,0 +1,31 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# banner We should avoid restrictions that can be inferred from other 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. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality2 >= ?cardinality1) + FILTER regex(str(?resource), ) + 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact copy.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact copy.sparql new file mode 100644 index 00000000..193a3af0 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact copy.sparql @@ -0,0 +1,31 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# banner We should avoid restrictions that can be inferred from other 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. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality1 >= ?cardinality2) + FILTER regex(str(?resource), ) + 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql new file mode 100644 index 00000000..21560086 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql @@ -0,0 +1,31 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# banner We should avoid restrictions that can be inferred from other 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:maxQualifiedCardinality ?cardinality2. + ?property1 rdfs:subPropertyOf* ?property2. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality1 >= ?cardinality2) + FILTER regex(str(?resource), ) + BIND (CONCAT(STR(afn:localname(?property1)), " exactly ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) +} \ No newline at end of file From 195db5a01a86eea5df5d7e9c0ca8a521884a131d Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 16 May 2024 08:22:32 +0200 Subject: [PATCH 02/17] some cleaning up of hygiene tests for obsolete restrictions Signed-off-by: mereolog --- ...stHygiene_obsolete_restrictions_max.sparql | 2 +- ...bsolete_restrictions_min&exact copy.sparql | 31 ------------------- ...ene_obsolete_restrictions_min&exact.sparql | 2 +- 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact copy.sparql diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql index e6b42039..a50797ae 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql @@ -24,7 +24,7 @@ WHERE ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality2 >= ?cardinality1) - FILTER regex(str(?resource), ) + 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact copy.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact copy.sparql deleted file mode 100644 index 193a3af0..00000000 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact copy.sparql +++ /dev/null @@ -1,31 +0,0 @@ -prefix rdf: -prefix rdfs: -prefix owl: -prefix xsd: -prefix afn: - -## -# banner We should avoid restrictions that can be inferred from other 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. - ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. - FILTER (?restriction1 != ?restriction2) - FILTER (?cardinality1 >= ?cardinality2) - FILTER regex(str(?resource), ) - 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) -} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql index 21560086..8cb93a86 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql @@ -24,7 +24,7 @@ WHERE ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) - FILTER regex(str(?resource), ) + 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)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) From 265e268ac862f63370e49275cb343de52cafeb2e Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 16 May 2024 08:58:05 +0200 Subject: [PATCH 03/17] some more cleaning up of hygiene tests for obsolete restrictions Signed-off-by: mereolog --- ...ne_obsolete_restrictions_exact&max.sparql} | 2 +- ...ene_obsolete_restrictions_exact&min.sparql | 31 +++++++++++++++++++ ...e_restrictions_someValuesFrom&exact.sparql | 30 ++++++++++++++++++ ...ete_restrictions_someValuesFrom&min.sparql | 29 +++++++++++++++++ 4 files changed, 91 insertions(+), 1 deletion(-) rename etc/testing/hygiene_parameterized/{testHygiene_obsolete_restrictions_min&exact.sparql => testHygiene_obsolete_restrictions_exact&max.sparql} (97%) create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max.sparql similarity index 97% rename from etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql rename to etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max.sparql index 8cb93a86..c0749da0 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min&exact.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max.sparql @@ -23,7 +23,7 @@ WHERE ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) - FILTER (?cardinality1 >= ?cardinality2) + FILTER (?cardinality2 >= ?cardinality1) 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)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) 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..a011f906 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql @@ -0,0 +1,31 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# banner We should avoid restrictions that can be inferred from other 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. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + 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 restriction <", ?restriction2String, "> because of 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..5d2468ca --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.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. + +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:someValuesFrom ?restrictingClass1. + ?restriction2 owl:onClass ?restrictingClass2. + ?restriction2 owl:qualifiedCardinality ?cardinality2. + ?property1 rdfs:subPropertyOf* ?property2. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality2 > 0) + FILTER regex(str(?class), ) + BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") 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..11fd951f --- /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. + +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:someValuesFrom ?restrictingClass1. + ?restriction2 owl:onClass ?restrictingClass2. + ?restriction2 owl:minQualifiedCardinality ?cardinality2. + ?property1 rdfs:subPropertyOf* ?property2. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?cardinality2 > 0) + FILTER regex(str(?class), ) + BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) +} \ No newline at end of file From aff3faa779a51dbbb9adfaf76c009c83b6024e46 Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 16 May 2024 09:57:47 +0200 Subject: [PATCH 04/17] some more cleaning up of hygiene tests for obsolete restrictions Signed-off-by: mereolog --- .../testHygiene_obsolete_restrictions_min.sparql | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql index 72bf82ed..9f8e7e21 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql @@ -25,6 +25,7 @@ WHERE 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) From b29d810026d6f123f62619c816612a3575bdf4e0 Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 16 May 2024 10:07:39 +0200 Subject: [PATCH 05/17] hygiene tests for remotely obsolete restrictions Signed-off-by: mereolog --- ...olete_restrictions_exact&max_remote.sparql | 31 ++++++++++++++++++ ...olete_restrictions_exact&min_remote.sparql | 31 ++++++++++++++++++ ...ne_obsolete_restrictions_max_remote.sparql | 31 ++++++++++++++++++ ...ne_obsolete_restrictions_min_remote.sparql | 32 +++++++++++++++++++ ...ictions_someValuesFrom&exact_remote.sparql | 30 +++++++++++++++++ ...trictions_someValuesFrom&min_remote.sparql | 29 +++++++++++++++++ ...bsolete_restrictions_someValuesFrom.sparql | 1 + ..._restrictions_someValuesFrom_remote.sparql | 29 +++++++++++++++++ 8 files changed, 214 insertions(+) create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql create mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql new file mode 100644 index 00000000..890fb59d --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql @@ -0,0 +1,31 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# banner We should avoid restrictions that can be inferred from other 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:maxQualifiedCardinality ?cardinality2. + ?property1 rdfs:subPropertyOf* ?property2. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality2 >= ?cardinality1) + 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)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) + BIND(CONCAT("WARN: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of 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..1646eceb --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -0,0 +1,31 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# banner We should avoid restrictions that can be inferred from other 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. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + 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("WARN: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") 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..b5a943da --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -0,0 +1,31 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# banner We should avoid restrictions that can be inferred from other 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. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality2 >= ?cardinality1) + 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), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql new file mode 100644 index 00000000..83589799 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -0,0 +1,32 @@ +prefix rdf: +prefix rdfs: +prefix owl: +prefix xsd: +prefix afn: + +## +# banner We should avoid restrictions that can be inferred from other restrictions. + +SELECT ?error +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:minQualifiedCardinality ?minCardinality1. + ?restriction2 owl:minQualifiedCardinality ?minCardinality2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {?property1 rdfs:subPropertyOf* ?property2. 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("WARN: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of 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..9df953e2 --- /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 should avoid restrictions that can be inferred from other 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:someValuesFrom ?restrictingClass1. + ?restriction2 owl:onClass ?restrictingClass2. + ?restriction2 owl:qualifiedCardinality ?cardinality2. + ?property1 rdfs:subPropertyOf* ?property2. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality2 > 0) + FILTER regex(str(?class), ) + BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) +} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql new file mode 100644 index 00000000..14ec8b17 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.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. + +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:someValuesFrom ?restrictingClass1. + ?restriction2 owl:onClass ?restrictingClass2. + ?restriction2 owl:minQualifiedCardinality ?cardinality2. + ?property1 rdfs:subPropertyOf* ?property2. + ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. + FILTER (?cardinality2 > 0) + FILTER regex(str(?class), ) + BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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), " has obsolete restriction <", ?restriction2String, "> because of 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..cf8856f7 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql @@ -22,6 +22,7 @@ WHERE {?property1 rdfs:subPropertyOf+ ?property2.} UNION {?property1 rdfs:subPropertyOf* ?property2. 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) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql new file mode 100644 index 00000000..c76d38f6 --- /dev/null +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.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. + + +SELECT ?error +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:someValuesFrom ?restrictingClass1. + ?restriction2 owl:someValuesFrom ?restrictingClass2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {?property1 rdfs:subPropertyOf* ?property2. 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("WARN: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) +} \ No newline at end of file From d3d3fc4ab2fb52ca277094bd6112a47353e04d43 Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 16 May 2024 10:14:40 +0200 Subject: [PATCH 06/17] strengthening hygiene tests for remotely obsolete restrictions Signed-off-by: mereolog --- ...testHygiene_obsolete_restrictions_exact&max_remote.sparql | 3 ++- ...testHygiene_obsolete_restrictions_exact&min_remote.sparql | 3 ++- .../testHygiene_obsolete_restrictions_max_remote.sparql | 3 ++- .../testHygiene_obsolete_restrictions_min_remote.sparql | 5 +++-- ..._obsolete_restrictions_someValuesFrom&exact_remote.sparql | 2 +- ...ne_obsolete_restrictions_someValuesFrom&min_remote.sparql | 2 +- ...ygiene_obsolete_restrictions_someValuesFrom_remote.sparql | 2 +- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql index 890fb59d..e6529dce 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql @@ -24,8 +24,9 @@ WHERE ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality2 >= ?cardinality1) + FILTER (?cardinality2 > 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)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) - BIND(CONCAT("WARN: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of 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 index 1646eceb..5e7bd75f 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -24,8 +24,9 @@ WHERE ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) + FILTER (?cardinality2 > 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), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") 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 index b5a943da..6f30ee37 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -24,8 +24,9 @@ WHERE ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality2 >= ?cardinality1) + 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), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql index 83589799..4cb271ba 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -24,9 +24,10 @@ WHERE {?restrictingClass1 rdfs:subClassOf+ ?restrictingClass2.} UNION {?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restrictingClass1 = ?restrictingClass2)} FILTER (?restriction1 != ?restriction2) FILTER (?minCardinality1 >= ?minCardinality2) - FILTER (?minCardinality1 != 0) + FILTER (?minCardinality1 > 0) + FILTER (?minCardinality2 > 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("WARN: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of 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 index 9df953e2..c1a68add 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -26,5 +26,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 14ec8b17..4c3bdb97 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -25,5 +25,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql index c76d38f6..7cc0b907 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql @@ -25,5 +25,5 @@ WHERE 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("WARN: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file From a0c32269acd277c5fca6a1dc1e261be9b21bea52 Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 16 May 2024 10:34:28 +0200 Subject: [PATCH 07/17] cleaning up hygiene tests for remotely obsolete restrictions Signed-off-by: mereolog --- .../testHygiene_obsolete_restrictions_exact&max_remote.sparql | 4 ++-- .../testHygiene_obsolete_restrictions_exact&min_remote.sparql | 4 ++-- .../testHygiene_obsolete_restrictions_max_remote.sparql | 4 ++-- .../testHygiene_obsolete_restrictions_min_remote.sparql | 4 ++-- ...e_obsolete_restrictions_someValuesFrom&exact_remote.sparql | 4 ++-- ...ene_obsolete_restrictions_someValuesFrom&min_remote.sparql | 4 ++-- ...Hygiene_obsolete_restrictions_someValuesFrom_remote.sparql | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql index e6529dce..3227755f 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. SELECT ?error ?class WHERE @@ -28,5 +28,5 @@ WHERE 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)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) - BIND(CONCAT("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of 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 index 5e7bd75f..4245a3da 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. SELECT ?error ?class WHERE @@ -28,5 +28,5 @@ WHERE 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 have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") 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 index 6f30ee37..bc084f2c 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. SELECT ?error ?class WHERE @@ -28,5 +28,5 @@ WHERE 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 have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql index 4cb271ba..79892e77 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. SELECT ?error WHERE @@ -29,5 +29,5 @@ WHERE 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("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of 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 index c1a68add..01f16496 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. SELECT ?error ?class WHERE @@ -26,5 +26,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 4c3bdb97..46a69998 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. SELECT ?error ?class WHERE @@ -25,5 +25,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql index 7cc0b907..ebc8c252 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. SELECT ?error @@ -25,5 +25,5 @@ WHERE 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("WARN: Class ", STR(?class), " may have obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file From f508aa5c93fc363599e9e1e025d299e3c0ea4498 Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 16 May 2024 10:37:20 +0200 Subject: [PATCH 08/17] strengthening hygiene tests for remotely obsolete restrictions Signed-off-by: mereolog --- .../testHygiene_obsolete_restrictions_exact&max_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_exact&min_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_max_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_min_remote.sparql | 2 +- ...ene_obsolete_restrictions_someValuesFrom&exact_remote.sparql | 2 +- ...giene_obsolete_restrictions_someValuesFrom&min_remote.sparql | 2 +- ...stHygiene_obsolete_restrictions_someValuesFrom_remote.sparql | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql index 3227755f..7f43f1fa 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql @@ -11,7 +11,7 @@ SELECT ?error ?class WHERE { ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf+ ?restriction2. + ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. 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 index 4245a3da..3ca80e7a 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -11,7 +11,7 @@ SELECT ?error ?class WHERE { ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf+ ?restriction2. + ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql index bc084f2c..60ccfc03 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -11,7 +11,7 @@ SELECT ?error ?class WHERE { ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf+ ?restriction2. + ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql index 79892e77..ca270f5d 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -11,7 +11,7 @@ SELECT ?error WHERE { ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf+ ?restriction2. + ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. 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 index 01f16496..824f18a1 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -11,7 +11,7 @@ SELECT ?error ?class WHERE { ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf+ ?restriction2. + ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 46a69998..4ec786b5 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -11,7 +11,7 @@ SELECT ?error ?class WHERE { ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf+ ?restriction2. + ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql index ebc8c252..4ee3e5f6 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql @@ -12,7 +12,7 @@ SELECT ?error WHERE { ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf+ ?restriction2. + ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. From cd42f957a9b622995798d90af0a088102b7aafc8 Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 20 Jun 2024 11:52:15 +0200 Subject: [PATCH 09/17] fixes to hygiene test for max restrictions Signed-off-by: mereolog --- ...obsolete_restrictions_max&exact_remote.sparql} | 14 +++++++------- .../testHygiene_obsolete_restrictions_max.sparql | 5 +++-- ...ygiene_obsolete_restrictions_max@exact.sparql} | 15 ++++++++------- ...ygiene_obsolete_restrictions_max_remote.sparql | 4 ++-- 4 files changed, 20 insertions(+), 18 deletions(-) rename etc/testing/hygiene_parameterized/{testHygiene_obsolete_restrictions_exact&max_remote.sparql => testHygiene_obsolete_restrictions_max&exact_remote.sparql} (63%) rename etc/testing/hygiene_parameterized/{testHygiene_obsolete_restrictions_exact&max.sparql => testHygiene_obsolete_restrictions_max@exact.sparql} (53%) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql similarity index 63% rename from etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql rename to etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql index 7f43f1fa..3f85556e 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql @@ -18,15 +18,15 @@ WHERE ?restriction2 owl:onProperty ?property2. ?restriction1 owl:onClass ?restrictingClass1. ?restriction2 owl:onClass ?restrictingClass2. - ?restriction1 owl:qualifiedCardinality ?cardinality1. - ?restriction2 owl:maxQualifiedCardinality ?cardinality2. + ?restriction1 owl:maxQualifiedCardinality ?cardinality1. + ?restriction2 owl:qualifiedCardinality ?cardinality2. ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) - FILTER (?cardinality2 >= ?cardinality1) - FILTER (?cardinality2 > 0) + 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)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) - BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.") 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 index a50797ae..8374ffb1 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql @@ -23,9 +23,10 @@ WHERE ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) - FILTER (?cardinality2 >= ?cardinality1) + 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql similarity index 53% rename from etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max.sparql rename to etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql index c0749da0..5357b68b 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&max.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We should avoid restrictions that can be inferred from other restrictions. +# banner We may want to avoid restrictions that can be inferred from other restrictions. SELECT ?error ?class WHERE @@ -18,14 +18,15 @@ WHERE ?restriction2 owl:onProperty ?property2. ?restriction1 owl:onClass ?restrictingClass1. ?restriction2 owl:onClass ?restrictingClass2. - ?restriction1 owl:qualifiedCardinality ?cardinality1. - ?restriction2 owl:maxQualifiedCardinality ?cardinality2. + ?restriction1 owl:maxQualifiedCardinality ?cardinality1. + ?restriction2 owl:qualifiedCardinality ?cardinality2. ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) - FILTER (?cardinality2 >= ?cardinality1) + 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)), " max ", STR(?cardinality2), " ", STR(afn:localname(?restrictingClass2))) as ?restriction2String) - BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + 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 restriction <", ?restriction1String, "> because of 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 index 60ccfc03..123706ef 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -23,10 +23,10 @@ WHERE ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) - FILTER (?cardinality2 >= ?cardinality1) + 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.") as ?error) } \ No newline at end of file From a0a56fa4fe73dff3f3d52eac00a3aaebd5e8d4e8 Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 20 Jun 2024 12:13:34 +0200 Subject: [PATCH 10/17] more informative messages for hygiene tests for remote obsolete restrictions Signed-off-by: mereolog --- .../testHygiene_obsolete_restrictions_exact&min_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_max&exact_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_max_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_min_remote.sparql | 2 +- ...ene_obsolete_restrictions_someValuesFrom&exact_remote.sparql | 2 +- ...giene_obsolete_restrictions_someValuesFrom&min_remote.sparql | 2 +- ...stHygiene_obsolete_restrictions_someValuesFrom_remote.sparql | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) 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 index 3ca80e7a..33e4563f 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -28,5 +28,5 @@ WHERE 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) 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 index 3f85556e..d9938d9d 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql @@ -28,5 +28,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.", " on ", STR(restrictingClass2)) 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 index 123706ef..95961208 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -28,5 +28,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.", " on ", STR(restrictingClass2)) as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql index ca270f5d..15ad047e 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -29,5 +29,5 @@ WHERE 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("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) 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 index 824f18a1..e2f44cf9 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -26,5 +26,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 4ec786b5..484b12af 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -25,5 +25,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql index 4ee3e5f6..adbb9533 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql @@ -25,5 +25,5 @@ WHERE 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("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) as ?error) } \ No newline at end of file From e7c5911a028edfcefce976dbe454f5d2fa4a1bde Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 20 Jun 2024 12:37:12 +0200 Subject: [PATCH 11/17] more informative messages for hygiene tests for remote obsolete restrictions Signed-off-by: mereolog --- ...stHygiene_obsolete_restrictions_exact&min_remote.sparql | 3 ++- ...stHygiene_obsolete_restrictions_max&exact_remote.sparql | 7 ++++--- .../testHygiene_obsolete_restrictions_max_remote.sparql | 7 ++++--- .../testHygiene_obsolete_restrictions_min_remote.sparql | 3 ++- ...bsolete_restrictions_someValuesFrom&exact_remote.sparql | 3 ++- ..._obsolete_restrictions_someValuesFrom&min_remote.sparql | 3 ++- ...iene_obsolete_restrictions_someValuesFrom_remote.sparql | 3 ++- 7 files changed, 18 insertions(+), 11 deletions(-) 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 index 33e4563f..0392594b 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -11,6 +11,7 @@ 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. @@ -28,5 +29,5 @@ WHERE 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) as ?error) + BIND (CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?restrictingClass1)) 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 index d9938d9d..607c1c8a 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql @@ -10,8 +10,9 @@ prefix afn: SELECT ?error ?class WHERE { - ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf ?restriction2. + ?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. @@ -28,5 +29,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.", " on ", STR(restrictingClass2)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.", " on ", STR(?superClass)) 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 index 95961208..1870a04b 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -10,8 +10,9 @@ prefix afn: SELECT ?error ?class WHERE { - ?class rdfs:subClassOf+ ?restriction1. - ?class rdfs:subClassOf ?restriction2. + ?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. @@ -28,5 +29,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.", " on ", STR(restrictingClass2)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.", " on ", STR(?superClass)) as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql index 15ad047e..87c1ef47 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -11,6 +11,7 @@ SELECT ?error WHERE { ?class rdfs:subClassOf+ ?restriction1. + ?superClass rdfs:subClassOf ?restriction1. ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. @@ -29,5 +30,5 @@ WHERE 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("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?superClass)) 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 index e2f44cf9..48ba9aab 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -11,6 +11,7 @@ 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. @@ -26,5 +27,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?superClass)) as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 484b12af..5cf4e04b 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -11,6 +11,7 @@ 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. @@ -25,5 +26,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?superClass)) as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql index adbb9533..db885574 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql @@ -12,6 +12,7 @@ SELECT ?error WHERE { ?class rdfs:subClassOf+ ?restriction1. + ?superClass rdfs:subClassOf ?restriction1. ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. @@ -25,5 +26,5 @@ WHERE 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("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(restrictingClass1)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?superClass)) as ?error) } \ No newline at end of file From 6e5f3d46dd2381afbb171a8e75f1e6c95328db3c Mon Sep 17 00:00:00 2001 From: mereolog Date: Thu, 20 Jun 2024 12:46:48 +0200 Subject: [PATCH 12/17] more informative messages for hygiene tests for remote obsolete restrictions Signed-off-by: mereolog --- .../testHygiene_obsolete_restrictions_exact&min_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_max&exact_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_max_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_min_remote.sparql | 2 +- ...ene_obsolete_restrictions_someValuesFrom&exact_remote.sparql | 2 +- ...giene_obsolete_restrictions_someValuesFrom&min_remote.sparql | 2 +- ...stHygiene_obsolete_restrictions_someValuesFrom_remote.sparql | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) 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 index 0392594b..eb13e6c8 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -29,5 +29,5 @@ WHERE 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?restrictingClass1)) as ?error) + BIND (CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of 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_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql index 607c1c8a..c7fdfc69 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql @@ -29,5 +29,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.", " on ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction1String, "> because of 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_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql index 1870a04b..5dd116ac 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -29,5 +29,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.", " on ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction1String, "> because of 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_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql index 87c1ef47..793cd32d 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -30,5 +30,5 @@ WHERE 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("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) 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 index 48ba9aab..7af4b173 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -27,5 +27,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 5cf4e04b..1ae6a3bd 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -26,5 +26,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql index db885574..0bf145ae 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql @@ -26,5 +26,5 @@ WHERE 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("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.", " on ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) } \ No newline at end of file From 1184bc228f6fb125ad55a3d93378ca39c7144dc0 Mon Sep 17 00:00:00 2001 From: mereolog Date: Mon, 24 Jun 2024 10:12:37 +0200 Subject: [PATCH 13/17] post-review fix to descriptions of hygiene tests for obsolete restrictions Signed-off-by: mereolog --- .../testHygiene_obsolete_restrictions_exact&min.sparql | 4 ++-- ...testHygiene_obsolete_restrictions_exact&min_remote.sparql | 4 ++-- ...testHygiene_obsolete_restrictions_max&exact_remote.sparql | 5 +++-- .../testHygiene_obsolete_restrictions_max.sparql | 5 +++-- .../testHygiene_obsolete_restrictions_max@exact.sparql | 5 +++-- .../testHygiene_obsolete_restrictions_max_remote.sparql | 5 +++-- .../testHygiene_obsolete_restrictions_min.sparql | 5 +++-- .../testHygiene_obsolete_restrictions_min_remote.sparql | 5 +++-- ...Hygiene_obsolete_restrictions_someValuesFrom&exact.sparql | 4 ++-- ..._obsolete_restrictions_someValuesFrom&exact_remote.sparql | 4 ++-- ...stHygiene_obsolete_restrictions_someValuesFrom&min.sparql | 4 ++-- ...ne_obsolete_restrictions_someValuesFrom&min_remote.sparql | 4 ++-- .../testHygiene_obsolete_restrictions_someValuesFrom.sparql | 4 ++-- ...ygiene_obsolete_restrictions_someValuesFrom_remote.sparql | 5 +++-- 14 files changed, 35 insertions(+), 28 deletions(-) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql index a011f906..5ae95f19 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.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 exact and min cardinality restrictions. SELECT ?error ?class WHERE @@ -27,5 +27,5 @@ WHERE 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + 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 index eb13e6c8..6a0907aa 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. +# 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 @@ -29,5 +29,5 @@ WHERE 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?restrictingClass1)) as ?error) + 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_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql index c7fdfc69..16449baf 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql @@ -5,7 +5,8 @@ prefix xsd: prefix afn: ## -# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. +# 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 @@ -29,5 +30,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">", " from class ", STR(?superClass)) as ?error) + 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 index 8374ffb1..ae2e5c44 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.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 max cardinality restrictions. + SELECT ?error ?class WHERE @@ -28,5 +29,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.") as ?error) + 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@exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql index 5357b68b..3e3fef54 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql @@ -5,7 +5,8 @@ prefix xsd: prefix afn: ## -# banner We may want to avoid restrictions that can be inferred from other restrictions. +# 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 @@ -28,5 +29,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">.") as ?error) + 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_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql index 5dd116ac..0678edf2 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -5,7 +5,8 @@ prefix xsd: prefix afn: ## -# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. +# 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 @@ -29,5 +30,5 @@ WHERE 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 restriction <", ?restriction1String, "> because of restriction <", ?restriction2String, ">", " from class ", STR(?superClass)) as ?error) + 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 9f8e7e21..7cd57d65 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 @@ -28,5 +29,5 @@ WHERE 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_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql index 793cd32d..58cbfe34 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -5,7 +5,8 @@ prefix xsd: prefix afn: ## -# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. Here we check remote min cardinality restrictions. + SELECT ?error WHERE @@ -30,5 +31,5 @@ WHERE 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("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete min cardinality restriction <", ?restriction2String, "> because of min cardinality restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) 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 index 5d2468ca..4254c921 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.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 and exact cardinality restrictions. SELECT ?error ?class WHERE @@ -26,5 +26,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete exact cardinality restriction <", ?restriction2String, "> because of someValues 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 index 7af4b173..92176e6a 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. +# 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 @@ -27,5 +27,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete exact cardinality restriction <", ?restriction2String, "> because of someValues restriction <", ?restriction1String, ">", " 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 index 11fd951f..25d89f6d 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.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 and min cardinality restrictions. SELECT ?error ?class WHERE @@ -25,5 +25,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">.") as ?error) + BIND(CONCAT("PRODERROR: Class ", STR(?class), " has obsolete min cardinality restriction <", ?restriction2String, "> because of someValues restriction <", ?restriction1String, ">.") as ?error) } \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 1ae6a3bd..7e7a19b6 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -5,7 +5,7 @@ prefix xsd: prefix afn: ## -# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. Here we check remote someValues and min cardinality restrictions. SELECT ?error ?class WHERE @@ -26,5 +26,5 @@ WHERE FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete min cardinality restriction <", ?restriction2String, "> because of someValues restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) 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 cf8856f7..878d14ef 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 @@ -25,5 +25,5 @@ WHERE 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 diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql index 0bf145ae..6778514f 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql @@ -5,7 +5,8 @@ prefix xsd: prefix afn: ## -# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. +# banner We may want to avoid restrictions that can be remotely inferred from other restrictions. Here we check remote someValues restrictions. + SELECT ?error @@ -26,5 +27,5 @@ WHERE 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("WARN: Class ", STR(?class), " may inherit obsolete restriction <", ?restriction2String, "> because of restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete someValues restriction <", ?restriction2String, "> because of someValues restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) } \ No newline at end of file From ae6cbbc4a8bd02d1f5301a488293aeb26fe739b5 Mon Sep 17 00:00:00 2001 From: mereolog Date: Mon, 24 Jun 2024 15:26:32 +0200 Subject: [PATCH 14/17] fixes to some hygiene test for obsolete restrictions Signed-off-by: mereolog --- ...lete_restrictions_someValuesFrom&exact.sparql | 10 +++++----- ...strictions_someValuesFrom&exact_remote.sparql | 10 +++++----- ...solete_restrictions_someValuesFrom&min.sparql | 15 ++++++++------- ...restrictions_someValuesFrom&min_remote.sparql | 16 ++++++++-------- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql index 4254c921..7588b2e5 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql @@ -16,15 +16,15 @@ WHERE ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. ?restriction2 owl:onProperty ?property2. - ?restriction1 owl:someValuesFrom ?restrictingClass1. ?restriction2 owl:onClass ?restrictingClass2. - ?restriction2 owl:qualifiedCardinality ?cardinality2. + ?restriction2 owl:someValuesFrom ?restrictingClass2. + ?restriction1 owl:qualifiedCardinality ?cardinality1. ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) - FILTER (?cardinality2 > 0) + FILTER (?cardinality1 > 0) FILTER regex(str(?class), ) - BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) + 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 exact cardinality restriction <", ?restriction2String, "> because of someValues restriction <", ?restriction1String, ">.") as ?error) + 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 index 92176e6a..f252555a 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -17,15 +17,15 @@ WHERE ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. ?restriction2 owl:onProperty ?property2. - ?restriction1 owl:someValuesFrom ?restrictingClass1. ?restriction2 owl:onClass ?restrictingClass2. - ?restriction2 owl:qualifiedCardinality ?cardinality2. + ?restriction2 owl:someValuesFrom ?restrictingClass2. + ?restriction1 owl:qualifiedCardinality ?cardinality1. ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) - FILTER (?cardinality2 > 0) + FILTER (?cardinality1 > 0) FILTER regex(str(?class), ) - BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) + 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 exact cardinality restriction <", ?restriction2String, "> because of someValues restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) + BIND(CONCAT("WARN: Class ", STR(?class), " may inherit obsolete someValues restriction <", ?restriction2String, "> because of exact cardinality restriction <", ?restriction1String, ">", " 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 index 25d89f6d..fcd1dff3 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql @@ -16,14 +16,15 @@ WHERE ?restriction2 rdf:type owl:Restriction. ?restriction1 owl:onProperty ?property1. ?restriction2 owl:onProperty ?property2. - ?restriction1 owl:someValuesFrom ?restrictingClass1. - ?restriction2 owl:onClass ?restrictingClass2. - ?restriction2 owl:minQualifiedCardinality ?cardinality2. + ?restriction1 owl:onClass ?restrictingClass1. + ?restriction2 owl:someValuesFrom ?restrictingClass2. + ?restriction1 owl:minQualifiedCardinality ?cardinality1. ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. - FILTER (?cardinality2 > 0) + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality1 > 0) FILTER regex(str(?class), ) - BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 someValues restriction <", ?restriction1String, ">.") as ?error) + 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&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 7e7a19b6..74f7da8f 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -12,19 +12,19 @@ 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:someValuesFrom ?restrictingClass1. - ?restriction2 owl:onClass ?restrictingClass2. - ?restriction2 owl:minQualifiedCardinality ?cardinality2. + ?restriction1 owl:onClass ?restrictingClass1. + ?restriction2 owl:someValuesFrom ?restrictingClass2. + ?restriction1 owl:minQualifiedCardinality ?cardinality1. ?property1 rdfs:subPropertyOf* ?property2. ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. - FILTER (?cardinality2 > 0) + FILTER (?restriction1 != ?restriction2) + FILTER (?cardinality1 > 0) FILTER regex(str(?class), ) - BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR("1"), " ", 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 someValues restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) + 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("WARN: Class ", STR(?class), " may inherit obsolete someValues restriction <", ?restriction2String, "> because of min cardinality restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) } \ No newline at end of file From 52f105e4acafea88542affdbea0d8e7b342fac0c Mon Sep 17 00:00:00 2001 From: mereolog Date: Mon, 24 Jun 2024 15:47:16 +0200 Subject: [PATCH 15/17] fixes to some hygiene test for obsolete restrictions Signed-off-by: mereolog --- .../testHygiene_obsolete_restrictions_exact&min.sparql | 2 +- .../testHygiene_obsolete_restrictions_exact&min_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_max&exact_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_max.sparql | 2 +- .../testHygiene_obsolete_restrictions_max@exact.sparql | 2 +- .../testHygiene_obsolete_restrictions_max_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_min.sparql | 2 +- .../testHygiene_obsolete_restrictions_min_remote.sparql | 2 +- ...estHygiene_obsolete_restrictions_someValuesFrom&exact.sparql | 2 +- ...ene_obsolete_restrictions_someValuesFrom&exact_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_someValuesFrom&min.sparql | 2 +- ...giene_obsolete_restrictions_someValuesFrom&min_remote.sparql | 2 +- .../testHygiene_obsolete_restrictions_someValuesFrom.sparql | 2 +- ...stHygiene_obsolete_restrictions_someValuesFrom_remote.sparql | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql index 5ae95f19..212460fe 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql @@ -20,7 +20,7 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction1 owl:qualifiedCardinality ?cardinality1. ?restriction2 owl:minQualifiedCardinality ?cardinality2. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) 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 index 6a0907aa..cc5979ad 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -21,7 +21,7 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction1 owl:qualifiedCardinality ?cardinality1. ?restriction2 owl:minQualifiedCardinality ?cardinality2. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) 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 index 16449baf..8e275a88 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql @@ -22,7 +22,7 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction1 owl:maxQualifiedCardinality ?cardinality1. ?restriction2 owl:qualifiedCardinality ?cardinality2. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql index ae2e5c44..1fc1fd62 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max.sparql @@ -21,7 +21,7 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction1 owl:maxQualifiedCardinality ?cardinality1. ?restriction2 owl:maxQualifiedCardinality ?cardinality2. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql index 3e3fef54..8a2497de 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql @@ -21,7 +21,7 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction1 owl:maxQualifiedCardinality ?cardinality1. ?restriction2 owl:qualifiedCardinality ?cardinality2. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql index 0678edf2..fdef4f77 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max_remote.sparql @@ -22,7 +22,7 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction1 owl:maxQualifiedCardinality ?cardinality1. ?restriction2 owl:maxQualifiedCardinality ?cardinality2. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql index 7cd57d65..b64194a4 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min.sparql @@ -21,7 +21,7 @@ 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) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql index 58cbfe34..95d0762c 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql @@ -22,7 +22,7 @@ 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) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql index 7588b2e5..fb1c74e8 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql @@ -19,7 +19,7 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction2 owl:someValuesFrom ?restrictingClass2. ?restriction1 owl:qualifiedCardinality ?cardinality1. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 > 0) 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 index f252555a..713b655d 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -20,7 +20,7 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction2 owl:someValuesFrom ?restrictingClass2. ?restriction1 owl:qualifiedCardinality ?cardinality1. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 > 0) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql index fcd1dff3..9af25746 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql @@ -19,7 +19,7 @@ WHERE ?restriction1 owl:onClass ?restrictingClass1. ?restriction2 owl:someValuesFrom ?restrictingClass2. ?restriction1 owl:minQualifiedCardinality ?cardinality1. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 > 0) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index 74f7da8f..a47644b8 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -19,7 +19,7 @@ WHERE ?restriction1 owl:onClass ?restrictingClass1. ?restriction2 owl:someValuesFrom ?restrictingClass2. ?restriction1 owl:minQualifiedCardinality ?cardinality1. - ?property1 rdfs:subPropertyOf* ?property2. + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 > 0) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql index 878d14ef..95b2d46f 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom.sparql @@ -19,7 +19,7 @@ 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), ) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql index 6778514f..8d4e029b 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql @@ -21,7 +21,7 @@ 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), ) From 5fa29baf8f757bd6aaaed75c40edb069b3c7f210 Mon Sep 17 00:00:00 2001 From: mereolog Date: Mon, 24 Jun 2024 16:41:28 +0200 Subject: [PATCH 16/17] simplification of hygiene tests for obsolete restrictions Signed-off-by: mereolog --- .../testHygiene_obsolete_restrictions_exact&min.sparql | 1 - .../testHygiene_obsolete_restrictions_exact&min_remote.sparql | 1 - ...arql => testHygiene_obsolete_restrictions_max&exact.sparql} | 0 .../testHygiene_obsolete_restrictions_max&exact_remote.sparql | 1 - ...stHygiene_obsolete_restrictions_someValuesFrom&exact.sparql | 1 - ...ne_obsolete_restrictions_someValuesFrom&exact_remote.sparql | 3 +-- ...testHygiene_obsolete_restrictions_someValuesFrom&min.sparql | 1 - ...iene_obsolete_restrictions_someValuesFrom&min_remote.sparql | 1 - 8 files changed, 1 insertion(+), 8 deletions(-) rename etc/testing/hygiene_parameterized/{testHygiene_obsolete_restrictions_max@exact.sparql => testHygiene_obsolete_restrictions_max&exact.sparql} (100%) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql index 212460fe..20993bfc 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min.sparql @@ -22,7 +22,6 @@ WHERE ?restriction2 owl:minQualifiedCardinality ?cardinality2. {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. - FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 >= ?cardinality2) FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " exactly ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) 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 index cc5979ad..a334e345 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -23,7 +23,6 @@ WHERE ?restriction2 owl:minQualifiedCardinality ?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), ) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact.sparql similarity index 100% rename from etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max@exact.sparql rename to etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact.sparql 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 index 8e275a88..8a99274f 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_max&exact_remote.sparql @@ -24,7 +24,6 @@ WHERE ?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), ) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql index fb1c74e8..e1729db8 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact.sparql @@ -21,7 +21,6 @@ WHERE ?restriction1 owl:qualifiedCardinality ?cardinality1. {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. - FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 > 0) FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) 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 index 713b655d..73f146d9 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -20,9 +20,8 @@ WHERE ?restriction2 owl:onClass ?restrictingClass2. ?restriction2 owl:someValuesFrom ?restrictingClass2. ?restriction1 owl:qualifiedCardinality ?cardinality1. - {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} + {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. - FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 > 0) FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " someValuesFrom ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql index 9af25746..5a782d87 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min.sparql @@ -21,7 +21,6 @@ WHERE ?restriction1 owl:minQualifiedCardinality ?cardinality1. {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. - FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 > 0) FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " min ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql index a47644b8..43698dc2 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql @@ -21,7 +21,6 @@ WHERE ?restriction1 owl:minQualifiedCardinality ?cardinality1. {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. - FILTER (?restriction1 != ?restriction2) FILTER (?cardinality1 > 0) FILTER regex(str(?class), ) BIND (CONCAT(STR(afn:localname(?property1)), " min ", STR(?cardinality1), " ", STR(afn:localname(?restrictingClass1))) as ?restriction1String) From 7cca0edf5ebd1dde37b33fb8e4dfb3d7e97c5493 Mon Sep 17 00:00:00 2001 From: mereolog Date: Mon, 24 Jun 2024 16:59:32 +0200 Subject: [PATCH 17/17] removal of spurious hygiene tests for obsolete restrictions Signed-off-by: mereolog --- ...olete_restrictions_exact&min_remote.sparql | 2 +- ...ne_obsolete_restrictions_min_remote.sparql | 35 ------------------- ...ictions_someValuesFrom&exact_remote.sparql | 4 +-- ...trictions_someValuesFrom&min_remote.sparql | 29 --------------- ..._restrictions_someValuesFrom_remote.sparql | 31 ---------------- 5 files changed, 3 insertions(+), 98 deletions(-) delete mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql delete mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql delete mode 100644 etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql 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 index a334e345..38b6f86d 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_exact&min_remote.sparql @@ -24,7 +24,7 @@ WHERE {?property1 rdfs:subPropertyOf+ ?property2.} UNION {FILTER (?property1 = ?property2)} ?restrictingClass1 rdfs:subClassOf* ?restrictingClass2. FILTER (?cardinality1 >= ?cardinality2) - FILTER (?cardinality2 > 0) + 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) diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql deleted file mode 100644 index 95d0762c..00000000 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_min_remote.sparql +++ /dev/null @@ -1,35 +0,0 @@ -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 min cardinality restrictions. - - -SELECT ?error -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:minQualifiedCardinality ?minCardinality1. - ?restriction2 owl:minQualifiedCardinality ?minCardinality2. - {?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 (?minCardinality2 > 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("WARN: Class ", STR(?class), " may inherit obsolete min cardinality restriction <", ?restriction2String, "> because of min cardinality restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) 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 index 73f146d9..0a6ce0d8 100644 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql +++ b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&exact_remote.sparql @@ -11,7 +11,7 @@ SELECT ?error ?class WHERE { ?class rdfs:subClassOf+ ?restriction1. - ?superClass rdfs:subClassOf ?restriction1. + ?superClass rdfs:subClassOf ?restriction2. ?class rdfs:subClassOf ?restriction2. ?restriction1 rdf:type owl:Restriction. ?restriction2 rdf:type owl:Restriction. @@ -26,5 +26,5 @@ WHERE 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 <", ?restriction2String, "> because of exact cardinality restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) + 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_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql deleted file mode 100644 index 43698dc2..00000000 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom&min_remote.sparql +++ /dev/null @@ -1,29 +0,0 @@ -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 min cardinality restrictions. - -SELECT ?error ?class -WHERE -{ - ?class rdfs:subClassOf+ ?restriction1. - ?superClass 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: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("WARN: Class ", STR(?class), " may inherit obsolete someValues restriction <", ?restriction2String, "> because of min cardinality restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) -} \ No newline at end of file diff --git a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql b/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql deleted file mode 100644 index 8d4e029b..00000000 --- a/etc/testing/hygiene_parameterized/testHygiene_obsolete_restrictions_someValuesFrom_remote.sparql +++ /dev/null @@ -1,31 +0,0 @@ -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 restrictions. - - - -SELECT ?error -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:someValuesFrom ?restrictingClass1. - ?restriction2 owl:someValuesFrom ?restrictingClass2. - {?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("WARN: Class ", STR(?class), " may inherit obsolete someValues restriction <", ?restriction2String, "> because of someValues restriction <", ?restriction1String, ">", " from class ", STR(?superClass)) as ?error) -} \ No newline at end of file