From caa2ffabeb15c3fb90a410dc9f5f261584cfa532 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 6 Jan 2023 17:01:03 -0500 Subject: [PATCH 1/3] Enforce deprecation of observable:creationTime A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/508 Signed-off-by: Alex Nelson --- ontology/uco/observable/observable.ttl | 9 +-------- tests/examples/Makefile | 4 ++-- ...PASS.json => observable_creation_time_XFAIL.json} | 0 tests/examples/test_validation.py | 12 +++--------- 4 files changed, 6 insertions(+), 19 deletions(-) rename tests/examples/{observable_creation_time_PASS.json => observable_creation_time_XFAIL.json} (100%) diff --git a/ontology/uco/observable/observable.ttl b/ontology/uco/observable/observable.ttl index 07862a1e..bc963611 100644 --- a/ontology/uco/observable/observable.ttl +++ b/ontology/uco/observable/observable.ttl @@ -8859,12 +8859,6 @@ observable:WindowsThreadFacet rdfs:label "WindowsThreadFacet"@en ; rdfs:comment "A Windows thread facet is a grouping os characteristics unique to a single thread of execution within a Windows process."@en ; sh:property - [ - sh:datatype xsd:dateTime ; - sh:maxCount "1"^^xsd:integer ; - sh:nodeKind sh:Literal ; - sh:path observable:creationTime ; - ] , [ sh:datatype xsd:dateTime ; sh:maxCount "1"^^xsd:integer ; @@ -10210,9 +10204,8 @@ observable:creationTime-deprecation-shape sh:property [ a sh:PropertyShape ; sh:maxCount "0"^^xsd:integer ; - sh:message "observable:creationTime is deprecated, and will be an error to use in UCO 2.0.0. observable:observableCreatedTime should be used instead."@en ; + sh:message "observable:creationTime is deprecated, and an error to use as of UCO 2.0.0. observable:observableCreatedTime should be used instead."@en ; sh:path observable:creationTime ; - sh:severity sh:Warning ; ] ; sh:targetSubjectsOf observable:creationTime ; . diff --git a/tests/examples/Makefile b/tests/examples/Makefile index 7d6bc056..af41ba20 100644 --- a/tests/examples/Makefile +++ b/tests/examples/Makefile @@ -35,7 +35,7 @@ all: \ location_XFAIL_validation.ttl \ message_thread_PASS_validation.ttl \ message_thread_XFAIL_validation.ttl \ - observable_creation_time_PASS_validation.ttl \ + observable_creation_time_XFAIL_validation.ttl \ owl_axiom_PASS_validation.ttl \ owl_axiom_XFAIL_validation.ttl \ owl_properties_PASS_validation.ttl \ @@ -104,7 +104,7 @@ check: \ location_XFAIL_validation.ttl \ message_thread_PASS_validation.ttl \ message_thread_XFAIL_validation.ttl \ - observable_creation_time_PASS_validation.ttl \ + observable_creation_time_XFAIL_validation.ttl \ owl_axiom_PASS_validation.ttl \ owl_axiom_XFAIL_validation.ttl \ owl_properties_PASS_validation.ttl \ diff --git a/tests/examples/observable_creation_time_PASS.json b/tests/examples/observable_creation_time_XFAIL.json similarity index 100% rename from tests/examples/observable_creation_time_PASS.json rename to tests/examples/observable_creation_time_XFAIL.json diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index d0129801..ee62de03 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -365,16 +365,10 @@ def test_message_thread_PASS_validation() -> None: def test_message_thread_XFAIL_validation() -> None: confirm_validation_results("message_thread_XFAIL_validation.ttl", False) -def test_observable_creation_time_PASS() -> None: +def test_observable_creation_time_XFAIL() -> None: confirm_validation_results( - "observable_creation_time_PASS_validation.ttl", - True, - expected_focus_node_severities={ - ( - "http://example.org/kb/windows-thread-facet-4967ae35-f00b-49c8-9dd2-38e3bdf851e1", - str(NS_SH.Warning) - ) - } + "observable_creation_time_XFAIL_validation.ttl", + False, ) def test_owl_axiom_PASS() -> None: From 9e428df4a1b250e7633dbce6a4645718b23f7912 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 6 Jan 2023 17:01:27 -0500 Subject: [PATCH 2/3] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/508 Signed-off-by: Alex Nelson --- ...ttl => observable_creation_time_XFAIL_validation.ttl} | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) rename tests/examples/{observable_creation_time_PASS_validation.ttl => observable_creation_time_XFAIL_validation.ttl} (66%) diff --git a/tests/examples/observable_creation_time_PASS_validation.ttl b/tests/examples/observable_creation_time_XFAIL_validation.ttl similarity index 66% rename from tests/examples/observable_creation_time_PASS_validation.ttl rename to tests/examples/observable_creation_time_XFAIL_validation.ttl index 60605c2c..bae4a3ea 100644 --- a/tests/examples/observable_creation_time_PASS_validation.ttl +++ b/tests/examples/observable_creation_time_XFAIL_validation.ttl @@ -7,20 +7,19 @@ [] a sh:ValidationReport ; - sh:conforms "true"^^xsd:boolean ; + sh:conforms "false"^^xsd:boolean ; sh:result [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage "observable:creationTime is deprecated, and will be an error to use in UCO 2.0.0. observable:observableCreatedTime should be used instead."@en ; + sh:resultMessage "observable:creationTime is deprecated, and an error to use as of UCO 2.0.0. observable:observableCreatedTime should be used instead."@en ; sh:resultPath observable:creationTime ; - sh:resultSeverity sh:Warning ; + sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:MaxCountConstraintComponent ; sh:sourceShape [ a sh:PropertyShape ; sh:maxCount "0"^^xsd:integer ; - sh:message "observable:creationTime is deprecated, and will be an error to use in UCO 2.0.0. observable:observableCreatedTime should be used instead."@en ; + sh:message "observable:creationTime is deprecated, and an error to use as of UCO 2.0.0. observable:observableCreatedTime should be used instead."@en ; sh:path observable:creationTime ; - sh:severity sh:Warning ; ] ; ] ; . From 7dd71a72c453594e422c6c57cbae3cb5f82237e7 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 18 Jan 2023 00:08:01 -0500 Subject: [PATCH 3/3] Align types:Thread superclass with other classes serving as data structures This patch reverts the test for subclasses of `co:Element` and `core:UcoObject`, which was implemented to enforce disjointedness of `core:UcoObject` and `core:UcoInherentCharacterizationThing`. Testing for classes declared as disjoint is delegated to more general mechanisms. No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/509 Signed-off-by: Alex Nelson --- ontology/uco/types/types.ttl | 4 +- .../co_Collection_core_UcoObject_XFAIL.ttl | 57 ------------------- ...ection_core_UcoObject_XFAIL_validation.ttl | 38 ------------- tests/shapes/test_qc_shapes.py | 10 ---- 4 files changed, 2 insertions(+), 107 deletions(-) delete mode 100644 tests/shapes/examples_uco_qc/co_Collection_core_UcoObject_XFAIL.ttl delete mode 100644 tests/shapes/examples_uco_qc/co_Collection_core_UcoObject_XFAIL_validation.ttl diff --git a/ontology/uco/types/types.ttl b/ontology/uco/types/types.ttl index 84c03182..e29163a1 100644 --- a/ontology/uco/types/types.ttl +++ b/ontology/uco/types/types.ttl @@ -180,7 +180,7 @@ types:Thread ; rdfs:subClassOf co:Bag , - core:UcoThing + core:UcoInherentCharacterizationThing ; rdfs:label "Thread"@en ; rdfs:comment "A semi-ordered array of items, that can be present in multiple copies. Implemetation of a UCO Thread is similar to a Collections Ontology List, except a Thread may fork and merge - that is, one of its members may have two or more direct successors, and two or more direct predecessors."@en ; @@ -198,7 +198,7 @@ types:ThreadItem ; rdfs:subClassOf co:Item , - core:UcoThing + core:UcoInherentCharacterizationThing ; rdfs:label "ThreadItem"@en ; rdfs:comment "A ThreadItem is a member of a thread."@en ; diff --git a/tests/shapes/examples_uco_qc/co_Collection_core_UcoObject_XFAIL.ttl b/tests/shapes/examples_uco_qc/co_Collection_core_UcoObject_XFAIL.ttl deleted file mode 100644 index 619d3675..00000000 --- a/tests/shapes/examples_uco_qc/co_Collection_core_UcoObject_XFAIL.ttl +++ /dev/null @@ -1,57 +0,0 @@ -@prefix co: . -@prefix core: . -@prefix ex: . -@prefix observable: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . - -ex:IPAddressRoute - a owl:Class ; - rdfs:comment "This is expected to trigger a disjointed-classes violation, once subclass expansion occurs. This example copies subclass axioms from co:, core:, and observable:."@en ; - rdfs:subClassOf - co:List , - observable:ObservableObject - ; - . - -co:Bag - a owl:Class ; - rdfs:subClassOf co:Collection ; - . - -co:List - a owl:Class ; - rdfs:comment "This definition is excerpted from co:."@en ; - rdfs:subClassOf [ - a owl:Class ; - owl:intersectionOf ( - co:Bag - [ - a owl:Restriction ; - owl:onProperty co:item ; - owl:allValuesFrom co:ListItem ; - ] - ) ; - ] ; - . - -core:Item - a owl:Class ; - rdfs:subClassOf core:UcoObject ; - . - -observable:ObservableObject - a owl:Class ; - rdfs:subClassOf - core:Item , - observable:Observable - ; - . - -observable:Observable - a owl:Class ; - rdfs:subClassOf core:UcoObject ; - . - diff --git a/tests/shapes/examples_uco_qc/co_Collection_core_UcoObject_XFAIL_validation.ttl b/tests/shapes/examples_uco_qc/co_Collection_core_UcoObject_XFAIL_validation.ttl deleted file mode 100644 index f8a4c0e8..00000000 --- a/tests/shapes/examples_uco_qc/co_Collection_core_UcoObject_XFAIL_validation.ttl +++ /dev/null @@ -1,38 +0,0 @@ -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix sh: . -@prefix uco-qc: . -@prefix xsd: . - -[] - a sh:ValidationReport ; - sh:conforms "false"^^xsd:boolean ; - sh:result [ - a sh:ValidationResult ; - sh:focusNode ; - sh:resultMessage "The focus node is defined as a subclass of two classes intended to be disjoint, co:Collection and core:UcoObject. See Issue 509 for suggested implementation alterations." ; - sh:resultSeverity sh:Violation ; - sh:sourceConstraint [ - a sh:SPARQLConstraint ; - rdfs:seeAlso ; - sh:message "The focus node is defined as a subclass of two classes intended to be disjoint, co:Collection and core:UcoObject. See Issue 509 for suggested implementation alterations."@en ; - sh:select """ - PREFIX co: - PREFIX core: - PREFIX rdfs: - SELECT $this - WHERE { - $this - rdfs:subClassOf*/(owl:intersectionOf/rdf:rest*/rdf:first)?/rdfs:subClassOf* co:Collection ; - rdfs:subClassOf* core:UcoObject ; - . - } - """ ; - ] ; - sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; - sh:sourceShape uco-qc:disjointedness-co-collection-core-uco-object ; - sh:value ; - ] ; - . - diff --git a/tests/shapes/test_qc_shapes.py b/tests/shapes/test_qc_shapes.py index 1d795e16..0a59e6da 100644 --- a/tests/shapes/test_qc_shapes.py +++ b/tests/shapes/test_qc_shapes.py @@ -24,16 +24,6 @@ @pytest.mark.parametrize( ["filename", "expected_validation_result", "expected_focus_values"], [ - ( - "examples_uco_qc/co_Collection_core_UcoObject_XFAIL_validation.ttl", - False, - { - ( - URIRef("http://example.org/ontology/IPAddressRoute"), - URIRef("http://example.org/ontology/IPAddressRoute"), - ) - } - ), ( "examples_uco_owl/owl_incompatibleWith_shape_PASS_validation.ttl", True,