Skip to content

Commit

Permalink
Designate action:Action and core:Event disjoint
Browse files Browse the repository at this point in the history
In an OWL-only sense, the ontology portion of this patch could have been
accomplished by adding one triple to `action:Action`.

For the sake of symmetry and explicitness, `core:Event` also picked up
the `owl:disjointWith` statement.  To satisfy OWL syntactic
requirements, a stub reference to `action:Action` is added, as was done
for `types:Dictionary` for Issue 541 (discussed in PR 542).

To enforce disjointedness with SHACL, a new independent shape is added,
`action:Action-disjointWith-Event-shape`.

A follow-on patch will regenerate Make-managed files.

EDIT 2023-11-22: An initial version of this patch included an inlined
anonymous `sh:NodeShape`.  I now believe the scenario that shape
mitigates (multi-import of a shapes graph leading to SHACL-scoped syntax
errors) is unlikely, and I also saw that the noted rationale around
`sh:not` was confused with another predicate (`sh:inversePath`).

References:
* #563
* #542

Signed-off-by: Alex Nelson <[email protected]>
  • Loading branch information
ajnelson-nist committed Nov 22, 2023
1 parent 9727fe3 commit 6669aab
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ontology/uco/action/action.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;
Expand Down Expand Up @@ -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 ,
Expand Down
7 changes: 7 additions & 0 deletions ontology/uco/core/core.ttl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@prefix action: <https://ontology.unifiedcyberontology.org/uco/action/> .
@prefix core: <https://ontology.unifiedcyberontology.org/uco/core/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
Expand All @@ -15,6 +16,11 @@
owl:versionIRI core:1.2.0 ;
.

action:Action
a owl:Class ;
rdfs:isDefinedBy <https://ontology.unifiedcyberontology.org/uco/types> ;
.

core:Annotation
a
owl:Class ,
Expand Down Expand Up @@ -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 ;
Expand Down
2 changes: 2 additions & 0 deletions tests/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
28 changes: 28 additions & 0 deletions tests/examples/event_XFAIL.json
Original file line number Diff line number Diff line change
@@ -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."
}
]
}
9 changes: 9 additions & 0 deletions tests/examples/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6669aab

Please sign in to comment.