From 79261b89cd8ba47f08023ecdb78c38bd04e3c341 Mon Sep 17 00:00:00 2001 From: Benjamin Hendrix Date: Fri, 4 Aug 2023 14:19:21 -0400 Subject: [PATCH 01/18] Issue: 549 Added new vocabulary:ObjectStatusVocab vocabulary Added new core:objectStatus property Added new associated property shapes on core:UcoObject --- ontology/uco/core/core.ttl | 52 +++++++++++++++++++++++++- ontology/uco/vocabulary/vocabulary.ttl | 14 +++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index aaa52614..92cab686 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -396,7 +396,44 @@ core:UcoObject sh:datatype xsd:string ; sh:nodeKind sh:Literal ; sh:path core:tag ; - ] + ] , + [ + sh:datatype vocabulary:ObjectStatusVocab ; + sh:message "Value is outside the default vocabulary ObjectStatusVocab." ; + sh:path core:objectStatus ; + sh:severity sh:Info ; + ] , + [ + sh:minCount "1"^^xsd:integer ; + sh:maxCount "1"^^xsd:integer ; + sh:nodeKind sh:Literal ; + sh:or ( + [ + sh:datatype vocabulary:ObjectStatusVocab ; + ] + [ + sh:datatype xsd:string ; + ] + ) ; + sh:path core:objectStatus ; + ] , + [ + sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; + sh:or ( + [ + sh:datatype vocabulary:ObjectStatusVocab ; + sh:in ( + "Draft"^^vocabulary:ObjectStatusVocab + "Final"^^vocabulary:ObjectStatusVocab + "Deprecated"^^vocabulary:ObjectStatusVocab + ) ; + ] + [ + sh:datatype xsd:string ; + ] + ) ; + sh:path core:objectStatus ; + ] ; sh:targetClass core:UcoObject ; . @@ -621,6 +658,19 @@ core:objectMarking rdfs:range core:MarkingDefinitionAbstraction ; . +core:objectStatus + a owl:DatatypeProperty ; + rdfs:comment "The current state of formality and acceptance for a UCO object ."@en-US ; + rdfs:label "Object Status"@en-US ; + rdfs:range [ + a rdfs:Datatype ; + owl:unionOf ( + xsd:string + vocabulary:ObjectStatusVocab + ) ; + ] ; + . + core:referenceURL a owl:DatatypeProperty ; rdfs:label "referenceURL"@en ; diff --git a/ontology/uco/vocabulary/vocabulary.ttl b/ontology/uco/vocabulary/vocabulary.ttl index a376011b..e88f4630 100644 --- a/ontology/uco/vocabulary/vocabulary.ttl +++ b/ontology/uco/vocabulary/vocabulary.ttl @@ -659,6 +659,20 @@ vocabulary:MemoryBlockTypeVocab ] ; . +vocabulary:ObjectStatusVocab + a rdfs:Datatype ; + rdfs:label "Object Status Vocabulary"@en-US ; + owl:equivalentClass [ + a rdfs:Datatype ; + owl:onDatatype xsd:string ; + owl:oneOf ( + "Draft"^^vocabulary:ObjectStatusVocab + "Final"^^vocabulary:ObjectStatusVocab + "Deprecated"^^vocabulary:ObjectStatusVocab + ) ; + ] ; + . + vocabulary:ObservableObjectRelationshipVocab a rdfs:Datatype ; rdfs:label "Cyber Item Relationship Vocabulary"@en-US ; From 03a3d3c38ee924d8bb1b0e2c2c98c9f4f7401cf3 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 26 Jul 2024 10:05:42 -0400 Subject: [PATCH 02/18] Warn if a Disk instance is not also a Device Test cases omitted from ontology's tests because CASE example data are known to use `uco-observable:Disk`. No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/612 Signed-off-by: Alex Nelson --- ontology/uco/observable/observable.ttl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ontology/uco/observable/observable.ttl b/ontology/uco/observable/observable.ttl index 37dc84be..a11ef758 100644 --- a/ontology/uco/observable/observable.ttl +++ b/ontology/uco/observable/observable.ttl @@ -2437,6 +2437,14 @@ observable:Disk rdfs:subClassOf observable:ObservableObject ; rdfs:label "Disk"@en ; rdfs:comment "A disk is a storage mechanism where data is recorded by various electronic, magnetic, optical, or mechanical changes to a surface layer of one or more rotating disks."@en ; + rdfs:seeAlso [ + a sh:NodeShape ; + rdfs:comment "This anonymous shape is attached with rdfs:seeAlso in order to associate a warning-severity class constraint, that will only be necessary as an independent shape until UCO 2.0.0."@en ; + sh:class observable:Device ; + sh:message "In UCO 2.0.0, uco-observable:Disk will be a subclass of uco-observable:Device. In preparation for UCO 2.0.0, the additional type uco-observable:Device should be assigned to this node."@en ; + sh:severity sh:Warning ; + sh:targetClass observable:Disk ; + ] ; sh:targetClass observable:Disk ; . From a27175072d6e3524c56274523b99d53faa9ef353 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 29 Jul 2024 09:49:52 -0400 Subject: [PATCH 03/18] Warn if a Disk instance is not also a StorageMedium No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/612 Signed-off-by: Alex Nelson --- ontology/uco/observable/observable.ttl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ontology/uco/observable/observable.ttl b/ontology/uco/observable/observable.ttl index a11ef758..6dc75195 100644 --- a/ontology/uco/observable/observable.ttl +++ b/ontology/uco/observable/observable.ttl @@ -2440,8 +2440,8 @@ observable:Disk rdfs:seeAlso [ a sh:NodeShape ; rdfs:comment "This anonymous shape is attached with rdfs:seeAlso in order to associate a warning-severity class constraint, that will only be necessary as an independent shape until UCO 2.0.0."@en ; - sh:class observable:Device ; - sh:message "In UCO 2.0.0, uco-observable:Disk will be a subclass of uco-observable:Device. In preparation for UCO 2.0.0, the additional type uco-observable:Device should be assigned to this node."@en ; + sh:class observable:StorageMedium ; + sh:message "In UCO 2.0.0, uco-observable:Disk will be a subclass of uco-observable:StorageMedium. In preparation for UCO 2.0.0, the additional type uco-observable:StorageMedium should be assigned to this node."@en ; sh:severity sh:Warning ; sh:targetClass observable:Disk ; ] ; From c9c921d4b01da470895251f2e6a70e94521c4d7c Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 9 Aug 2024 09:50:02 -0400 Subject: [PATCH 04/18] Add missed prefix A follow-on patch will normalize. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 1 + 1 file changed, 1 insertion(+) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index 92cab686..a14616ab 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -4,6 +4,7 @@ @prefix rdfs: . @prefix sh: . @prefix types: . +@prefix vocabulary: . @prefix xsd: . From 37f7b86e085bfa3749325cb1ecd2457caf9f2ce6 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 9 Aug 2024 10:00:31 -0400 Subject: [PATCH 05/18] Make objectStatus optional A follow-on patch will normalize. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 1 - 1 file changed, 1 deletion(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index a14616ab..a281dce2 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -405,7 +405,6 @@ core:UcoObject sh:severity sh:Info ; ] , [ - sh:minCount "1"^^xsd:integer ; sh:maxCount "1"^^xsd:integer ; sh:nodeKind sh:Literal ; sh:or ( From a6f84ce665db58f413a723f99b9913e3734f10d9 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 9 Aug 2024 10:00:56 -0400 Subject: [PATCH 06/18] Normalize No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index a281dce2..1094bce4 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -403,8 +403,8 @@ core:UcoObject sh:message "Value is outside the default vocabulary ObjectStatusVocab." ; sh:path core:objectStatus ; sh:severity sh:Info ; - ] , - [ + ] , + [ sh:maxCount "1"^^xsd:integer ; sh:nodeKind sh:Literal ; sh:or ( @@ -416,8 +416,8 @@ core:UcoObject ] ) ; sh:path core:objectStatus ; - ] , - [ + ] , + [ sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; sh:or ( [ @@ -433,7 +433,7 @@ core:UcoObject ] ) ; sh:path core:objectStatus ; - ] + ] ; sh:targetClass core:UcoObject ; . @@ -660,9 +660,9 @@ core:objectMarking core:objectStatus a owl:DatatypeProperty ; - rdfs:comment "The current state of formality and acceptance for a UCO object ."@en-US ; - rdfs:label "Object Status"@en-US ; - rdfs:range [ + rdfs:label "Object Status"@en-US ; + rdfs:comment "The current state of formality and acceptance for a UCO object ."@en-US ; + rdfs:range [ a rdfs:Datatype ; owl:unionOf ( xsd:string From 70a1975461548ee695c43a283259f0f15faaa0af Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 9 Aug 2024 11:54:00 -0400 Subject: [PATCH 07/18] Move ObjectStatusVocab into core namesapce This follows a committee decision to keep core as a namespace with no import-dependencies. No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 29 +++++++++++++++++++------- ontology/uco/vocabulary/vocabulary.ttl | 14 ------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index b9d4d8f8..c976948a 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -5,7 +5,6 @@ @prefix rdfs: . @prefix sh: . @prefix types: . -@prefix vocabulary: . @prefix xsd: . @@ -318,6 +317,20 @@ core:ModusOperandi sh:targetClass core:ModusOperandi ; . +core:ObjectStatusVocab + a rdfs:Datatype ; + rdfs:label "Object Status Vocabulary"@en-US ; + owl:equivalentClass [ + a rdfs:Datatype ; + owl:onDatatype xsd:string ; + owl:oneOf ( + "Draft"^^core:ObjectStatusVocab + "Final"^^core:ObjectStatusVocab + "Deprecated"^^core:ObjectStatusVocab + ) ; + ] ; + . + core:Relationship a owl:Class , @@ -454,7 +467,7 @@ core:UcoObject sh:path core:tag ; ] , [ - sh:datatype vocabulary:ObjectStatusVocab ; + sh:datatype core:ObjectStatusVocab ; sh:message "Value is outside the default vocabulary ObjectStatusVocab." ; sh:path core:objectStatus ; sh:severity sh:Info ; @@ -464,7 +477,7 @@ core:UcoObject sh:nodeKind sh:Literal ; sh:or ( [ - sh:datatype vocabulary:ObjectStatusVocab ; + sh:datatype core:ObjectStatusVocab ; ] [ sh:datatype xsd:string ; @@ -476,11 +489,11 @@ core:UcoObject sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; sh:or ( [ - sh:datatype vocabulary:ObjectStatusVocab ; + sh:datatype core:ObjectStatusVocab ; sh:in ( - "Draft"^^vocabulary:ObjectStatusVocab - "Final"^^vocabulary:ObjectStatusVocab - "Deprecated"^^vocabulary:ObjectStatusVocab + "Draft"^^core:ObjectStatusVocab + "Final"^^core:ObjectStatusVocab + "Deprecated"^^core:ObjectStatusVocab ) ; ] [ @@ -742,7 +755,7 @@ core:objectStatus a rdfs:Datatype ; owl:unionOf ( xsd:string - vocabulary:ObjectStatusVocab + core:ObjectStatusVocab ) ; ] ; . diff --git a/ontology/uco/vocabulary/vocabulary.ttl b/ontology/uco/vocabulary/vocabulary.ttl index fe63a0a0..d13c89e7 100644 --- a/ontology/uco/vocabulary/vocabulary.ttl +++ b/ontology/uco/vocabulary/vocabulary.ttl @@ -659,20 +659,6 @@ vocabulary:MemoryBlockTypeVocab ] ; . -vocabulary:ObjectStatusVocab - a rdfs:Datatype ; - rdfs:label "Object Status Vocabulary"@en-US ; - owl:equivalentClass [ - a rdfs:Datatype ; - owl:onDatatype xsd:string ; - owl:oneOf ( - "Draft"^^vocabulary:ObjectStatusVocab - "Final"^^vocabulary:ObjectStatusVocab - "Deprecated"^^vocabulary:ObjectStatusVocab - ) ; - ] ; - . - vocabulary:ObservableObjectRelationshipVocab a rdfs:Datatype ; rdfs:label "Cyber Item Relationship Vocabulary"@en-US ; From a7c7814fdbc68694d42a507cc35318dc9803b346 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 9 Aug 2024 11:56:33 -0400 Subject: [PATCH 08/18] Close objectStatus No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 44 ++++++-------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index c976948a..045f602e 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -468,38 +468,14 @@ core:UcoObject ] , [ sh:datatype core:ObjectStatusVocab ; - sh:message "Value is outside the default vocabulary ObjectStatusVocab." ; - sh:path core:objectStatus ; - sh:severity sh:Info ; - ] , - [ - sh:maxCount "1"^^xsd:integer ; - sh:nodeKind sh:Literal ; - sh:or ( - [ - sh:datatype core:ObjectStatusVocab ; - ] - [ - sh:datatype xsd:string ; - ] + sh:in ( + "Draft"^^core:ObjectStatusVocab + "Final"^^core:ObjectStatusVocab + "Deprecated"^^core:ObjectStatusVocab ) ; - sh:path core:objectStatus ; - ] , - [ + sh:maxCount "1"^^xsd:integer ; sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; - sh:or ( - [ - sh:datatype core:ObjectStatusVocab ; - sh:in ( - "Draft"^^core:ObjectStatusVocab - "Final"^^core:ObjectStatusVocab - "Deprecated"^^core:ObjectStatusVocab - ) ; - ] - [ - sh:datatype xsd:string ; - ] - ) ; + sh:nodeKind sh:Literal ; sh:path core:objectStatus ; ] ; @@ -751,13 +727,7 @@ core:objectStatus a owl:DatatypeProperty ; rdfs:label "Object Status"@en-US ; rdfs:comment "The current state of formality and acceptance for a UCO object ."@en-US ; - rdfs:range [ - a rdfs:Datatype ; - owl:unionOf ( - xsd:string - core:ObjectStatusVocab - ) ; - ] ; + rdfs:range core:ObjectStatusVocab ; . core:referenceURL From f7a0f306976919a27faa9bfa4954eb036991596a Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:16:28 -0400 Subject: [PATCH 09/18] Add tests A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- tests/examples/Makefile | 4 ++++ tests/examples/object_status_PASS.json | 16 ++++++++++++++++ tests/examples/object_status_XFAIL.json | 15 +++++++++++++++ tests/examples/test_validation.py | 18 ++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 tests/examples/object_status_PASS.json create mode 100644 tests/examples/object_status_XFAIL.json diff --git a/tests/examples/Makefile b/tests/examples/Makefile index 66b33e05..552c0b89 100644 --- a/tests/examples/Makefile +++ b/tests/examples/Makefile @@ -41,6 +41,8 @@ all: \ location_XFAIL_validation.ttl \ message_thread_PASS_validation.ttl \ message_thread_XFAIL_validation.ttl \ + object_status_PASS_validation.ttl \ + object_status_XFAIL_validation.ttl \ observable_creation_time_PASS_validation.ttl \ owl_axiom_PASS_validation.ttl \ owl_axiom_XFAIL_validation.ttl \ @@ -116,6 +118,8 @@ check: \ location_XFAIL_validation.ttl \ message_thread_PASS_validation.ttl \ message_thread_XFAIL_validation.ttl \ + object_status_PASS_validation.ttl \ + object_status_XFAIL_validation.ttl \ observable_creation_time_PASS_validation.ttl \ owl_axiom_PASS_validation.ttl \ owl_axiom_XFAIL_validation.ttl \ diff --git a/tests/examples/object_status_PASS.json b/tests/examples/object_status_PASS.json new file mode 100644 index 00000000..2d10dc40 --- /dev/null +++ b/tests/examples/object_status_PASS.json @@ -0,0 +1,16 @@ +{ + "@context": { + "core": "https://ontology.unifiedcyberontology.org/uco/core/", + "kb": "http://example.org/kb/" + }, + "@graph": [ + { + "@id": "kb:UcoObject-f86c567d-374a-4873-b9bc-a746ca2bf360", + "@type": "core:UcoObject", + "core:objectStatus": { + "@type": "core:ObjectStatusVocab", + "@value": "Draft" + } + } + ] +} diff --git a/tests/examples/object_status_XFAIL.json b/tests/examples/object_status_XFAIL.json new file mode 100644 index 00000000..8f8134bd --- /dev/null +++ b/tests/examples/object_status_XFAIL.json @@ -0,0 +1,15 @@ +{ + "@context": { + "core": "https://ontology.unifiedcyberontology.org/uco/core/", + "kb": "http://example.org/kb/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + }, + "@graph": [ + { + "@id": "kb:UcoObject-6ae2b245-a8cd-45dc-9f40-5b2738879351", + "@type": "core:UcoObject", + "rdfs:comment": "This will trigger an error from using a value outside of the required vocabulary.", + "core:objectStatus": "Initial draft" + } + ] +} diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index 6c4fc658..4c1d0c01 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -425,6 +425,24 @@ 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_object_status_PASS() -> None: + confirm_validation_results( + "object_status_PASS_validation.ttl", + True, + ) + +def test_object_status_XFAIL() -> None: + confirm_validation_results( + "object_status_XFAIL_validation.ttl", + False, + expected_focus_node_severities={ + ( + "http://example.org/kb/UcoObject-6ae2b245-a8cd-45dc-9f40-5b2738879351", + str(NS_SH.Violation) + ), + } + ) + def test_observable_creation_time_PASS() -> None: confirm_validation_results( "observable_creation_time_PASS_validation.ttl", From 8e09ce5fbd59dc94924ec4a16755f2243fe87b11 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:16:56 -0400 Subject: [PATCH 10/18] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- .../object_status_PASS_validation.ttl | 11 ++++ .../object_status_XFAIL_validation.ttl | 56 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 tests/examples/object_status_PASS_validation.ttl create mode 100644 tests/examples/object_status_XFAIL_validation.ttl diff --git a/tests/examples/object_status_PASS_validation.ttl b/tests/examples/object_status_PASS_validation.ttl new file mode 100644 index 00000000..33496ff0 --- /dev/null +++ b/tests/examples/object_status_PASS_validation.ttl @@ -0,0 +1,11 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . + +[] + a sh:ValidationReport ; + sh:conforms "true"^^xsd:boolean ; + . + diff --git a/tests/examples/object_status_XFAIL_validation.ttl b/tests/examples/object_status_XFAIL_validation.ttl new file mode 100644 index 00000000..9edea63d --- /dev/null +++ b/tests/examples/object_status_XFAIL_validation.ttl @@ -0,0 +1,56 @@ +@prefix core: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . + +[] + a sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value is not member of the vocabulary ObjectStatusVocab." ; + sh:resultPath core:objectStatus ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape [ + sh:datatype core:ObjectStatusVocab ; + sh:in ( + "Draft"^^core:ObjectStatusVocab + "Final"^^core:ObjectStatusVocab + "Deprecated"^^core:ObjectStatusVocab + ) ; + sh:maxCount "1"^^xsd:integer ; + sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; + sh:nodeKind sh:Literal ; + sh:path core:objectStatus ; + ] ; + sh:value "Initial draft" ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value is not member of the vocabulary ObjectStatusVocab." ; + sh:resultPath core:objectStatus ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:InConstraintComponent ; + sh:sourceShape [ + sh:datatype core:ObjectStatusVocab ; + sh:in ( + "Draft"^^core:ObjectStatusVocab + "Final"^^core:ObjectStatusVocab + "Deprecated"^^core:ObjectStatusVocab + ) ; + sh:maxCount "1"^^xsd:integer ; + sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; + sh:nodeKind sh:Literal ; + sh:path core:objectStatus ; + ] ; + sh:value "Initial draft" ; + ] + ; + . + From 9c826ded368c3406005108e865f06c3491a1119b Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:20:05 -0400 Subject: [PATCH 11/18] Fix typo No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index 045f602e..6ff703ac 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -726,7 +726,7 @@ core:objectMarking core:objectStatus a owl:DatatypeProperty ; rdfs:label "Object Status"@en-US ; - rdfs:comment "The current state of formality and acceptance for a UCO object ."@en-US ; + rdfs:comment "The current state of formality and acceptance for a UCO object."@en-US ; rdfs:range core:ObjectStatusVocab ; . From e9e9e0f9139809e0d94676e93e663450743a7123 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:24:20 -0400 Subject: [PATCH 12/18] Require core:objectStatus only be used on UcoObjects A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 6 ++++++ tests/examples/object_status_XFAIL.json | 11 +++++++++++ tests/examples/test_validation.py | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index 6ff703ac..172e7003 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -730,6 +730,12 @@ core:objectStatus rdfs:range core:ObjectStatusVocab ; . +core:objectStatus-subjects-shape + a sh:NodeShape ; + sh:class core:UcoObject ; + sh:targetSubjectsOf core:objectStatus ; + . + core:referenceURL a owl:DatatypeProperty ; rdfs:label "referenceURL"@en ; diff --git a/tests/examples/object_status_XFAIL.json b/tests/examples/object_status_XFAIL.json index 8f8134bd..b827c238 100644 --- a/tests/examples/object_status_XFAIL.json +++ b/tests/examples/object_status_XFAIL.json @@ -10,6 +10,17 @@ "@type": "core:UcoObject", "rdfs:comment": "This will trigger an error from using a value outside of the required vocabulary.", "core:objectStatus": "Initial draft" + }, + { + "@id": "kb:File-c9c36379-8eca-4a85-887c-b51f7721edfd", + "@type": "observable:File", + "core:hasFacet": { + "@id": "kb:ArchiveFileFacet-5884ca1c-2f5e-4e66-bdc6-7d48606f9fbc", + "@type": "observable:ArchiveFileFacet", + "rdfs:comment": "This will trigger an error from using objectStatus on a non-UcoObject thing.", + "core:objectStatus": "Draft", + "observable:archiveType": "Currently-unknown compressing-and-encrypting type seen multiple places, further research needed" + } } ] } diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index 4c1d0c01..609c1b77 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -440,6 +440,10 @@ def test_object_status_XFAIL() -> None: "http://example.org/kb/UcoObject-6ae2b245-a8cd-45dc-9f40-5b2738879351", str(NS_SH.Violation) ), + ( + "http://example.org/kb/ArchiveFileFacet-5884ca1c-2f5e-4e66-bdc6-7d48606f9fbc", + str(NS_SH.Violation) + ), } ) From ccf355eff06bbb3399a0966345ac9181a2d26eea Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:32:05 -0400 Subject: [PATCH 13/18] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- tests/examples/object_status_XFAIL_validation.ttl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/examples/object_status_XFAIL_validation.ttl b/tests/examples/object_status_XFAIL_validation.ttl index 9edea63d..8eec5ef1 100644 --- a/tests/examples/object_status_XFAIL_validation.ttl +++ b/tests/examples/object_status_XFAIL_validation.ttl @@ -9,6 +9,15 @@ a sh:ValidationReport ; sh:conforms "false"^^xsd:boolean ; sh:result + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class core:UcoObject" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape core:objectStatus-subjects-shape ; + sh:value ; + ] , [ a sh:ValidationResult ; sh:focusNode ; From f54ac1bb93be7e9c402aa5f14d4c246c66e9fe97 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:33:36 -0400 Subject: [PATCH 14/18] Change type of core:objectStatus No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index 172e7003..b0a89017 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -724,7 +724,7 @@ core:objectMarking . core:objectStatus - a owl:DatatypeProperty ; + a owl:AnnotationProperty ; rdfs:label "Object Status"@en-US ; rdfs:comment "The current state of formality and acceptance for a UCO object."@en-US ; rdfs:range core:ObjectStatusVocab ; From 253d3aa848caccd9766e00b9e804a15daa832764 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:34:33 -0400 Subject: [PATCH 15/18] Align label style for core:objectStatus No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index b0a89017..e09a766a 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -725,7 +725,7 @@ core:objectMarking core:objectStatus a owl:AnnotationProperty ; - rdfs:label "Object Status"@en-US ; + rdfs:label "objectStatus"@en ; rdfs:comment "The current state of formality and acceptance for a UCO object."@en-US ; rdfs:range core:ObjectStatusVocab ; . From 3a7b8cc0aa285ba52b1f88d143259417422813eb Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:41:16 -0400 Subject: [PATCH 16/18] Delegate membership error message to SHACL base templating A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 1 - 1 file changed, 1 deletion(-) diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index e09a766a..3ecac152 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -474,7 +474,6 @@ core:UcoObject "Deprecated"^^core:ObjectStatusVocab ) ; sh:maxCount "1"^^xsd:integer ; - sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; sh:nodeKind sh:Literal ; sh:path core:objectStatus ; ] From aa5a536c70d295fb2cfc948870e2172d7adedc0d Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 12 Aug 2024 23:52:14 -0400 Subject: [PATCH 17/18] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- tests/examples/object_status_XFAIL_validation.ttl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/examples/object_status_XFAIL_validation.ttl b/tests/examples/object_status_XFAIL_validation.ttl index 8eec5ef1..23f26131 100644 --- a/tests/examples/object_status_XFAIL_validation.ttl +++ b/tests/examples/object_status_XFAIL_validation.ttl @@ -21,10 +21,10 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage "Value is not member of the vocabulary ObjectStatusVocab." ; + sh:resultMessage "Value Literal(\"Initial draft\") not in list ['Literal(\"Final\" = None, datatype=core:ObjectStatusVocab)', 'Literal(\"Draft\" = None, datatype=core:ObjectStatusVocab)', 'Literal(\"Deprecated\" = None, datatype=core:ObjectStatusVocab)']" ; sh:resultPath core:objectStatus ; sh:resultSeverity sh:Violation ; - sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceConstraintComponent sh:InConstraintComponent ; sh:sourceShape [ sh:datatype core:ObjectStatusVocab ; sh:in ( @@ -33,7 +33,6 @@ "Deprecated"^^core:ObjectStatusVocab ) ; sh:maxCount "1"^^xsd:integer ; - sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; sh:nodeKind sh:Literal ; sh:path core:objectStatus ; ] ; @@ -42,10 +41,10 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage "Value is not member of the vocabulary ObjectStatusVocab." ; + sh:resultMessage "Value is not Literal with datatype core:ObjectStatusVocab" ; sh:resultPath core:objectStatus ; sh:resultSeverity sh:Violation ; - sh:sourceConstraintComponent sh:InConstraintComponent ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; sh:sourceShape [ sh:datatype core:ObjectStatusVocab ; sh:in ( @@ -54,7 +53,6 @@ "Deprecated"^^core:ObjectStatusVocab ) ; sh:maxCount "1"^^xsd:integer ; - sh:message "Value is not member of the vocabulary ObjectStatusVocab." ; sh:nodeKind sh:Literal ; sh:path core:objectStatus ; ] ; From 14e32c26427ee7678d244cb0952325bcca667a81 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 28 Aug 2024 13:51:05 -0400 Subject: [PATCH 18/18] Adjust Make-managed file This patch adjusts the list to match the sort order from core.ttl. References: * https://github.com/ucoProject/UCO/issues/549 Signed-off-by: Alex Nelson --- tests/examples/object_status_XFAIL_validation.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/examples/object_status_XFAIL_validation.ttl b/tests/examples/object_status_XFAIL_validation.ttl index 23f26131..b84dd57b 100644 --- a/tests/examples/object_status_XFAIL_validation.ttl +++ b/tests/examples/object_status_XFAIL_validation.ttl @@ -21,7 +21,7 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage "Value Literal(\"Initial draft\") not in list ['Literal(\"Final\" = None, datatype=core:ObjectStatusVocab)', 'Literal(\"Draft\" = None, datatype=core:ObjectStatusVocab)', 'Literal(\"Deprecated\" = None, datatype=core:ObjectStatusVocab)']" ; + sh:resultMessage "Value Literal(\"Initial draft\") not in list ['Literal(\"Draft\" = None, datatype=core:ObjectStatusVocab)', 'Literal(\"Final\" = None, datatype=core:ObjectStatusVocab)', 'Literal(\"Deprecated\" = None, datatype=core:ObjectStatusVocab)']" ; sh:resultPath core:objectStatus ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:InConstraintComponent ;