From 79261b89cd8ba47f08023ecdb78c38bd04e3c341 Mon Sep 17 00:00:00 2001 From: Benjamin Hendrix Date: Fri, 4 Aug 2023 14:19:21 -0400 Subject: [PATCH 01/38] 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 61600193bdd1c693b9a167aa03e74e2c6e2dcd01 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Thu, 21 Dec 2023 11:16:18 -0500 Subject: [PATCH 02/38] Warn if target or source on an ObservableRelationship are not Observables No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/573 Signed-off-by: Alex Nelson --- ontology/uco/observable/observable.ttl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ontology/uco/observable/observable.ttl b/ontology/uco/observable/observable.ttl index d4fb17ea..7cfa4a4a 100644 --- a/ontology/uco/observable/observable.ttl +++ b/ontology/uco/observable/observable.ttl @@ -5056,6 +5056,20 @@ observable:ObservableRelationship ; rdfs:label "ObservableRelationship"@en ; rdfs:comment "An observable relationship is a grouping of characteristics unique to an assertion of an association between two observable objects."@en ; + sh:property + [ + sh:class observable:Observable ; + sh:message "The source on an ObservableRelationship is expected to be typed as an Observable, and the noted value node is not. This will be an error in UCO 2.0.0."@en ; + sh:path core:source ; + sh:severity sh:Warning ; + ] , + [ + sh:class observable:Observable ; + sh:message "The target on an ObservableRelationship is expected to be typed as an Observable, and the noted value node is not. This will be an error in UCO 2.0.0."@en ; + sh:path core:target ; + sh:severity sh:Warning ; + ] + ; sh:targetClass observable:ObservableRelationship ; . From 084e2cd800e6303c2940fa13ba329103cb52fea1 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Thu, 1 Feb 2024 13:52:40 -0500 Subject: [PATCH 03/38] Replace errant reference to non-existent concept owl:Datatype No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/584 Signed-off-by: Alex Nelson --- ontology/owl/owl.ttl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ontology/owl/owl.ttl b/ontology/owl/owl.ttl index ced847dd..2f5ecc72 100644 --- a/ontology/owl/owl.ttl +++ b/ontology/owl/owl.ttl @@ -149,12 +149,12 @@ uco-owl:Disjointedness-C-DT-shape sh:sparql [ a sh:SPARQLConstraint ; rdfs:seeAlso ; - sh:message "An IRI may not be a member of both an owl:Class and owl:Datatype."@en ; + sh:message "An IRI may not be a member of both an owl:Class and rdfs:Datatype."@en ; sh:select """ PREFIX owl: SELECT $this WHERE { - $this a owl:Datatype ; + $this a rdfs:Datatype ; } """ ; ] ; From e6dba28e95810676e3848b3ae1c6a8a3385ae04d Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Thu, 1 Feb 2024 14:09:22 -0500 Subject: [PATCH 04/38] Warn of prior disjointedness declarations in core: and types: A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/586 Signed-off-by: Alex Nelson --- ontology/uco/core/core.ttl | 11 +++++++++++ ontology/uco/types/types.ttl | 22 ++++++++++++++++++++++ tests/examples/Makefile | 2 ++ tests/examples/disjointedness_PASS.json | 18 ++++++++++++++++++ tests/examples/test_validation.py | 9 +++++++++ 5 files changed, 62 insertions(+) create mode 100644 tests/examples/disjointedness_PASS.json diff --git a/ontology/uco/core/core.ttl b/ontology/uco/core/core.ttl index e061bd54..2764132d 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -378,6 +378,17 @@ core:UcoInherentCharacterizationThing sh:targetClass core:UcoInherentCharacterizationThing ; . +core:UcoInherentCharacterizationThing-disjointWith-UcoObject-shape + a sh:NodeShape ; + sh:message "observable:UcoInherentCharacterizationThing and observable:UcoObject are disjoint classes. Assigning both types to a single node will be an error in UCO 2.0.0."@en ; + sh:not [ + a sh:NodeShape ; + sh:class core:UcoObject ; + ] ; + sh:severity sh:Warning ; + sh:targetClass core:UcoInherentCharacterizationThing ; + . + core:UcoObject a owl:Class , diff --git a/ontology/uco/types/types.ttl b/ontology/uco/types/types.ttl index ad91bedb..0b8ac9c7 100644 --- a/ontology/uco/types/types.ttl +++ b/ontology/uco/types/types.ttl @@ -195,6 +195,17 @@ types:Thread ] ; . +types:Thread-disjointWith-co-List-shape + a sh:NodeShape ; + sh:message "types:Thread and co:List are disjoint classes. Assigning both types to a single node will be an error in UCO 2.0.0."@en ; + sh:not [ + a sh:NodeShape ; + sh:class co:List ; + ] ; + sh:severity sh:Warning ; + sh:targetClass types:Thread ; + . + types:ThreadItem a owl:Class , @@ -213,6 +224,17 @@ types:ThreadItem ] ; . +types:ThreadItem-disjointWith-co-ListItem-shape + a sh:NodeShape ; + sh:message "types:ThreadItem and co:ListItem are disjoint classes. Assigning both types to a single node will be an error in UCO 2.0.0."@en ; + sh:not [ + a sh:NodeShape ; + sh:class co:ListItem ; + ] ; + sh:severity sh:Warning ; + sh:targetClass types:ThreadItem ; + . + types:entry a owl:ObjectProperty ; rdfs:label "entry"@en ; diff --git a/tests/examples/Makefile b/tests/examples/Makefile index 80f59e04..6b36e63b 100644 --- a/tests/examples/Makefile +++ b/tests/examples/Makefile @@ -27,6 +27,7 @@ all: \ configuration_setting_XFAIL_validation.ttl \ database_records_PASS_validation.ttl \ database_records_XFAIL_validation.ttl \ + disjointedness_PASS_validation.ttl \ event_XFAIL_validation.ttl \ file_url_PASS_validation.ttl \ has_facet_inverse_functional_PASS_validation.ttl \ @@ -98,6 +99,7 @@ check: \ configuration_setting_XFAIL_validation.ttl \ database_records_PASS_validation.ttl \ database_records_XFAIL_validation.ttl \ + disjointedness_PASS_validation.ttl \ event_XFAIL_validation.ttl \ file_url_PASS_validation.ttl \ has_facet_inverse_functional_PASS_validation.ttl \ diff --git a/tests/examples/disjointedness_PASS.json b/tests/examples/disjointedness_PASS.json new file mode 100644 index 00000000..227775a6 --- /dev/null +++ b/tests/examples/disjointedness_PASS.json @@ -0,0 +1,18 @@ +{ + "@context": { + "kb": "http://example.org/kb/", + "core": "https://ontology.unifiedcyberontology.org/uco/core/", + "observable": "https://ontology.unifiedcyberontology.org/uco/observable/", + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@graph": [ + { + "@id": "kb:File-33a25932-3a1a-4828-a90f-d31818b495ce", + "@type": [ + "observable:File", + "observable:FileFacet" + ], + "rdfs:comment": "This node will trigger a violation in UCO 2.0.0 for designating itself a File and FileFacet, which are disjoint due to File being a (eventual) subclass of UcoObject, and FileFacet being a (eventual) subclass of UcoInherentCharacterizationThing." + } + ] +} diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index c714d0c3..91807153 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -207,6 +207,15 @@ def test_database_records_XFAIL() -> None: } ) +def test_disjointedness_PASS() -> None: + confirm_validation_results( + "disjointedness_PASS_validation.ttl", + True, + expected_focus_node_severities={ + ("http://example.org/kb/File-33a25932-3a1a-4828-a90f-d31818b495ce", str(NS_SH.Warning)), + } + ) + def test_event_XFAIL() -> None: confirm_validation_results( "event_XFAIL_validation.ttl", From 9460e743b1358e5753de71dbc6d1057954a27723 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Thu, 1 Feb 2024 17:57:37 -0500 Subject: [PATCH 05/38] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/586 Signed-off-by: Alex Nelson --- .../disjointedness_PASS_validation.ttl | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/examples/disjointedness_PASS_validation.ttl diff --git a/tests/examples/disjointedness_PASS_validation.ttl b/tests/examples/disjointedness_PASS_validation.ttl new file mode 100644 index 00000000..c88a7234 --- /dev/null +++ b/tests/examples/disjointedness_PASS_validation.ttl @@ -0,0 +1,21 @@ +@prefix core: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . + +[] + a sh:ValidationReport ; + sh:conforms "true"^^xsd:boolean ; + sh:result [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "observable:UcoInherentCharacterizationThing and observable:UcoObject are disjoint classes. Assigning both types to a single node will be an error in UCO 2.0.0."@en ; + sh:resultSeverity sh:Warning ; + sh:sourceConstraintComponent sh:NotConstraintComponent ; + sh:sourceShape core:UcoInherentCharacterizationThing-disjointWith-UcoObject-shape ; + sh:value ; + ] ; + . + From e0346f3242721fdde9212aa4d14ccb0053ee91ef Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 6 Mar 2024 19:13:18 -0500 Subject: [PATCH 06/38] Remove 1-member minimum on core:ContextualCompilation No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/599 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 e061bd54..ab907fcf 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -121,7 +121,6 @@ core:ContextualCompilation rdfs:comment "A contextual compilation is a grouping of things sharing some context (e.g., a set of network connections observed on a given day, all accounts associated with a given person)."@en ; sh:property [ sh:class core:UcoObject ; - sh:minCount "1"^^xsd:integer ; sh:nodeKind sh:IRI ; sh:path core:object ; ] ; From c349b32b6d8981ea85f985570a81e495db57ea56 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 7 May 2024 14:42:34 -0400 Subject: [PATCH 07/38] Warn about key-uniqueness enforcement to types:Dictionary A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/602 Signed-off-by: Alex Nelson --- ontology/uco/types/types.ttl | 21 ++++++++ tests/examples/Makefile | 2 + tests/examples/dictionary_PASS.json | 83 +++++++++++++++++++++++++++++ tests/examples/test_validation.py | 10 ++++ 4 files changed, 116 insertions(+) create mode 100644 tests/examples/dictionary_PASS.json diff --git a/ontology/uco/types/types.ttl b/ontology/uco/types/types.ttl index ad91bedb..b9f0c450 100644 --- a/ontology/uco/types/types.ttl +++ b/ontology/uco/types/types.ttl @@ -60,6 +60,27 @@ types:Dictionary rdfs:subClassOf core:UcoInherentCharacterizationThing ; rdfs:label "Dictionary"@en ; rdfs:comment "A dictionary is list of (term/key, value) pairs with each term/key existing no more than once."@en ; + rdfs:seeAlso [ + a sh:NodeShape ; + rdfs:comment "This anonymous shape is attached to types:Dictionary with rdfs:seeAlso in order to associate a warning-severity SPARQL-based shape, that will only be necessary as an independent shape until UCO 2.0.0."@en ; + sh:severity sh:Warning ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:targetClass types:Dictionary ; + ] ; sh:property [ sh:class types:DictionaryEntry ; sh:minCount "1"^^xsd:integer ; diff --git a/tests/examples/Makefile b/tests/examples/Makefile index 80f59e04..935b6b44 100644 --- a/tests/examples/Makefile +++ b/tests/examples/Makefile @@ -27,6 +27,7 @@ all: \ configuration_setting_XFAIL_validation.ttl \ database_records_PASS_validation.ttl \ database_records_XFAIL_validation.ttl \ + dictionary_PASS_validation.ttl \ event_XFAIL_validation.ttl \ file_url_PASS_validation.ttl \ has_facet_inverse_functional_PASS_validation.ttl \ @@ -98,6 +99,7 @@ check: \ configuration_setting_XFAIL_validation.ttl \ database_records_PASS_validation.ttl \ database_records_XFAIL_validation.ttl \ + dictionary_PASS_validation.ttl \ event_XFAIL_validation.ttl \ file_url_PASS_validation.ttl \ has_facet_inverse_functional_PASS_validation.ttl \ diff --git a/tests/examples/dictionary_PASS.json b/tests/examples/dictionary_PASS.json new file mode 100644 index 00000000..a137ca8c --- /dev/null +++ b/tests/examples/dictionary_PASS.json @@ -0,0 +1,83 @@ +{ + "@context": { + "kb": "http://example.org/kb/", + "types": "https://ontology.unifiedcyberontology.org/uco/types/" + }, + "@graph": [ + { + "@id": "kb:Dictionary-eaded28e-0bf8-4df1-aee8-84d22c09702c", + "@type": "types:Dictionary", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-314212eb-39c4-4bf3-be3a-f07c38f0eae8" + }, + { + "@id": "kb:DictionaryEntry-9ec24a1a-7e99-41c9-ba7d-9d23f11babb4" + } + ] + }, + { + "@id": "kb:DictionaryEntry-314212eb-39c4-4bf3-be3a-f07c38f0eae8", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-9ec24a1a-7e99-41c9-ba7d-9d23f11babb4", + "@type": "types:DictionaryEntry", + "types:key": "y", + "types:value": "2" + }, + { + "@id": "kb:Dictionary-a8e5e8e1-b3de-4ac4-99dd-e36f96beea4d", + "@type": "types:Dictionary", + "rdfs": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-55786f64-534d-4e8c-8a64-616f708ea4d3" + }, + { + "@id": "kb:DictionaryEntry-d1a83c3d-cbe6-40b0-bb26-3527c47a01d8" + } + ] + }, + { + "@id": "kb:DictionaryEntry-55786f64-534d-4e8c-8a64-616f708ea4d3", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-d1a83c3d-cbe6-40b0-bb26-3527c47a01d8", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "2" + }, + { + "@id": "kb:Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6", + + "@type": "types:Dictionary", + "rdfs": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-20431f00-64a3-4c0f-94a4-1eb09f8a6b6a" + }, + { + "@id": "kb:DictionaryEntry-f187ee7f-12fb-4580-966d-47bf1afd4975" + } + ] + }, + { + "@id": "kb:DictionaryEntry-20431f00-64a3-4c0f-94a4-1eb09f8a6b6a", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-f187ee7f-12fb-4580-966d-47bf1afd4975", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + } + ] +} diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index c714d0c3..dc7bde6d 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -207,6 +207,16 @@ def test_database_records_XFAIL() -> None: } ) +def test_dictionary_PASS() -> None: + confirm_validation_results( + "dictionary_PASS_validation.ttl", + True, + expected_focus_node_severities={ + ("http://example.org/kb/Dictionary-a8e5e8e1-b3de-4ac4-99dd-e36f96beea4d", str(NS_SH.Warning)), + ('http://example.org/kb/Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6', str(NS_SH.Warning)), + } + ) + def test_event_XFAIL() -> None: confirm_validation_results( "event_XFAIL_validation.ttl", From 45d98e93b9a98f8c999dcef76bdc0e626ffcc629 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 7 May 2024 14:51:06 -0400 Subject: [PATCH 08/38] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/602 Signed-off-by: Alex Nelson --- tests/examples/dictionary_PASS_validation.ttl | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 tests/examples/dictionary_PASS_validation.ttl diff --git a/tests/examples/dictionary_PASS_validation.ttl b/tests/examples/dictionary_PASS_validation.ttl new file mode 100644 index 00000000..b00c4ad5 --- /dev/null +++ b/tests/examples/dictionary_PASS_validation.ttl @@ -0,0 +1,102 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix types: . +@prefix xsd: . + +[] + a sh:ValidationReport ; + sh:conforms "true"^^xsd:boolean ; + sh:result + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a dictionary can appear no more than once." ; + sh:resultSeverity sh:Warning ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape [ + a sh:NodeShape ; + rdfs:comment "This anonymous shape is attached to types:Dictionary with rdfs:seeAlso in order to associate a warning-severity SPARQL-based shape, that will only be necessary as an independent shape until UCO 2.0.0."@en ; + sh:severity sh:Warning ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:targetClass types:Dictionary ; + ] ; + sh:value "x" ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a dictionary can appear no more than once." ; + sh:resultSeverity sh:Warning ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape [ + a sh:NodeShape ; + rdfs:comment "This anonymous shape is attached to types:Dictionary with rdfs:seeAlso in order to associate a warning-severity SPARQL-based shape, that will only be necessary as an independent shape until UCO 2.0.0."@en ; + sh:severity sh:Warning ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:targetClass types:Dictionary ; + ] ; + sh:value "x" ; + ] + ; + . + From 13f877bc50071e52357464d9c2478376fa6bd6cc Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 10 May 2024 10:14:55 -0400 Subject: [PATCH 09/38] Warn if an AlternateDataStream instance is not also a FileSystemObject A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/590 Signed-off-by: Alex Nelson --- ontology/uco/observable/observable.ttl | 8 +++++++ tests/examples/Makefile | 2 ++ .../examples/alternate_data_stream_PASS.json | 21 +++++++++++++++++++ tests/examples/test_validation.py | 9 ++++++++ 4 files changed, 40 insertions(+) create mode 100644 tests/examples/alternate_data_stream_PASS.json diff --git a/ontology/uco/observable/observable.ttl b/ontology/uco/observable/observable.ttl index 6f5553b2..37dc84be 100644 --- a/ontology/uco/observable/observable.ttl +++ b/ontology/uco/observable/observable.ttl @@ -239,6 +239,14 @@ observable:AlternateDataStream rdfs:subClassOf observable:ObservableObject ; rdfs:label "AlternateDataStream"@en ; rdfs:comment "An alternate data stream is data content stored within an NTFS file that is independent of the standard content stream of the file and is hidden from access by default NTFS file viewing mechanisms."@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:FileSystemObject ; + sh:message "In UCO 2.0.0, uco-observable:AlternateDataStream will be a subclass of uco-observable:FileSystemObject. In preparation for UCO 2.0.0, the additional type uco-observable:FileSystemObject should be assigned to this node."@en ; + sh:severity sh:Warning ; + sh:targetClass observable:AlternateDataStream ; + ] ; sh:targetClass observable:AlternateDataStream ; . diff --git a/tests/examples/Makefile b/tests/examples/Makefile index 80f59e04..712ba277 100644 --- a/tests/examples/Makefile +++ b/tests/examples/Makefile @@ -21,6 +21,7 @@ all: \ action_inheritance_PASS_validation.ttl \ action_inheritance_XFAIL_validation.ttl \ action_result_PASS_validation.ttl \ + alternate_data_stream_PASS_validation.ttl \ co_PASS_validation.ttl \ co_XFAIL_validation.ttl \ configuration_setting_PASS_validation.ttl \ @@ -92,6 +93,7 @@ check: \ action_inheritance_PASS_validation.ttl \ action_inheritance_XFAIL_validation.ttl \ action_result_PASS_validation.ttl \ + alternate_data_stream_PASS_validation.ttl \ co_PASS_validation.ttl \ co_XFAIL_validation.ttl \ configuration_setting_PASS_validation.ttl \ diff --git a/tests/examples/alternate_data_stream_PASS.json b/tests/examples/alternate_data_stream_PASS.json new file mode 100644 index 00000000..e6abd5bb --- /dev/null +++ b/tests/examples/alternate_data_stream_PASS.json @@ -0,0 +1,21 @@ +{ + "@context": { + "kb": "http://example.org/kb/", + "observable": "https://ontology.unifiedcyberontology.org/uco/observable/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + }, + "@graph": [ + { + "@id": "kb:AlternateDataStream-07b3c41a-080c-4916-8375-c18148763e13", + "@type": "observable:AlternateDataStream", + "rdfs:comment": "This node should trigger a sh:Warning from not being a observable:FileSystemObject" + }, + { + "@id": "kb:AlternateDataStream-b2d4968b-4490-4b44-a56b-832058834454", + "@type": [ + "observable:AlternateDataStream", + "observable:FileSystemObject" + ] + } + ] +} diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index c714d0c3..a2ef1138 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -177,6 +177,15 @@ def test_action_result_PASS_validation() -> None: g = load_validation_graph("action_result_PASS_validation.ttl", True) assert isinstance(g, rdflib.Graph) +def test_alternate_data_stream_PASS_validation() -> None: + confirm_validation_results( + "alternate_data_stream_PASS_validation.ttl", + True, + expected_focus_node_severities={ + ("http://example.org/kb/AlternateDataStream-07b3c41a-080c-4916-8375-c18148763e13", str(NS_SH.Warning)), + } + ) + def test_configuration_setting_PASS_validation() -> None: g = load_validation_graph("configuration_setting_PASS_validation.ttl", True) assert isinstance(g, rdflib.Graph) From 5a40aa46f7ead5290ab180e4b40e9c184bb50c2d Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 10 May 2024 10:15:15 -0400 Subject: [PATCH 10/38] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/590 Signed-off-by: Alex Nelson --- .../alternate_data_stream_PASS_validation.ttl | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/examples/alternate_data_stream_PASS_validation.ttl diff --git a/tests/examples/alternate_data_stream_PASS_validation.ttl b/tests/examples/alternate_data_stream_PASS_validation.ttl new file mode 100644 index 00000000..d13a07eb --- /dev/null +++ b/tests/examples/alternate_data_stream_PASS_validation.ttl @@ -0,0 +1,28 @@ +@prefix observable: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . + +[] + a sh:ValidationReport ; + sh:conforms "true"^^xsd:boolean ; + sh:result [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "In UCO 2.0.0, uco-observable:AlternateDataStream will be a subclass of uco-observable:FileSystemObject. In preparation for UCO 2.0.0, the additional type uco-observable:FileSystemObject should be assigned to this node."@en ; + sh:resultSeverity sh:Warning ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape [ + 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:FileSystemObject ; + sh:message "In UCO 2.0.0, uco-observable:AlternateDataStream will be a subclass of uco-observable:FileSystemObject. In preparation for UCO 2.0.0, the additional type uco-observable:FileSystemObject should be assigned to this node."@en ; + sh:severity sh:Warning ; + sh:targetClass observable:AlternateDataStream ; + ] ; + sh:value ; + ] ; + . + From c63a636a2e7773625375aa9133c491cfd72ebe6f Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 4 Jun 2024 17:56:26 -0400 Subject: [PATCH 11/38] Fix syntax No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- tests/examples/dictionary_PASS.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/examples/dictionary_PASS.json b/tests/examples/dictionary_PASS.json index a137ca8c..f0772dde 100644 --- a/tests/examples/dictionary_PASS.json +++ b/tests/examples/dictionary_PASS.json @@ -1,6 +1,7 @@ { "@context": { "kb": "http://example.org/kb/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "types": "https://ontology.unifiedcyberontology.org/uco/types/" }, "@graph": [ @@ -31,7 +32,7 @@ { "@id": "kb:Dictionary-a8e5e8e1-b3de-4ac4-99dd-e36f96beea4d", "@type": "types:Dictionary", - "rdfs": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", + "rdfs:comment": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", "types:entry": [ { "@id": "kb:DictionaryEntry-55786f64-534d-4e8c-8a64-616f708ea4d3" @@ -57,7 +58,7 @@ "@id": "kb:Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6", "@type": "types:Dictionary", - "rdfs": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", + "rdfs:comment": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", "types:entry": [ { "@id": "kb:DictionaryEntry-20431f00-64a3-4c0f-94a4-1eb09f8a6b6a" From f9d273b3d047099f9717fd0f571d974be8593fe2 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 4 Jun 2024 18:10:06 -0400 Subject: [PATCH 12/38] Inline DictionaryEntry nodes This manual revision is done to reduce IRI repetitions. No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- tests/examples/dictionary_PASS.json | 66 +++++++++++------------------ 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/tests/examples/dictionary_PASS.json b/tests/examples/dictionary_PASS.json index f0772dde..ae34187f 100644 --- a/tests/examples/dictionary_PASS.json +++ b/tests/examples/dictionary_PASS.json @@ -10,50 +10,38 @@ "@type": "types:Dictionary", "types:entry": [ { - "@id": "kb:DictionaryEntry-314212eb-39c4-4bf3-be3a-f07c38f0eae8" + "@id": "kb:DictionaryEntry-314212eb-39c4-4bf3-be3a-f07c38f0eae8", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" }, { - "@id": "kb:DictionaryEntry-9ec24a1a-7e99-41c9-ba7d-9d23f11babb4" + "@id": "kb:DictionaryEntry-9ec24a1a-7e99-41c9-ba7d-9d23f11babb4", + "@type": "types:DictionaryEntry", + "types:key": "y", + "types:value": "2" } ] }, - { - "@id": "kb:DictionaryEntry-314212eb-39c4-4bf3-be3a-f07c38f0eae8", - "@type": "types:DictionaryEntry", - "types:key": "x", - "types:value": "1" - }, - { - "@id": "kb:DictionaryEntry-9ec24a1a-7e99-41c9-ba7d-9d23f11babb4", - "@type": "types:DictionaryEntry", - "types:key": "y", - "types:value": "2" - }, { "@id": "kb:Dictionary-a8e5e8e1-b3de-4ac4-99dd-e36f96beea4d", "@type": "types:Dictionary", "rdfs:comment": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", "types:entry": [ { - "@id": "kb:DictionaryEntry-55786f64-534d-4e8c-8a64-616f708ea4d3" + "@id": "kb:DictionaryEntry-55786f64-534d-4e8c-8a64-616f708ea4d3", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" }, { - "@id": "kb:DictionaryEntry-d1a83c3d-cbe6-40b0-bb26-3527c47a01d8" + "@id": "kb:DictionaryEntry-d1a83c3d-cbe6-40b0-bb26-3527c47a01d8", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "2" } ] }, - { - "@id": "kb:DictionaryEntry-55786f64-534d-4e8c-8a64-616f708ea4d3", - "@type": "types:DictionaryEntry", - "types:key": "x", - "types:value": "1" - }, - { - "@id": "kb:DictionaryEntry-d1a83c3d-cbe6-40b0-bb26-3527c47a01d8", - "@type": "types:DictionaryEntry", - "types:key": "x", - "types:value": "2" - }, { "@id": "kb:Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6", @@ -61,24 +49,18 @@ "rdfs:comment": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", "types:entry": [ { - "@id": "kb:DictionaryEntry-20431f00-64a3-4c0f-94a4-1eb09f8a6b6a" + "@id": "kb:DictionaryEntry-20431f00-64a3-4c0f-94a4-1eb09f8a6b6a", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" }, { - "@id": "kb:DictionaryEntry-f187ee7f-12fb-4580-966d-47bf1afd4975" + "@id": "kb:DictionaryEntry-f187ee7f-12fb-4580-966d-47bf1afd4975", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" } ] - }, - { - "@id": "kb:DictionaryEntry-20431f00-64a3-4c0f-94a4-1eb09f8a6b6a", - "@type": "types:DictionaryEntry", - "types:key": "x", - "types:value": "1" - }, - { - "@id": "kb:DictionaryEntry-f187ee7f-12fb-4580-966d-47bf1afd4975", - "@type": "types:DictionaryEntry", - "types:key": "x", - "types:value": "1" } ] } From 68275962aa26bb8a6d336e5d50c7c40e8715dc21 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 4 Jun 2024 16:17:49 -0400 Subject: [PATCH 13/38] Add and test Improper and Proper Dictionary subclasses and repeatsKey property A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/602 Signed-off-by: Alex Nelson --- ontology/uco/types/types.ttl | 122 ++++++++++++++++++++++----- tests/examples/Makefile | 2 + tests/examples/README.md | 26 ++++++ tests/examples/dictionary_PASS.json | 85 +++++++++++++++++-- tests/examples/dictionary_XFAIL.json | 122 +++++++++++++++++++++++++++ tests/examples/test_validation.py | 18 +++- 6 files changed, 345 insertions(+), 30 deletions(-) create mode 100644 tests/examples/dictionary_XFAIL.json diff --git a/ontology/uco/types/types.ttl b/ontology/uco/types/types.ttl index b9f0c450..9744d75a 100644 --- a/ontology/uco/types/types.ttl +++ b/ontology/uco/types/types.ttl @@ -59,28 +59,7 @@ types:Dictionary ; rdfs:subClassOf core:UcoInherentCharacterizationThing ; rdfs:label "Dictionary"@en ; - rdfs:comment "A dictionary is list of (term/key, value) pairs with each term/key existing no more than once."@en ; - rdfs:seeAlso [ - a sh:NodeShape ; - rdfs:comment "This anonymous shape is attached to types:Dictionary with rdfs:seeAlso in order to associate a warning-severity SPARQL-based shape, that will only be necessary as an independent shape until UCO 2.0.0."@en ; - sh:severity sh:Warning ; - sh:sparql [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { - $this - types:entry/types:key ?value ; - . - } - GROUP BY ?value - HAVING (COUNT(?value) > 1) - """ ; - ] ; - sh:targetClass types:Dictionary ; - ] ; + rdfs:comment "A dictionary is list of (term/key, value) pairs with each term/key having an expectation to exist no more than once. types:Dictionary alone does not validate this expectation, but validation is available. For use cases where this expectation must be validated, the subclass types:ProperDictionary should be used instead of types:Dictionary. For instances where this expectation has been found to be violated, the subclass types:ImproperDictionary should be used instead of types:Dictionary."@en ; sh:property [ sh:class types:DictionaryEntry ; sh:minCount "1"^^xsd:integer ; @@ -90,6 +69,38 @@ types:Dictionary sh:targetClass types:Dictionary ; . +types:Dictionary-keyUniqueness-shape + a sh:NodeShape ; + sh:description "This shape is separated from the types:Dictionary class-shape in order to associate a warning-severity SPARQL-based shape."@en ; + sh:severity sh:Warning ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + FILTER NOT EXISTS { + $this + a types:ImproperDictionary ; + . + } + FILTER NOT EXISTS { + $this + a types:ProperDictionary ; + . + } + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:targetClass types:Dictionary ; + . + types:DictionaryEntry a owl:Class , @@ -188,11 +199,64 @@ types:Identifier rdfs:comment "An identifier is a string conformant to the specified UUID-based format for UCO object identifiers."@en ; . +types:ImproperDictionary + a + owl:Class , + sh:NodeShape + ; + rdfs:subClassOf types:Dictionary ; + rdfs:label "ImproperDictionary"@en ; + owl:disjointWith types:ProperDictionary ; + sh:property [ + sh:datatype xsd:string ; + sh:nodeKind sh:Literal ; + sh:path types:repeatsKey ; + ] ; + sh:targetClass types:ImproperDictionary ; + . + +types:ImproperDictionary-disjointWith-ProperDictionary-shape + a sh:NodeShape ; + sh:message "types:ImproperDictionary and types:ProperDictionary are disjoint classes."@en ; + sh:not [ + a sh:NodeShape ; + sh:class types:ProperDictionary ; + ] ; + sh:targetClass types:ImproperDictionary ; + . + types:NativeFormatString a rdfs:Datatype ; rdfs:comment "Specifies data in its native format of some external language. The data may be encoded in Base64 per [RFC4648]. Data encoded in Base64 must be denoted as such using the encoded property."@en ; . +types:ProperDictionary + a + owl:Class , + sh:NodeShape + ; + rdfs:subClassOf types:Dictionary ; + rdfs:label "ProperDictionary"@en ; + rdfs:comment "A proper dictionary is list of (term/key, value) pairs with each term/key existing no more than once."@en ; + owl:disjointWith types:ImproperDictionary ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "A key in a proper dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:targetClass types:ProperDictionary ; + . + types:StructuredText a rdfs:Datatype ; rdfs:comment "Expresses string-based data in some information structuring format (e.g., HTML5)."@en ; @@ -268,6 +332,20 @@ types:key rdfs:range xsd:string ; . +types:repeatsKey + a owl:DatatypeProperty ; + rdfs:label "repeatsKey"@en ; + rdfs:comment "A key found to be repeated in multiple dictionary entries within one dictionary."@en ; + rdfs:domain types:ImproperDictionary ; + rdfs:range xsd:string ; + . + +types:repeatsKey-subjects-shape + a sh:NodeShape ; + sh:class types:ImproperDictionary ; + sh:targetSubjectsOf types:repeatsKey ; + . + types:threadNextItem a owl:ObjectProperty ; rdfs:subPropertyOf types:threadSuccessor ; diff --git a/tests/examples/Makefile b/tests/examples/Makefile index 935b6b44..5e553202 100644 --- a/tests/examples/Makefile +++ b/tests/examples/Makefile @@ -28,6 +28,7 @@ all: \ database_records_PASS_validation.ttl \ database_records_XFAIL_validation.ttl \ dictionary_PASS_validation.ttl \ + dictionary_XFAIL_validation.ttl \ event_XFAIL_validation.ttl \ file_url_PASS_validation.ttl \ has_facet_inverse_functional_PASS_validation.ttl \ @@ -100,6 +101,7 @@ check: \ database_records_PASS_validation.ttl \ database_records_XFAIL_validation.ttl \ dictionary_PASS_validation.ttl \ + dictionary_XFAIL_validation.ttl \ event_XFAIL_validation.ttl \ file_url_PASS_validation.ttl \ has_facet_inverse_functional_PASS_validation.ttl \ diff --git a/tests/examples/README.md b/tests/examples/README.md index 4b00de91..03abedd1 100644 --- a/tests/examples/README.md +++ b/tests/examples/README.md @@ -9,6 +9,32 @@ Two instance data files are currently in the directory: SHACL validation results are stored in corresponding files named `..._validation.ttl`, to present the current state of validation conditions. +## Design of the Dictionary tests + +The `Dictionary` objects in the `dictionary_*.json` files cover these combinations of asserted type (proper dictionary, improper dictionary, or the generic parent class), whether a dictionary entry key is repeated in the data, and whether the `repeatsKey` property is asserted. (P/X denotes whether the instance is a PASS or XFAIL test case.) + +| uuid | P/X | Dictionary type | Key repeats | repeatsKey asserted | +| --- | --- | --- | --- | --- | +| `3bb38b3e` | P | `Dictionary` | no | no | +| `e6dc9c2e` | X | `Dictionary` | no | yes | +| `e9adf6c1` | P | `Dictionary` | yes | no | +| `34ac0c49` | X | `Dictionary` | yes | yes | +| `cbc1c80d` | P | `ImproperDictionary` | no | no | +| `7fa3ea45` | P | `ImproperDictionary` | no | yes | +| `14e28425` | P | `ImproperDictionary` | yes | no | +| `a8e5e8e1` | P | `ImproperDictionary` | yes | yes | +| `eaded28e` | P | `ProperDictionary` | no | no | +| `8114819f` | X | `ProperDictionary` | no | yes | +| `b2baf8af` | X | `ProperDictionary` | yes | no | +| `f5ae2e6a` | X | `ProperDictionary` | yes | yes | + +Other miscellaneous tests are added without full combinatoric review: + +* `kb:ProperDictionary-f5ae2e6a-9b10-46f3-8441-30aada36aa1b` also demonstrates an XFAIL case where a key-value *pair* is repeated. +* `kb:ImproperDictionary-7fa3ea45-6426-4ad3-bb5f-7559e07adeb4` also demonstrates a PASS case where `repeatsKey`'s value is not in the supplied dictionary. +* `kb:Dictionary-5bc55661-4808-48e6-9e02-80a153eee5d3` demonstrates an XFAIL case where the disjoint `Dictionary` subtypes are both asserted. + + ## Design of the Relationship tests The `Relationship` objects in the `relationship_*.json` files include a numbering scheme in their identifiers, (object class)-(lexical value)-(datatype). These track the following matrix of test cases: diff --git a/tests/examples/dictionary_PASS.json b/tests/examples/dictionary_PASS.json index ae34187f..a81dd866 100644 --- a/tests/examples/dictionary_PASS.json +++ b/tests/examples/dictionary_PASS.json @@ -6,8 +6,26 @@ }, "@graph": [ { - "@id": "kb:Dictionary-eaded28e-0bf8-4df1-aee8-84d22c09702c", + "@id": "kb:Dictionary-3bb38b3e-d47a-43c8-8a77-afc0e6655ce1", "@type": "types:Dictionary", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-b8a01d49-53c1-440f-a2d5-618b58801d37", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-6cac6c2c-5d4e-45f5-b784-c029c9f9fb6d", + "@type": "types:DictionaryEntry", + "types:key": "y", + "types:value": "2" + } + ] + }, + { + "@id": "kb:ProperDictionary-eaded28e-0bf8-4df1-aee8-84d22c09702c", + "@type": "types:ProperDictionary", "types:entry": [ { "@id": "kb:DictionaryEntry-314212eb-39c4-4bf3-be3a-f07c38f0eae8", @@ -24,9 +42,9 @@ ] }, { - "@id": "kb:Dictionary-a8e5e8e1-b3de-4ac4-99dd-e36f96beea4d", - "@type": "types:Dictionary", - "rdfs:comment": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", + "@id": "kb:ImproperDictionary-a8e5e8e1-b3de-4ac4-99dd-e36f96beea4d", + "@type": "types:ImproperDictionary", + "types:repeatsKey": "x", "types:entry": [ { "@id": "kb:DictionaryEntry-55786f64-534d-4e8c-8a64-616f708ea4d3", @@ -44,9 +62,8 @@ }, { "@id": "kb:Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6", - "@type": "types:Dictionary", - "rdfs:comment": "This dictionary will trigger a warning from having two entries keyed with value 'x'.", + "rdfs:comment": "This dictionary, not being typed as a ProperDictionary, will not trigger a warning from having two entries keyed with value 'x'.", "types:entry": [ { "@id": "kb:DictionaryEntry-20431f00-64a3-4c0f-94a4-1eb09f8a6b6a", @@ -61,6 +78,62 @@ "types:value": "1" } ] + }, + { + "@id": "kb:ImproperDictionary-7fa3ea45-6426-4ad3-bb5f-7559e07adeb4", + "@type": "types:ImproperDictionary", + "repeatsKey": "z", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-cf363490-65ba-465f-8459-239c6a5d640e", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-8e71524c-9921-44e8-839d-2d27281941bb", + "@type": "types:DictionaryEntry", + "types:key": "y", + "types:value": "2" + } + ] + }, + { + "@id": "kb:ImproperDictionary-14e28425-00c1-4f11-b2ed-21390fc0749a", + "@type": "types:ImproperDictionary", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-09f23642-389b-4553-b5be-283a6160f534", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-7a84a0d6-d1cd-4291-afb4-c834d611898d", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "2" + } + ] + }, + { + "@id": "kb:ImproperDictionary-cbc1c80d-1bad-4947-8459-c53ff61e8bfa", + "@type": "types:ImproperDictionary", + "rdfs:comment": "This improper dictionary has no repeated key or assertion of a repeated key. This should not trigger a data error, because the information in the graph could merely be incomplete.", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-ca1910ab-fa26-402a-86bb-229f490dd89a", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-2a13e674-5e95-4a7a-9fac-c90417dcd97c", + "@type": "types:DictionaryEntry", + "types:key": "y", + "types:value": "2" + } + ] } ] } diff --git a/tests/examples/dictionary_XFAIL.json b/tests/examples/dictionary_XFAIL.json new file mode 100644 index 00000000..dd2a4567 --- /dev/null +++ b/tests/examples/dictionary_XFAIL.json @@ -0,0 +1,122 @@ +{ + "@context": { + "kb": "http://example.org/kb/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "types": "https://ontology.unifiedcyberontology.org/uco/types/" + }, + "@graph": [ + { + "@id": "kb:Dictionary-5bc55661-4808-48e6-9e02-80a153eee5d3", + "@type": [ + "types:ImproperDictionary", + "types:ProperDictionary" + ], + "rdfs:comment": "This dictionary will trigger an error from being typed as both disjoint subclasses of types:Dictionary.", + "types:entry": { + "@id": "kb:DictionaryEntry-fa139d6e-2b4d-49e5-8c7d-3cfc635d56e0", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + } + }, + { + "@id": "kb:Dictionary-34ac0c49-1042-49c0-8fd6-c42a810e58da", + "@type": "types:Dictionary", + "rdfs:comment": "This dictionary will trigger an error from using repeatsKey while not also typing itself as a types:ImproperDictionary.", + "types:repeatsKey": "x", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-322b718b-3869-48a3-a7bf-d97d5463563b", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-e51c7808-7fcb-423a-95e6-dcb431a3bade", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "2" + } + ] + }, + { + "@id": "kb:ProperDictionary-b2baf8af-3d5d-4c4e-b442-49befefd147e", + "@type": "types:ProperDictionary", + "rdfs:comment": "This dictionary will trigger an error from having two entries keyed with value 'x'.", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-203a8596-1439-4065-a99f-daf4d530bed7", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-40b9d75d-6a11-4a8f-9951-e96e2c1fe683", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "2" + } + ] + }, + { + "@id": "kb:ProperDictionary-8114819f-d3c8-4e29-9e31-295d771f9db2", + "@type": "types:ProperDictionary", + "rdfs:comment": "This proper dictionary will trigger an error from using repeatsKey while not being an ImproperDictionary.", + "types:repeatsKey": "x", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-1311a664-fce3-4174-ace1-539ac6d54a5f", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-8b149881-5adc-4020-b46f-2be1c60bab83", + "@type": "types:DictionaryEntry", + "types:key": "y", + "types:value": "2" + } + ] + }, + { + "@id": "kb:ProperDictionary-f5ae2e6a-9b10-46f3-8441-30aada36aa1b", + "@type": "types:ProperDictionary", + "rdfs:comment": "This dictionary will trigger an error from having two entries keyed with value 'x'.", + "types:repeatsKey": "x", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-0274c19c-89b9-42b6-a87e-f671cbd2c731", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-de108ec2-8ddd-4201-8267-5a04035ba88e", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + } + ] + }, + { + "@id": "kb:Dictionary-e6dc9c2e-25bc-422f-8ae8-8457e29f5fde", + "@type": "types:Dictionary", + "rdfs:comment": "This dictionary will trigger an error from using repeatsKey while not also typing itself as a types:ImproperDictionary.", + "types:repeatsKey": "x", + "types:entry": [ + { + "@id": "kb:DictionaryEntry-02edb446-1ad5-41ef-8877-fbee912189e7", + "@type": "types:DictionaryEntry", + "types:key": "x", + "types:value": "1" + }, + { + "@id": "kb:DictionaryEntry-147908bb-ebba-42e8-854d-72352dc903a1", + "@type": "types:DictionaryEntry", + "types:key": "y", + "types:value": "2" + } + ] + } + ] +} diff --git a/tests/examples/test_validation.py b/tests/examples/test_validation.py index dc7bde6d..9b2bcbbe 100644 --- a/tests/examples/test_validation.py +++ b/tests/examples/test_validation.py @@ -212,8 +212,22 @@ def test_dictionary_PASS() -> None: "dictionary_PASS_validation.ttl", True, expected_focus_node_severities={ - ("http://example.org/kb/Dictionary-a8e5e8e1-b3de-4ac4-99dd-e36f96beea4d", str(NS_SH.Warning)), - ('http://example.org/kb/Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6', str(NS_SH.Warning)), + ("http://example.org/kb/Dictionary-e9adf6c1-0287-4290-95a9-c94a128d7ff6", str(NS_SH.Warning)), + } + ) + +def test_dictionary_XFAIL() -> None: + confirm_validation_results( + "dictionary_XFAIL_validation.ttl", + False, + expected_focus_node_severities={ + ("http://example.org/kb/Dictionary-5bc55661-4808-48e6-9e02-80a153eee5d3", str(NS_SH.Violation)), + ("http://example.org/kb/Dictionary-e6dc9c2e-25bc-422f-8ae8-8457e29f5fde", str(NS_SH.Violation)), + ("http://example.org/kb/Dictionary-34ac0c49-1042-49c0-8fd6-c42a810e58da", str(NS_SH.Warning)), + ("http://example.org/kb/Dictionary-34ac0c49-1042-49c0-8fd6-c42a810e58da", str(NS_SH.Violation)), + ("http://example.org/kb/ProperDictionary-8114819f-d3c8-4e29-9e31-295d771f9db2", str(NS_SH.Violation)), + ("http://example.org/kb/ProperDictionary-b2baf8af-3d5d-4c4e-b442-49befefd147e", str(NS_SH.Violation)), + ("http://example.org/kb/ProperDictionary-f5ae2e6a-9b10-46f3-8441-30aada36aa1b", str(NS_SH.Violation)), } ) From 1e6d1af1063f3fd12eee421d85b08a8d066cb226 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 4 Jun 2024 17:48:05 -0400 Subject: [PATCH 14/38] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/602 Signed-off-by: Alex Nelson --- tests/examples/dictionary_PASS_validation.ttl | 110 ++++---------- .../examples/dictionary_XFAIL_validation.ttl | 141 ++++++++++++++++++ 2 files changed, 168 insertions(+), 83 deletions(-) create mode 100644 tests/examples/dictionary_XFAIL_validation.ttl diff --git a/tests/examples/dictionary_PASS_validation.ttl b/tests/examples/dictionary_PASS_validation.ttl index b00c4ad5..f563abc0 100644 --- a/tests/examples/dictionary_PASS_validation.ttl +++ b/tests/examples/dictionary_PASS_validation.ttl @@ -8,95 +8,39 @@ [] a sh:ValidationReport ; sh:conforms "true"^^xsd:boolean ; - sh:result - [ - a sh:ValidationResult ; - sh:focusNode ; - sh:resultMessage "A key in a dictionary can appear no more than once." ; - sh:resultSeverity sh:Warning ; - sh:sourceConstraint [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { + sh:result [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property." ; + sh:resultSeverity sh:Warning ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + FILTER NOT EXISTS { $this - types:entry/types:key ?value ; + a types:ImproperDictionary ; . } - GROUP BY ?value - HAVING (COUNT(?value) > 1) - """ ; - ] ; - sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; - sh:sourceShape [ - a sh:NodeShape ; - rdfs:comment "This anonymous shape is attached to types:Dictionary with rdfs:seeAlso in order to associate a warning-severity SPARQL-based shape, that will only be necessary as an independent shape until UCO 2.0.0."@en ; - sh:severity sh:Warning ; - sh:sparql [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { - $this - types:entry/types:key ?value ; - . - } - GROUP BY ?value - HAVING (COUNT(?value) > 1) - """ ; - ] ; - sh:targetClass types:Dictionary ; - ] ; - sh:value "x" ; - ] , - [ - a sh:ValidationResult ; - sh:focusNode ; - sh:resultMessage "A key in a dictionary can appear no more than once." ; - sh:resultSeverity sh:Warning ; - sh:sourceConstraint [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { - $this - types:entry/types:key ?value ; - . - } - GROUP BY ?value - HAVING (COUNT(?value) > 1) - """ ; - ] ; - sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; - sh:sourceShape [ - a sh:NodeShape ; - rdfs:comment "This anonymous shape is attached to types:Dictionary with rdfs:seeAlso in order to associate a warning-severity SPARQL-based shape, that will only be necessary as an independent shape until UCO 2.0.0."@en ; - sh:severity sh:Warning ; - sh:sparql [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { + FILTER NOT EXISTS { $this - types:entry/types:key ?value ; + a types:ProperDictionary ; . } - GROUP BY ?value - HAVING (COUNT(?value) > 1) + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) """ ; - ] ; - sh:targetClass types:Dictionary ; - ] ; - sh:value "x" ; - ] - ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape types:Dictionary-keyUniqueness-shape ; + sh:value "x" ; + ] ; . diff --git a/tests/examples/dictionary_XFAIL_validation.ttl b/tests/examples/dictionary_XFAIL_validation.ttl new file mode 100644 index 00000000..f15a7580 --- /dev/null +++ b/tests/examples/dictionary_XFAIL_validation.ttl @@ -0,0 +1,141 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix types: . +@prefix xsd: . + +[] + a sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property." ; + sh:resultSeverity sh:Warning ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + FILTER NOT EXISTS { + $this + a types:ImproperDictionary ; + . + } + FILTER NOT EXISTS { + $this + a types:ProperDictionary ; + . + } + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape types:Dictionary-keyUniqueness-shape ; + sh:value "x" ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class types:ImproperDictionary" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape types:repeatsKey-subjects-shape ; + sh:value ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "types:ImproperDictionary and types:ProperDictionary are disjoint classes."@en ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:NotConstraintComponent ; + sh:sourceShape types:ImproperDictionary-disjointWith-ProperDictionary-shape ; + sh:value ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class types:ImproperDictionary" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape types:repeatsKey-subjects-shape ; + sh:value ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class types:ImproperDictionary" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape types:repeatsKey-subjects-shape ; + sh:value ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a proper dictionary can appear no more than once." ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a proper dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape types:ProperDictionary ; + sh:value "x" ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a proper dictionary can appear no more than once." ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a proper dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape types:ProperDictionary ; + sh:value "x" ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class types:ImproperDictionary" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape types:repeatsKey-subjects-shape ; + sh:value ; + ] + ; + . + From 6d4b8502053996f3354677d9d6e2c8aa238e9879 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 4 Jun 2024 17:00:14 -0400 Subject: [PATCH 15/38] Remove requirement that a Dictionary must have at least one entry This has analagous rationale to UCO Issue 599, as well as supporting the data-sharing use case where a dictionary key repetition is wished to be shared without sharing other members of the dictionary. No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/599 * https://github.com/ucoProject/UCO/issues/602 Signed-off-by: Alex Nelson --- ontology/uco/types/types.ttl | 1 - tests/examples/dictionary_PASS.json | 16 +--------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/ontology/uco/types/types.ttl b/ontology/uco/types/types.ttl index 9744d75a..4e7e9f5f 100644 --- a/ontology/uco/types/types.ttl +++ b/ontology/uco/types/types.ttl @@ -62,7 +62,6 @@ types:Dictionary rdfs:comment "A dictionary is list of (term/key, value) pairs with each term/key having an expectation to exist no more than once. types:Dictionary alone does not validate this expectation, but validation is available. For use cases where this expectation must be validated, the subclass types:ProperDictionary should be used instead of types:Dictionary. For instances where this expectation has been found to be violated, the subclass types:ImproperDictionary should be used instead of types:Dictionary."@en ; sh:property [ sh:class types:DictionaryEntry ; - sh:minCount "1"^^xsd:integer ; sh:nodeKind sh:IRI ; sh:path types:entry ; ] ; diff --git a/tests/examples/dictionary_PASS.json b/tests/examples/dictionary_PASS.json index a81dd866..31e1aab8 100644 --- a/tests/examples/dictionary_PASS.json +++ b/tests/examples/dictionary_PASS.json @@ -82,21 +82,7 @@ { "@id": "kb:ImproperDictionary-7fa3ea45-6426-4ad3-bb5f-7559e07adeb4", "@type": "types:ImproperDictionary", - "repeatsKey": "z", - "types:entry": [ - { - "@id": "kb:DictionaryEntry-cf363490-65ba-465f-8459-239c6a5d640e", - "@type": "types:DictionaryEntry", - "types:key": "x", - "types:value": "1" - }, - { - "@id": "kb:DictionaryEntry-8e71524c-9921-44e8-839d-2d27281941bb", - "@type": "types:DictionaryEntry", - "types:key": "y", - "types:value": "2" - } - ] + "repeatsKey": "z" }, { "@id": "kb:ImproperDictionary-14e28425-00c1-4f11-b2ed-21390fc0749a", From 79de6094ba9d63b379b02c18893d2a2802686267 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 14 Jun 2024 08:43:48 -0400 Subject: [PATCH 16/38] Fix typo A follow-on patch will regenerate Make-managed files. References: * https://github.com/ucoProject/UCO/issues/586 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 e4bf1777..8bd191fb 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -379,7 +379,7 @@ core:UcoInherentCharacterizationThing core:UcoInherentCharacterizationThing-disjointWith-UcoObject-shape a sh:NodeShape ; - sh:message "observable:UcoInherentCharacterizationThing and observable:UcoObject are disjoint classes. Assigning both types to a single node will be an error in UCO 2.0.0."@en ; + sh:message "core:UcoInherentCharacterizationThing and core:UcoObject are disjoint classes. Assigning both types to a single node will be an error in UCO 2.0.0."@en ; sh:not [ a sh:NodeShape ; sh:class core:UcoObject ; From 845b8197a80ca4f1db1d0ef656872a74f906e7c4 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 14 Jun 2024 08:52:45 -0400 Subject: [PATCH 17/38] Regenerate Make-managed files References: * https://github.com/ucoProject/UCO/issues/586 Signed-off-by: Alex Nelson --- tests/examples/disjointedness_PASS_validation.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/examples/disjointedness_PASS_validation.ttl b/tests/examples/disjointedness_PASS_validation.ttl index c88a7234..02ba4683 100644 --- a/tests/examples/disjointedness_PASS_validation.ttl +++ b/tests/examples/disjointedness_PASS_validation.ttl @@ -11,7 +11,7 @@ sh:result [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage "observable:UcoInherentCharacterizationThing and observable:UcoObject are disjoint classes. Assigning both types to a single node will be an error in UCO 2.0.0."@en ; + sh:resultMessage "core:UcoInherentCharacterizationThing and core:UcoObject are disjoint classes. Assigning both types to a single node will be an error in UCO 2.0.0."@en ; sh:resultSeverity sh:Warning ; sh:sourceConstraintComponent sh:NotConstraintComponent ; sh:sourceShape core:UcoInherentCharacterizationThing-disjointWith-UcoObject-shape ; From 03a3d3c38ee924d8bb1b0e2c2c98c9f4f7401cf3 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 26 Jul 2024 10:05:42 -0400 Subject: [PATCH 18/38] 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 19/38] 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 20/38] 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 21/38] 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 22/38] 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 23/38] 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 becf55e731f6099c704cf77e06839dff83e78a02 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 9 Aug 2024 14:07:57 -0400 Subject: [PATCH 24/38] Remove owl:onDatatype from vocabulary definitions References: * https://github.com/ucoProject/UCO/issues/593 Signed-off-by: Alex Nelson --- ontology/uco/vocabulary/vocabulary.ttl | 44 -------------------------- 1 file changed, 44 deletions(-) diff --git a/ontology/uco/vocabulary/vocabulary.ttl b/ontology/uco/vocabulary/vocabulary.ttl index d13c89e7..2e013aa7 100644 --- a/ontology/uco/vocabulary/vocabulary.ttl +++ b/ontology/uco/vocabulary/vocabulary.ttl @@ -17,7 +17,6 @@ vocabulary:AccountTypeVocab rdfs:label "Account Type Vocabulary"@en-US ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "ldap"^^vocabulary:AccountTypeVocab "nis"^^vocabulary:AccountTypeVocab @@ -37,7 +36,6 @@ vocabulary:ActionArgumentNameVocab rdfs:comment "Defines an open-vocabulary for common arguments of cyber actions."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "APC Address"^^vocabulary:ActionArgumentNameVocab "APC Mode"^^vocabulary:ActionArgumentNameVocab @@ -100,7 +98,6 @@ vocabulary:ActionNameVocab rdfs:comment "Defines an open-vocabulary of common specific cyber action names."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Accept Socket Connection"^^vocabulary:ActionNameVocab "Add Connection to Network Share"^^vocabulary:ActionNameVocab @@ -293,7 +290,6 @@ vocabulary:ActionRelationshipTypeVocab rdfs:comment "Defines an open-vocabulary for capturing types of relationships between actions."@en-US ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Dependent_On"^^vocabulary:ActionRelationshipTypeVocab "Equivalent_To"^^vocabulary:ActionRelationshipTypeVocab @@ -312,7 +308,6 @@ vocabulary:ActionStatusTypeVocab rdfs:comment "Defines an open-vocabulary of action status types."@en-US ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Complete/Finish"^^vocabulary:ActionStatusTypeVocab "Error"^^vocabulary:ActionStatusTypeVocab @@ -331,7 +326,6 @@ vocabulary:ActionTypeVocab rdfs:comment "Defines an open-vocabulary of common general action types."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Accept"^^vocabulary:ActionTypeVocab "Access"^^vocabulary:ActionTypeVocab @@ -454,7 +448,6 @@ vocabulary:BitnessVocab rdfs:comment "Defines an open-vocabulary of word sizes that define classes of operating systems."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "32"^^vocabulary:BitnessVocab "64"^^vocabulary:BitnessVocab @@ -468,7 +461,6 @@ vocabulary:CharacterEncodingVocab rdfs:comment "Defines an open-vocabulary of character encodings."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "ASCII"^^vocabulary:CharacterEncodingVocab "UTF-16"^^vocabulary:CharacterEncodingVocab @@ -493,7 +485,6 @@ vocabulary:ContactAddressScopeVocab rdfs:comment "Defines an open-vocabulary of scopes for address entries of digital contacts."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "home"^^vocabulary:ContactAddressScopeVocab "work"^^vocabulary:ContactAddressScopeVocab @@ -508,7 +499,6 @@ vocabulary:ContactEmailScopeVocab rdfs:comment "Defines an open-vocabulary of scopes for email entries of digital contacts."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "home"^^vocabulary:ContactEmailScopeVocab "work"^^vocabulary:ContactEmailScopeVocab @@ -524,7 +514,6 @@ vocabulary:ContactPhoneScopeVocab rdfs:comment "Defines an open-vocabulary of scopes for phone entries of digital contacts."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "home"^^vocabulary:ContactPhoneScopeVocab "work"^^vocabulary:ContactPhoneScopeVocab @@ -544,7 +533,6 @@ vocabulary:ContactSIPScopeVocab rdfs:comment "Defines an open-vocabulary of scopes for Session Initiation Protocol (SIP) entries of digital contacts."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "home"^^vocabulary:ContactSIPScopeVocab "work"^^vocabulary:ContactSIPScopeVocab @@ -559,7 +547,6 @@ vocabulary:ContactURLScopeVocab rdfs:comment "Defines an open-vocabulary of scopes for URL entries of digital contacts."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "home"^^vocabulary:ContactURLScopeVocab "work"^^vocabulary:ContactURLScopeVocab @@ -575,7 +562,6 @@ vocabulary:DiskTypeVocab rdfs:comment "Defines an open-vocabulary of disk types."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "CDRom"^^vocabulary:DiskTypeVocab "Fixed"^^vocabulary:DiskTypeVocab @@ -592,7 +578,6 @@ vocabulary:EndiannessTypeVocab rdfs:comment "Defines an open-vocabulary of byte ordering methods."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Big-endian"^^vocabulary:EndiannessTypeVocab "Little-endian"^^vocabulary:EndiannessTypeVocab @@ -607,7 +592,6 @@ vocabulary:HashNameVocab rdfs:comment "Defines an open-vocabulary of hashing algorithm names."@en-US ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "MD5"^^vocabulary:HashNameVocab "MD6"^^vocabulary:HashNameVocab @@ -631,7 +615,6 @@ vocabulary:LibraryTypeVocab rdfs:comment "Defines an open-vocabulary of library types."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Dynamic"^^vocabulary:LibraryTypeVocab "Other"^^vocabulary:LibraryTypeVocab @@ -648,7 +631,6 @@ vocabulary:MemoryBlockTypeVocab rdfs:comment "Defines an open-vocabulary of types of memory blocks."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Bit-mapped"^^vocabulary:MemoryBlockTypeVocab "Byte-mapped"^^vocabulary:MemoryBlockTypeVocab @@ -665,7 +647,6 @@ vocabulary:ObservableObjectRelationshipVocab rdfs:comment "Defines an open-vocabulary of inter-observable object relationships."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Allocated"^^vocabulary:ObservableObjectRelationshipVocab "Allocated_By"^^vocabulary:ObservableObjectRelationshipVocab @@ -816,7 +797,6 @@ vocabulary:ObservableObjectStateVocab rdfs:comment "Defines an open-vocabulary of observable object states."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Active"^^vocabulary:ObservableObjectStateVocab "Closed"^^vocabulary:ObservableObjectStateVocab @@ -838,7 +818,6 @@ vocabulary:PartitionTypeVocab rdfs:comment "Defines an open-vocabulary of partition types. See http://www.win.tue.nl/~aeb/partitions/partition_types-1.html for more information about the various partition types."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "PARTITION_ENTRY_UNUSED"^^vocabulary:PartitionTypeVocab "PARTITION_EXTENDED"^^vocabulary:PartitionTypeVocab @@ -869,7 +848,6 @@ vocabulary:ProcessorArchVocab rdfs:comment "Defines an open-vocabulary of computer processor architectures."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "ARM"^^vocabulary:ProcessorArchVocab "Alpha"^^vocabulary:ProcessorArchVocab @@ -893,7 +871,6 @@ vocabulary:RecoveredObjectStatusVocab rdfs:comment "Defines the vocabulary for Recovered Object status of data."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "recovered"^^vocabulary:RecoveredObjectStatusVocab "partially recovered"^^vocabulary:RecoveredObjectStatusVocab @@ -909,7 +886,6 @@ vocabulary:RegionalRegistryTypeVocab rdfs:comment "Defines an open-vocabulary of Regional Internet Registries (RIRs) names, represented via their respective acronyms."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "APNIC"^^vocabulary:RegionalRegistryTypeVocab "ARIN"^^vocabulary:RegionalRegistryTypeVocab @@ -925,7 +901,6 @@ vocabulary:RegistryDatatypeVocab rdfs:label "Registry Datatype Vocabulary"@en-US ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "reg_binary"^^vocabulary:RegistryDatatypeVocab "reg_dword"^^vocabulary:RegistryDatatypeVocab @@ -950,7 +925,6 @@ vocabulary:SIMFormVocab rdfs:comment "Defines an open-vocabulary of common SIM card form factors."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Full-size SIM"^^vocabulary:SIMFormVocab "Micro SIM"^^vocabulary:SIMFormVocab @@ -965,7 +939,6 @@ vocabulary:SIMTypeVocab rdfs:comment "Defines an open-vocabulary of common SIM card types."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "SIM"^^vocabulary:SIMTypeVocab "UICC"^^vocabulary:SIMTypeVocab @@ -980,7 +953,6 @@ vocabulary:TaskActionTypeVocab rdfs:comment "Defines an open-vocabulary of task action types. See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa380596(v=vs.85).aspx."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "TASK_ACTION_COM_HANDLER"^^vocabulary:TaskActionTypeVocab "TASK_ACTION_EXEC"^^vocabulary:TaskActionTypeVocab @@ -996,7 +968,6 @@ vocabulary:TaskFlagVocab rdfs:comment "Defines an open-vocabulary of the run flags for a task scheduler task. See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa381283(v=vs.85).aspx See Also: http://msdn.microsoft.com/en-us/library/microsoft.office.excel.server.addins.computecluster.taskscheduler.taskflags(v=office.12).aspx."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "TASK_FLAG_DELETE_WHEN_DONE"^^vocabulary:TaskFlagVocab "TASK_FLAG_DISABLED"^^vocabulary:TaskFlagVocab @@ -1021,7 +992,6 @@ vocabulary:TaskPriorityVocab rdfs:comment "Defines an open-vocabulary of the priority levels of task scheduler tasks. See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383512(v=vs.85).aspx."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "ABOVE_NORMAL_PRIORITY_CLASS"^^vocabulary:TaskPriorityVocab "BELOW_NORMAL_PRIORITY_CLASS"^^vocabulary:TaskPriorityVocab @@ -1039,7 +1009,6 @@ vocabulary:TaskStatusVocab rdfs:comment "Defines an open-vocabulary of the possible statuses of a scheduled task. See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383604(v=vs.85).aspx See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa381263(v=vs.85).aspx See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa381833(v=vs.85).aspx See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383617(v=vs.85).aspx."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "SCHED_E_ACCOUNT_DBASE_CORRUPT"^^vocabulary:TaskStatusVocab "SCHED_E_ACCOUNT_INFORMATION_NOT_SET"^^vocabulary:TaskStatusVocab @@ -1075,7 +1044,6 @@ vocabulary:ThreadRunningStatusVocab rdfs:comment "Defines an open-vocabulary of the various states that a thread may be in before, during, or after execution. See http://msdn.microsoft.com/en-us/library/system.diagnostics.threadstate(v=vs.110).aspx."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Initialized"^^vocabulary:ThreadRunningStatusVocab "Ready"^^vocabulary:ThreadRunningStatusVocab @@ -1095,7 +1063,6 @@ vocabulary:TimestampPrecisionVocab rdfs:comment "Defines an open-vocabulary of timestamp precision granularities."@en-US ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "day"^^vocabulary:TimestampPrecisionVocab "hour"^^vocabulary:TimestampPrecisionVocab @@ -1113,7 +1080,6 @@ vocabulary:TrendVocab rdfs:comment "Defines an open-vocabulary of trend values."@en-US ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Decreasing"^^vocabulary:TrendVocab "Increasing"^^vocabulary:TrendVocab @@ -1127,7 +1093,6 @@ vocabulary:TriggerFrequencyVocab rdfs:comment "Defines an open-vocabulary of the frequency types that a trigger may use. See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383620(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/aa383987(v=vs.85).aspx."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "TASK_EVENT_TRIGGER_AT_LOGON"^^vocabulary:TriggerFrequencyVocab "TASK_EVENT_TRIGGER_AT_SYSTEMSTART"^^vocabulary:TriggerFrequencyVocab @@ -1147,7 +1112,6 @@ vocabulary:TriggerTypeVocab rdfs:comment "Defines an open-vocabulary of the types of triggers associated with a task."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "TASK_TRIGGER_BOOT"^^vocabulary:TriggerTypeVocab "TASK_TRIGGER_EVENT"^^vocabulary:TriggerTypeVocab @@ -1166,7 +1130,6 @@ vocabulary:URLTransitionTypeVocab rdfs:comment "Defines an open-vocabulary of types of URL transitions."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "link"^^vocabulary:URLTransitionTypeVocab "typed"^^vocabulary:URLTransitionTypeVocab @@ -1189,7 +1152,6 @@ vocabulary:UnixProcessStateVocab rdfs:comment "Defines an open-vocabulary of Unix process states"@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Dead"^^vocabulary:UnixProcessStateVocab "InterruptibleSleep"^^vocabulary:UnixProcessStateVocab @@ -1208,7 +1170,6 @@ vocabulary:WhoisContactTypeVocab rdfs:comment "Defines an open-vocabulary of types of registrar contacts listed in a whois entry."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "ADMIN"^^vocabulary:WhoisContactTypeVocab "BILLING"^^vocabulary:WhoisContactTypeVocab @@ -1223,7 +1184,6 @@ vocabulary:WhoisDNSSECTypeVocab rdfs:comment "Defines an open-vocabulary of acceptable values for the DNSSEC field in a Whois entry."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Signed"^^vocabulary:WhoisDNSSECTypeVocab "Unsigned"^^vocabulary:WhoisDNSSECTypeVocab @@ -1237,7 +1197,6 @@ vocabulary:WhoisStatusTypeVocab rdfs:comment "Defines an open-vocabulary of all valid statuses for a domain within a whois entry."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "ADD_PERIOD"^^vocabulary:WhoisStatusTypeVocab "AUTO_RENEW_PERIOD"^^vocabulary:WhoisStatusTypeVocab @@ -1268,7 +1227,6 @@ vocabulary:WindowsDriveTypeVocab rdfs:comment "Defines an open-vocabulary of possible drive types, as enumerated by the WINAPI GetDriveType function: http://msdn.microsoft.com/en-us/library/windows/desktop/aa364939(v=vs.85).aspx."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "DRIVE_CDROM"^^vocabulary:WindowsDriveTypeVocab "DRIVE_FIXED"^^vocabulary:WindowsDriveTypeVocab @@ -1287,7 +1245,6 @@ vocabulary:WindowsVolumeAttributeVocab rdfs:comment "Defines an open-vocabulary of attributes that may be returned by the diskpart attributes command: http://technet.microsoft.com/en-us/library/cc766465(v=ws.10).aspx."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Hidden"^^vocabulary:WindowsVolumeAttributeVocab "NoDefaultDriveLetter"^^vocabulary:WindowsVolumeAttributeVocab @@ -1303,7 +1260,6 @@ vocabulary:WirelessNetworkSecurityModeVocab rdfs:comment "Defines an open-vocabulary of security modes that may be configured for wireless network connections."@en ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "None"^^vocabulary:WirelessNetworkSecurityModeVocab "WEP"^^vocabulary:WirelessNetworkSecurityModeVocab From a7c7814fdbc68694d42a507cc35318dc9803b346 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 9 Aug 2024 11:56:33 -0400 Subject: [PATCH 25/38] 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 26/38] 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 27/38] 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 28/38] 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 29/38] 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 30/38] 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 31/38] 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 32/38] 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 33/38] 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 34/38] 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 35/38] 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 ; From 3f0f71355c97f1dd85a17b4a17b5ff50f8a19a93 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 4 Oct 2024 08:34:35 -0400 Subject: [PATCH 36/38] Remove owl:onDatatype from new vocabulary definition References: * https://github.com/ucoProject/UCO/issues/549 * https://github.com/ucoProject/UCO/issues/593 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 3ecac152..a9010464 100644 --- a/ontology/uco/core/core.ttl +++ b/ontology/uco/core/core.ttl @@ -322,7 +322,6 @@ core:ObjectStatusVocab rdfs:label "Object Status Vocabulary"@en-US ; owl:equivalentClass [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; owl:oneOf ( "Draft"^^core:ObjectStatusVocab "Final"^^core:ObjectStatusVocab From 688d9437dc331f0b1b389852931febb63a11caa8 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 25 Oct 2024 16:35:43 -0400 Subject: [PATCH 37/38] Regenerate Make-managed files Signed-off-by: Alex Nelson --- tests/examples/co_XFAIL_validation.ttl | 2 +- tests/examples/configuration_setting_XFAIL_validation.ttl | 2 +- tests/examples/database_records_XFAIL_validation.ttl | 4 ++-- tests/examples/hash_XFAIL_validation.ttl | 2 +- tests/examples/object_status_XFAIL_validation.ttl | 2 +- tests/examples/rdf_list_XFAIL_validation.ttl | 6 +++--- tests/examples/thread_XFAIL_validation.ttl | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/examples/co_XFAIL_validation.ttl b/tests/examples/co_XFAIL_validation.ttl index e243322f..9888889d 100644 --- a/tests/examples/co_XFAIL_validation.ttl +++ b/tests/examples/co_XFAIL_validation.ttl @@ -78,7 +78,7 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage 'Node kb:list-item-4361eb9c-a1c2-40e7-ba83-92802554392a conforms to shape [ rdf:type sh:PropertyShape ; sh:class co:Item ; sh:description Literal("This shape encodes in SHACL that the range of co:itemContent is the complement of co:Item.", lang=en) ; sh:path co:itemContent ]' ; + sh:resultMessage 'Node kb:list-item-4361eb9c-a1c2-40e7-ba83-92802554392a must not conform to shape [ rdf:type sh:PropertyShape ; sh:class co:Item ; sh:description Literal("This shape encodes in SHACL that the range of co:itemContent is the complement of co:Item.", lang=en) ; sh:path co:itemContent ]' ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:NotConstraintComponent ; sh:sourceShape uco-co:itemContent-subjects-shape ; diff --git a/tests/examples/configuration_setting_XFAIL_validation.ttl b/tests/examples/configuration_setting_XFAIL_validation.ttl index fdd76c5b..866e84ae 100644 --- a/tests/examples/configuration_setting_XFAIL_validation.ttl +++ b/tests/examples/configuration_setting_XFAIL_validation.ttl @@ -13,7 +13,7 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage 'Node kb:configuration-entry-5f0fc3ea-e763-4b6d-997a-be0d1ceffc8c does not conform to exactly one shape in [ sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path configuration:itemObject ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path configuration:itemValue ] ] , [ sh:property [ sh:minCount Literal("1", datatype=xsd:integer) ; sh:path configuration:itemObject ] ] , [ sh:property [ sh:minCount Literal("1", datatype=xsd:integer) ; sh:path configuration:itemValue ] ]' ; + sh:resultMessage 'Node kb:configuration-entry-5f0fc3ea-e763-4b6d-997a-be0d1ceffc8c must conform to exactly one shape in [ sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path configuration:itemObject ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path configuration:itemValue ] ] , [ sh:property [ sh:minCount Literal("1", datatype=xsd:integer) ; sh:path configuration:itemObject ] ] , [ sh:property [ sh:minCount Literal("1", datatype=xsd:integer) ; sh:path configuration:itemValue ] ]' ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:XoneConstraintComponent ; sh:sourceShape configuration:ConfigurationEntry ; diff --git a/tests/examples/database_records_XFAIL_validation.ttl b/tests/examples/database_records_XFAIL_validation.ttl index 2e76cf72..30d9ec99 100644 --- a/tests/examples/database_records_XFAIL_validation.ttl +++ b/tests/examples/database_records_XFAIL_validation.ttl @@ -12,7 +12,7 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage 'Node kb:table-field-facet-37182dba-4dbd-4b97-b49e-8038b7fbfd29 does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("false" = False, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("true" = True, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldValue ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldIsNull ] ]' ; + sh:resultMessage 'Node kb:table-field-facet-37182dba-4dbd-4b97-b49e-8038b7fbfd29 must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("false" = False, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("true" = True, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldValue ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldIsNull ] ]' ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:XoneConstraintComponent ; sh:sourceShape observable:TableFieldFacet ; @@ -35,7 +35,7 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage 'Node kb:table-field-facet-46aafb6e-0be4-4412-a938-16c4b5ae5314 does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("false" = False, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("true" = True, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldValue ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldIsNull ] ]' ; + sh:resultMessage 'Node kb:table-field-facet-46aafb6e-0be4-4412-a938-16c4b5ae5314 must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("false" = False, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("true" = True, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldValue ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldIsNull ] ]' ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:XoneConstraintComponent ; sh:sourceShape observable:TableFieldFacet ; diff --git a/tests/examples/hash_XFAIL_validation.ttl b/tests/examples/hash_XFAIL_validation.ttl index e05552df..ea350416 100644 --- a/tests/examples/hash_XFAIL_validation.ttl +++ b/tests/examples/hash_XFAIL_validation.ttl @@ -78,7 +78,7 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage 'Node Literal("1", datatype=xsd:integer) does not conform to one or more shapes in [ sh:datatype vocabulary:HashNameVocab ] , [ sh:datatype xsd:string ]' ; + sh:resultMessage 'Node Literal("1", datatype=xsd:integer) must conform to one or more shapes in [ sh:datatype vocabulary:HashNameVocab ] , [ sh:datatype xsd:string ]' ; sh:resultPath types:hashMethod ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:OrConstraintComponent ; diff --git a/tests/examples/object_status_XFAIL_validation.ttl b/tests/examples/object_status_XFAIL_validation.ttl index b84dd57b..819bbf85 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(\"Draft\" = None, datatype=core:ObjectStatusVocab)', 'Literal(\"Final\" = None, datatype=core:ObjectStatusVocab)', 'Literal(\"Deprecated\" = None, datatype=core:ObjectStatusVocab)']" ; + sh:resultMessage "Value Literal(\"Initial draft\") not in list ['Literal(\"Draft\", datatype=core:ObjectStatusVocab)', 'Literal(\"Final\", datatype=core:ObjectStatusVocab)', 'Literal(\"Deprecated\", datatype=core:ObjectStatusVocab)']" ; sh:resultPath core:objectStatus ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:InConstraintComponent ; diff --git a/tests/examples/rdf_list_XFAIL_validation.ttl b/tests/examples/rdf_list_XFAIL_validation.ttl index 65ab509a..d8646eda 100644 --- a/tests/examples/rdf_list_XFAIL_validation.ttl +++ b/tests/examples/rdf_list_XFAIL_validation.ttl @@ -14,7 +14,7 @@ sh:detail [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage 'Node kb:list-1 does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ; + sh:resultMessage 'Node kb:list-1 must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:XoneConstraintComponent ; sh:sourceShape uco-owl:Sequence-shape ; @@ -40,7 +40,7 @@ sh:detail [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage 'Node ex:someDatatypeProperty does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ; + sh:resultMessage 'Node ex:someDatatypeProperty must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:XoneConstraintComponent ; sh:sourceShape uco-owl:Sequence-shape ; @@ -66,7 +66,7 @@ ) ; - sh:resultMessage 'Node ( kb:concept-7 kb:concept-8 ) does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ; + sh:resultMessage 'Node ( kb:concept-7 kb:concept-8 ) must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:XoneConstraintComponent ; sh:sourceShape uco-owl:Sequence-shape ; diff --git a/tests/examples/thread_XFAIL_validation.ttl b/tests/examples/thread_XFAIL_validation.ttl index 8991af7f..7e86377f 100644 --- a/tests/examples/thread_XFAIL_validation.ttl +++ b/tests/examples/thread_XFAIL_validation.ttl @@ -48,7 +48,7 @@ [ a sh:ValidationResult ; sh:focusNode ; - sh:resultMessage 'Node kb:thread-item-2bd09467-d413-4a03-af5d-f0e428f7d987 conforms to shape [ rdf:type sh:PropertyShape ; sh:class co:Item ; sh:description Literal("This shape encodes in SHACL that the range of co:itemContent is the complement of co:Item.", lang=en) ; sh:path co:itemContent ]' ; + sh:resultMessage 'Node kb:thread-item-2bd09467-d413-4a03-af5d-f0e428f7d987 must not conform to shape [ rdf:type sh:PropertyShape ; sh:class co:Item ; sh:description Literal("This shape encodes in SHACL that the range of co:itemContent is the complement of co:Item.", lang=en) ; sh:path co:itemContent ]' ; sh:resultSeverity sh:Violation ; sh:sourceConstraintComponent sh:NotConstraintComponent ; sh:sourceShape uco-co:itemContent-subjects-shape ; From 7d0278345cebcdfd22d499314c26ef58c605d303 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 25 Oct 2024 16:43:43 -0400 Subject: [PATCH 38/38] Bump GitHub Action versions Signed-off-by: Alex Nelson --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f50c298f..290e2cbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,13 +26,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '11' - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Start from clean state