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 632: Change OperatingSystem parent class to Software #636

Draft
wants to merge 6 commits into
base: develop-2.0.0
Choose a base branch
from
Draft
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
22 changes: 10 additions & 12 deletions ontology/uco/observable/observable.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5146,7 +5146,7 @@ observable:OperatingSystem
owl:Class ,
sh:NodeShape
;
rdfs:subClassOf observable:ObservableObject ;
rdfs:subClassOf observable:Software ;
rdfs:label "OperatingSystem"@en ;
rdfs:comment "An operating system is the software that manages computer hardware, software resources, and provides common services for computer programs. [based on https://en.wikipedia.org/wiki/Operating_system]"@en ;
sh:targetClass observable:OperatingSystem ;
Expand All @@ -5161,12 +5161,6 @@ observable:OperatingSystemFacet
rdfs:label "OperatingSystemFacet"@en ;
rdfs:comment "An operating system facet is a grouping of characteristics unique to the software that manages computer hardware, software resources, and provides common services for computer programs. [based on https://en.wikipedia.org/wiki/Operating_system]"@en ;
sh:property
[
sh:class identity:Identity ;
sh:maxCount "1"^^xsd:integer ;
sh:nodeKind sh:IRI ;
sh:path observable:manufacturer ;
] ,
[
sh:class types:Dictionary ;
sh:maxCount "1"^^xsd:integer ;
Expand All @@ -5193,14 +5187,18 @@ observable:OperatingSystemFacet
] ,
[
sh:datatype xsd:string ;
sh:maxCount "1"^^xsd:integer ;
sh:nodeKind sh:Literal ;
sh:path observable:version ;
sh:path observable:advertisingID ;
] ,
[
sh:datatype xsd:string ;
sh:nodeKind sh:Literal ;
sh:path observable:advertisingID ;
sh:maxCount "0"^^xsd:integer ;
sh:message "As of UCO 2.0.0, uco-observable:manufacturer is not associated with uco-observable:OperatingSystemFacet. Please place this on a uco-observable:SoftwareFacet instead."@en ;
sh:path observable:manufacturer ;
] ,
[
sh:maxCount "0"^^xsd:integer ;
sh:message "As of UCO 2.0.0, uco-observable:version is not associated with uco-observable:OperatingSystemFacet. Please place this on a uco-observable:SoftwareFacet instead."@en ;
sh:path observable:version ;
]
;
sh:targetClass observable:OperatingSystemFacet ;
Expand Down
4 changes: 4 additions & 0 deletions tests/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ all: \
object_status_PASS_validation.ttl \
object_status_XFAIL_validation.ttl \
observable_creation_time_XFAIL_validation.ttl \
operating_system_PASS_validation.ttl \
operating_system_XFAIL_validation.ttl \
owl_axiom_PASS_validation.ttl \
owl_axiom_XFAIL_validation.ttl \
owl_properties_PASS_validation.ttl \
Expand Down Expand Up @@ -121,6 +123,8 @@ check: \
object_status_PASS_validation.ttl \
object_status_XFAIL_validation.ttl \
observable_creation_time_XFAIL_validation.ttl \
operating_system_PASS_validation.ttl \
operating_system_XFAIL_validation.ttl \
owl_axiom_PASS_validation.ttl \
owl_axiom_XFAIL_validation.ttl \
owl_properties_PASS_validation.ttl \
Expand Down
43 changes: 43 additions & 0 deletions tests/examples/operating_system_PASS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"@context": {
"core": "https://ontology.unifiedcyberontology.org/uco/core/",
"identity": "https://ontology.unifiedcyberontology.org/uco/identity/",
"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:Organization-4ea8a5bf-60ea-43ba-9ba6-f852ce8f8b54",
"@type": "identity:Organization",
"core:name": "Example OS Company"
},
{
"@id": "kb:OperatingSystem-427dd103-2553-4ccc-ad57-1df4e88b174d",
"@type": "observable:OperatingSystem",
"core:description": "The Example Operating System instance deployed on workstation B-203-22",
"core:hasFacet": [
{
"@id": "kb:SoftwareFacet-1bde46c5-4648-493c-b9dc-56477191d5c6",
"@type": "observable:SoftwareFacet",
"observable:cpeid": "cpe:2.3:o:exampleosco:exampleos:40:*:*:*:*:*:*:*",
"observable:language": "en-us",
"observable:manufacturer": {
"@id": "kb:Organization-4ea8a5bf-60ea-43ba-9ba6-f852ce8f8b54"
},
"observable:version": "40"
},
{
"@id": "kb:OperatingSystemFacet-35047ef2-ffd6-45e8-8b3c-2e8e4bfe7c2b",
"@type": "observable:OperatingSystemFacet",
"observable:bitness": "64",
"observable:installDate": {
"@type": "xsd:dateTime",
"@value": "2024-09-13T09:00:00-04:00"
}
}
]
}
]
}
11 changes: 11 additions & 0 deletions tests/examples/operating_system_PASS_validation.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@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 ;
.

44 changes: 44 additions & 0 deletions tests/examples/operating_system_XFAIL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"@context": {
"core": "https://ontology.unifiedcyberontology.org/uco/core/",
"identity": "https://ontology.unifiedcyberontology.org/uco/identity/",
"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:Organization-cc6ee776-d770-409d-a84b-06aa6009b670",
"@type": "identity:Organization",
"core:name": "Example OS Company"
},
{
"@id": "kb:OperatingSystem-0a6c3dcd-9a53-4d1b-a635-afbcedab9760",
"@type": "observable:OperatingSystem",
"core:description": "The Example Operating System instance deployed on workstation C-304-33",
"core:hasFacet": [
{
"@id": "kb:SoftwareFacet-6b474a08-99f7-4dbd-8cd1-ef81ddff6bc3",
"@type": "observable:SoftwareFacet",
"observable:cpeid": "cpe:2.3:o:exampleosco:exampleos:40:*:*:*:*:*:*:*",
"observable:language": "en-us"
},
{
"@id": "kb:OperatingSystemFacet-483cc1a7-f1f1-472f-87e0-3e076fad46ec",
"@type": "observable:OperatingSystemFacet",
"rdfs:comment": "This node will trigger an error for housing the manufacturer and version properties, now required to be on SoftwareFacet.",
"observable:bitness": "64",
"observable:installDate": {
"@type": "xsd:dateTime",
"@value": "2024-09-13T09:00:00-04:00"
},
"observable:manufacturer": {
"@id": "kb:Organization-cc6ee776-d770-409d-a84b-06aa6009b670"
},
"observable:version": "40"
}
]
}
]
}
40 changes: 40 additions & 0 deletions tests/examples/operating_system_XFAIL_validation.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@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/OperatingSystemFacet-483cc1a7-f1f1-472f-87e0-3e076fad46ec> ;
sh:resultMessage "As of UCO 2.0.0, uco-observable:manufacturer is not associated with uco-observable:OperatingSystemFacet. Please place this on a uco-observable:SoftwareFacet instead."@en ;
sh:resultPath observable:manufacturer ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MaxCountConstraintComponent ;
sh:sourceShape [
sh:maxCount "0"^^xsd:integer ;
sh:message "As of UCO 2.0.0, uco-observable:manufacturer is not associated with uco-observable:OperatingSystemFacet. Please place this on a uco-observable:SoftwareFacet instead."@en ;
sh:path observable:manufacturer ;
] ;
] ,
[
a sh:ValidationResult ;
sh:focusNode <http://example.org/kb/OperatingSystemFacet-483cc1a7-f1f1-472f-87e0-3e076fad46ec> ;
sh:resultMessage "As of UCO 2.0.0, uco-observable:version is not associated with uco-observable:OperatingSystemFacet. Please place this on a uco-observable:SoftwareFacet instead."@en ;
sh:resultPath observable:version ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MaxCountConstraintComponent ;
sh:sourceShape [
sh:maxCount "0"^^xsd:integer ;
sh:message "As of UCO 2.0.0, uco-observable:version is not associated with uco-observable:OperatingSystemFacet. Please place this on a uco-observable:SoftwareFacet instead."@en ;
sh:path observable:version ;
] ;
]
;
.

19 changes: 19 additions & 0 deletions tests/examples/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,25 @@ def test_observable_creation_time_XFAIL() -> None:
False,
)

def test_operating_system_PASS() -> None:
confirm_validation_results(
"operating_system_PASS_validation.ttl",
True,
expected_focus_node_severities=set()
)

def test_operating_system_XFAIL() -> None:
confirm_validation_results(
"operating_system_XFAIL_validation.ttl",
False,
expected_focus_node_severities={
(
"http://example.org/kb/OperatingSystemFacet-483cc1a7-f1f1-472f-87e0-3e076fad46ec",
str(NS_SH.Violation)
),
}
)

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