Skip to content

Commit

Permalink
Merge branch 'Feature-Issue-536-2.0.0' into unstable-2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnelson-nist committed Jun 29, 2023
2 parents 1b4f835 + 076c66a commit 44f448f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ontology/uco/observable/observable.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -3197,6 +3197,17 @@ observable:File
rdfs:subClassOf observable:FileSystemObject ;
rdfs:label "File"@en ;
rdfs:comment "A file is a computer resource for recording data discretely on a computer storage device."@en ;
owl:disjointWith observable:URL ;
sh:targetClass observable:File ;
.

observable:File-disjointWith-URL-shape
a sh:NodeShape ;
sh:message "observable:File and observable:URL are disjoint classes."@en ;
sh:not [
a sh:NodeShape ;
sh:class observable:URL ;
] ;
sh:targetClass observable:File ;
.

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 \
file_url_XFAIL_validation.ttl \
has_facet_inverse_functional_PASS_validation.ttl \
has_facet_inverse_functional_XFAIL_validation.ttl \
hash_PASS_validation.ttl \
Expand Down Expand Up @@ -96,6 +97,7 @@ check: \
configuration_setting_XFAIL_validation.ttl \
database_records_PASS_validation.ttl \
database_records_XFAIL_validation.ttl \
file_url_XFAIL_validation.ttl \
has_facet_inverse_functional_PASS_validation.ttl \
has_facet_inverse_functional_XFAIL_validation.ttl \
hash_PASS_validation.ttl \
Expand Down
17 changes: 17 additions & 0 deletions tests/examples/file_url_XFAIL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"@context": {
"kb": "http://example.org/kb/",
"observable": "https://ontology.unifiedcyberontology.org/uco/observable/",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@graph": [
{
"@id": "kb:Thing-23a38d67-3432-458b-9651-955b418c2a77",
"@type": [
"observable:File",
"observable:URL"
],
"rdfs:comment": "Should trigger sh:Warning from simultaneously being a member of two disjoint classes; will trigger sh:Violation in UCO 2.0.0."
}
]
}
21 changes: 21 additions & 0 deletions tests/examples/file_url_XFAIL_validation.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@prefix observable: <https://ontology.unifiedcyberontology.org/uco/observable/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

[]
a sh:ValidationReport ;
sh:conforms "false"^^xsd:boolean ;
sh:result [
a sh:ValidationResult ;
sh:focusNode <http://example.org/kb/Thing-23a38d67-3432-458b-9651-955b418c2a77> ;
sh:resultMessage "observable:File and observable:URL are disjoint classes."@en ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:NotConstraintComponent ;
sh:sourceShape observable:File-disjointWith-URL-shape ;
sh:value <http://example.org/kb/Thing-23a38d67-3432-458b-9651-955b418c2a77> ;
] ;
.

6 changes: 6 additions & 0 deletions tests/examples/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ def test_database_records_XFAIL() -> None:
}
)

def test_file_url_XFAIL_validation() -> None:
confirm_validation_results(
"file_url_XFAIL_validation.ttl",
False,
)

def test_has_facet_inverse_functional_PASS() -> None:
confirm_validation_results(
"has_facet_inverse_functional_PASS_validation.ttl",
Expand Down

0 comments on commit 44f448f

Please sign in to comment.