Skip to content

Commit

Permalink
Enforce InformationResource and NeverInformationResource disjointedness
Browse files Browse the repository at this point in the history
A follow-on patch will regenerate Make-managed files.

References:
* #606

Signed-off-by: Alex Nelson <[email protected]>
  • Loading branch information
ajnelson-nist committed Jun 28, 2024
1 parent 0439e79 commit 4138e7a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
3 changes: 1 addition & 2 deletions ontology/uco/core/core.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,11 @@ core:InformationResource

core:InformationResource-disjointWith-NeverInformationResource-shape
a sh:NodeShape ;
sh:message "core:InformationResource and core:NeverInformationResource are disjoint classes. Assigning both types to a single node will be an error as of UCO 2.0.0."@en ;
sh:message "core:InformationResource and core:NeverInformationResource are disjoint classes."@en ;
sh:not [
a sh:NodeShape ;
sh:class core:NeverInformationResource ;
] ;
sh:severity sh:Warning ;
sh:targetClass core:InformationResource ;
.

Expand Down
2 changes: 2 additions & 0 deletions tests/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ all: \
hash_PASS_validation.ttl \
hash_XFAIL_validation.ttl \
information_resource_PASS_validation.ttl \
information_resource_XFAIL_validation.ttl \
location_PASS_validation.ttl \
location_XFAIL_validation.ttl \
message_thread_PASS_validation.ttl \
Expand Down Expand Up @@ -110,6 +111,7 @@ check: \
hash_PASS_validation.ttl \
hash_XFAIL_validation.ttl \
information_resource_PASS_validation.ttl \
information_resource_XFAIL_validation.ttl \
location_PASS_validation.ttl \
location_XFAIL_validation.ttl \
message_thread_PASS_validation.ttl \
Expand Down
7 changes: 2 additions & 5 deletions tests/examples/information_resource_PASS.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@
"@graph": [
{
"@id": "http://example.org/~bob",
"@type": [
"identity:Person",
"observable:WebPage"
],
"@type": "observable:WebResource",
"core:name": "Bob",
"core:description": "Bob's company home page.",
"rdfs:comment": "This node will trigger a warning from conflating a node as both a person and the person's home page.",
"rdfs:seeAlso": [
{
"@id": "kb:Person-a3d3af3d-ea1d-47f6-bc02-ac334ded6549"
Expand All @@ -25,6 +21,7 @@
}
]
},

{
"@id": "kb:Person-a3d3af3d-ea1d-47f6-bc02-ac334ded6549",
"@type": "identity:Person",
Expand Down
29 changes: 29 additions & 0 deletions tests/examples/information_resource_XFAIL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"@context": {
"core": "https://ontology.unifiedcyberontology.org/uco/core/",
"kb": "http://example.org/kb/",
"identity": "https://ontology.unifiedcyberontology.org/uco/identity/",
"observable": "https://ontology.unifiedcyberontology.org/uco/observable/",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
},
"@graph": [
{
"@id": "http://example.org/~bob",
"@type": [
"identity:Person",
"observable:WebPage"
],
"core:name": "Bob",
"core:description": "Bob's company home page.",
"rdfs:comment": "This node will trigger an error from conflating a node as both a person and the person's home page.",
"rdfs:seeAlso": [
{
"@id": "kb:Person-a3d3af3d-ea1d-47f6-bc02-ac334ded6549"
},
{
"@id": "kb:WebPage-1c05c378-124e-4d3c-898a-fb5a8d178cf8"
}
]
}
]
}
11 changes: 10 additions & 1 deletion tests/examples/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,20 @@ def test_information_resource_PASS_validation() -> None:
"information_resource_PASS_validation.ttl",
True,
expected_focus_node_severities={
("http://example.org/~bob", str(NS_SH.Warning)),
("http://example.org/~bob", str(NS_SH.Info)),
("http://example.org/~chris", str(NS_SH.Info)),
}
)

def test_information_resource_XFAIL_validation() -> None:
confirm_validation_results(
"information_resource_XFAIL_validation.ttl",
False,
expected_focus_node_severities={
("http://example.org/~bob", str(NS_SH.Violation)),
}
)

def test_co_PASS_validation() -> None:
confirm_validation_results("co_PASS_validation.ttl", True)

Expand Down

0 comments on commit 4138e7a

Please sign in to comment.