Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 508: Deprecate observable:creationTime, replacing with observableCreatedTime #511

Merged
merged 2 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion ontology/uco/observable/observable.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -8865,6 +8865,12 @@ observable:WindowsThreadFacet
sh:nodeKind sh:Literal ;
sh:path observable:creationTime ;
] ,
[
sh:datatype xsd:dateTime ;
sh:maxCount "1"^^xsd:integer ;
sh:nodeKind sh:Literal ;
sh:path observable:observableCreatedTime ;
] ,
[
sh:datatype xsd:hexBinary ;
sh:nodeKind sh:Literal ;
Expand Down Expand Up @@ -10191,11 +10197,26 @@ observable:creationFlags
.

observable:creationTime
a owl:DatatypeProperty ;
a
owl:DatatypeProperty ,
owl:DeprecatedProperty
;
rdfs:label "creationTime"@en ;
rdfs:range xsd:dateTime ;
.

observable:creationTime-deprecation-shape
a sh:NodeShape ;
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:path observable:creationTime ;
sh:severity sh:Warning ;
] ;
sh:targetSubjectsOf observable:creationTime ;
.

observable:creator
a owl:ObjectProperty ;
rdfs:label "creator"@en ;
Expand Down
2 changes: 2 additions & 0 deletions tests/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ all: \
location_XFAIL_validation.ttl \
message_thread_PASS_validation.ttl \
message_thread_XFAIL_validation.ttl \
observable_creation_time_PASS_validation.ttl \
owl_axiom_PASS_validation.ttl \
owl_axiom_XFAIL_validation.ttl \
owl_properties_PASS_validation.ttl \
Expand Down Expand Up @@ -103,6 +104,7 @@ check: \
location_XFAIL_validation.ttl \
message_thread_PASS_validation.ttl \
message_thread_XFAIL_validation.ttl \
observable_creation_time_PASS_validation.ttl \
owl_axiom_PASS_validation.ttl \
owl_axiom_XFAIL_validation.ttl \
owl_properties_PASS_validation.ttl \
Expand Down
24 changes: 24 additions & 0 deletions tests/examples/observable_creation_time_PASS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"@context": {
"core": "https://ontology.unifiedcyberontology.org/uco/core/",
"kb": "http://example.org/kb/",
"observable": "https://ontology.unifiedcyberontology.org/uco/observable/",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"@graph": [
{
"@id": "kb:windows-thread-da52a01e-41cc-42d5-85be-ca14bfa10fd6",
"@type": "observable:WindowsThread",
"core:hasFacet": {
"@id": "kb:windows-thread-facet-4967ae35-f00b-49c8-9dd2-38e3bdf851e1",
"@type": "observable:WindowsThreadFacet",
"rdfs:comment": "In UCO 1.2.0, this will raise a warning. In UCO 2.0.0, this will raise an error.",
"observable:creationTime": {
"@type": "xsd:dateTime",
"@value": "2023-01-01T01:23:45Z"
}
}
}
]
}
27 changes: 27 additions & 0 deletions tests/examples/observable_creation_time_PASS_validation.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@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 "true"^^xsd:boolean ;
sh:result [
a sh:ValidationResult ;
sh:focusNode <http://example.org/kb/windows-thread-facet-4967ae35-f00b-49c8-9dd2-38e3bdf851e1> ;
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:resultPath observable:creationTime ;
sh:resultSeverity sh:Warning ;
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:path observable:creationTime ;
sh:severity sh:Warning ;
] ;
] ;
.

12 changes: 12 additions & 0 deletions tests/examples/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ 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:
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)
)
}
)

def test_owl_axiom_PASS() -> None:
confirm_validation_results(
"owl_axiom_PASS_validation.ttl",
Expand Down