diff --git a/ontology/uco/action/action.ttl b/ontology/uco/action/action.ttl index d5a5bf26..95b4e3c5 100644 --- a/ontology/uco/action/action.ttl +++ b/ontology/uco/action/action.ttl @@ -40,6 +40,7 @@ action:Action rdfs:subClassOf core:UcoObject ; rdfs:label "Action"@en ; rdfs:comment "An action is something that may be done or performed."@en ; + owl:disjointWith core:Event ; sh:property [ sh:class action:Action ; @@ -150,6 +151,16 @@ action:Action sh:targetClass action:Action ; . +action:Action-disjointWith-Event-shape + a sh:NodeShape ; + sh:message "action:Action and core:Event are disjoint classes."@en ; + sh:not [ + a sh:NodeShape ; + sh:class core:Event ; + ] ; + sh:targetClass action:Action ; + . + action:ActionArgumentFacet a owl:Class , diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index 7accb6fa..bdb092e4 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -1,3 +1,4 @@ +@prefix action: . @prefix core: . @prefix owl: . @prefix rdf: . @@ -15,6 +16,11 @@ owl:versionIRI core:1.2.0 ; . +action:Action + a owl:Class ; + rdfs:isDefinedBy ; + . + core:Annotation a owl:Class , @@ -179,6 +185,7 @@ core:Event rdfs:subClassOf core:UcoObject ; rdfs:label "Event"@en ; rdfs:comment "An Event is a noteworthy occurrence (something that happens or might happen)."@en ; + owl:disjointWith action:Action ; sh:property [ sh:class core:UcoObject ; diff --git a/tests/examples/Makefile b/tests/examples/Makefile index 56d619d1..80f59e04 100644 --- a/tests/examples/Makefile +++ b/tests/examples/Makefile @@ -27,6 +27,7 @@ all: \ configuration_setting_XFAIL_validation.ttl \ database_records_PASS_validation.ttl \ database_records_XFAIL_validation.ttl \ + event_XFAIL_validation.ttl \ file_url_PASS_validation.ttl \ has_facet_inverse_functional_PASS_validation.ttl \ has_facet_inverse_functional_XFAIL_validation.ttl \ @@ -97,6 +98,7 @@ check: \ configuration_setting_XFAIL_validation.ttl \ database_records_PASS_validation.ttl \ database_records_XFAIL_validation.ttl \ + event_XFAIL_validation.ttl \ file_url_PASS_validation.ttl \ has_facet_inverse_functional_PASS_validation.ttl \ has_facet_inverse_functional_XFAIL_validation.ttl \ diff --git a/tests/examples/event_XFAIL.json b/tests/examples/event_XFAIL.json new file mode 100644 index 00000000..9f2a59d9 --- /dev/null +++ b/tests/examples/event_XFAIL.json @@ -0,0 +1,28 @@ +{ + "@context": { + "kb": "http://example.org/kb/", + "action": "https://ontology.unifiedcyberontology.org/uco/action/", + "core": "https://ontology.unifiedcyberontology.org/uco/core/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@graph": [ + { + "@id": "kb:Action-0-03ee1fe6-12cf-4a35-b7dd-06d4e69369b5", + "@type": [ + "action:Action", + "core:Event" + ], + "rdfs:comment": "This node will trigger an XFAIL for designating itself an Action and Event, which are disjoint classes." + }, + { + "@id": "kb:Action-1-763c1ff2-d18d-427b-aa82-30d90701a644", + "@type": "action:Action", + "rdfs:comment": "This node should pass validation." + }, + { + "@id": "kb:Event-1-ee9450b6-3535-473d-984d-17a91408a54f", + "@type": "event:Event", + "rdfs:comment": "This node should pass validation." + } + ] +} diff --git a/tests/examples/event_XFAIL_validation.ttl b/tests/examples/event_XFAIL_validation.ttl new file mode 100644 index 00000000..be6dbd96 --- /dev/null +++ b/tests/examples/event_XFAIL_validation.ttl @@ -0,0 +1,21 @@ +@prefix action: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . + +[] + a sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "action:Action and core:Event are disjoint classes."@en ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:NotConstraintComponent ; + sh:sourceShape action:Action-disjointWith-Event-shape ; + sh:value ; + ] ; + . + diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index 285dfdec..c714d0c3 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -207,6 +207,15 @@ def test_database_records_XFAIL() -> None: } ) +def test_event_XFAIL() -> None: + confirm_validation_results( + "event_XFAIL_validation.ttl", + False, + expected_focus_node_severities = { + ("http://example.org/kb/Action-0-03ee1fe6-12cf-4a35-b7dd-06d4e69369b5", str(NS_SH.Violation)), + } + ) + def test_file_url_PASS_validation() -> None: confirm_validation_results( "file_url_PASS_validation.ttl",