From 4379ca9fde49751fa8b3512b5f103fd44c7e52c0 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 5 Jun 2024 07:59:05 -0400 Subject: [PATCH 01/10] Classify AlternateDataStream and test for gufo:Type instantiations among exemplars No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/590 Signed-off-by: Alex Nelson --- ontology/uco-gufo.ttl | 8 ++++++++ tests/exemplars.ttl | 9 +++++++++ tests/test_exemplar_coverage.py | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/ontology/uco-gufo.ttl b/ontology/uco-gufo.ttl index db86ce5..ab9da11 100644 --- a/ontology/uco-gufo.ttl +++ b/ontology/uco-gufo.ttl @@ -205,6 +205,10 @@ uco-identity:Person ; . +uco-observable:AlternateDataStream + a gufo:Kind ; + . + uco-observable:BluetoothAddressFacet a drafting:SpecificFacetType ; . @@ -216,6 +220,10 @@ uco-observable:Device ; . +uco-observable:FileSystemObject + a gufo:Category ; + . + uco-observable:MACAddressFacet a drafting:GeneralFacetType ; . diff --git a/tests/exemplars.ttl b/tests/exemplars.ttl index c7786a8..5235b73 100644 --- a/tests/exemplars.ttl +++ b/tests/exemplars.ttl @@ -29,6 +29,15 @@ kb:Action-13c91d40-9ca0-4558-81a1-4f7db888c371 gufo:hasEndPointInXSDDateTimeStamp "2021-02-03T04:05:06Z"^^xsd:dateTimeStamp ; . +kb:AlternateDataStream-e6ceee40-5614-4740-b08c-d21ce9b2356d + a + uco-observable:AlternateDataStream , + uco-observable:FileSystemObject + ; + rdfs:comment "TODO - The assignment of FileSystemObject is only necessary until UCO Issue 590 is incorporated."@en ; + rdfs:seeAlso ; + . + kb:BluetoothAddress-53c6bc31-4f9c-4ca7-96cb-c9c61d7e4ca2 a uco-observable:BluetoothAddress ; uco-core:hasFacet diff --git a/tests/test_exemplar_coverage.py b/tests/test_exemplar_coverage.py index a6ce568..7e0ff06 100644 --- a/tests/test_exemplar_coverage.py +++ b/tests/test_exemplar_coverage.py @@ -20,6 +20,7 @@ from typing import Optional, Set from rdflib import RDF, RDFS, Graph, URIRef +from rdflib.query import ResultRow NS_RDF = RDF NS_RDFS = RDFS @@ -34,6 +35,7 @@ def test_exemplar_coverage() -> None: ontologies) designated a subclass of some C', and each property P designated a subproperty of some P', C (/P) is used in the exemplars graph. + For gUFO, instances of a gufo:Type are also included in the review. """ exemplar_graph = Graph() profile_graph = Graph() @@ -66,6 +68,22 @@ def test_exemplar_coverage() -> None: assert isinstance(triple[0], URIRef) classes_mapped.add(triple[0]) + gufo_type_query = """\ +PREFIX gufo: +SELECT ?nClass +WHERE { + # owl:Class restriction is to not pick up Relators. + ?nClass + a owl:Class ; + a/rdfs:subClassOf* gufo:Type ; + . +} +""" + for gufo_type_query_result in tbox_graph.query(gufo_type_query): + assert isinstance(gufo_type_query_result, ResultRow) + assert isinstance(gufo_type_query_result[0], URIRef) + classes_mapped.add(gufo_type_query_result[0]) + result: Optional[bool] class_query = """\ From 46c86cf365df137c2f21735f8c207db80b3a1c4e Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 5 Jun 2024 11:40:28 -0400 Subject: [PATCH 02/10] Classify Relationship, noting apparent non-alignments No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- ontology/uco-gufo.ttl | 41 +++++++++++++++++++++++++++++++++++++++++ tests/exemplars.ttl | 16 ++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/ontology/uco-gufo.ttl b/ontology/uco-gufo.ttl index db86ce5..dd80735 100644 --- a/ontology/uco-gufo.ttl +++ b/ontology/uco-gufo.ttl @@ -167,6 +167,13 @@ uco-core:Item ; . +uco-core:Relationship + rdfs:subClassOf + drafting:Endurant , + gufo:Object + ; + . + uco-core:endTime rdfs:seeAlso gufo:hasEndPoint , @@ -235,3 +242,37 @@ uco-types:Hash owl:annotatedSubject uco-core:Facet ; . +[] + a owl:NegativePropertyAssertion ; + rdfs:comment "If this specialization were introduced, a further specialization would be suggested for gufo:mediates. A demonstration exists among the CASE examples that is incompatible: A Relationship, 'Mapped_Into', that relates two Actions together to demonstrate a lifecycle phase."@en ; + rdfs:seeAlso + , + , + [ + a owl:NegativePropertyAssertion ; + rdfs:comment "gufo:mediates has range gufo:Endurant, but a uco-core:Relationship is permitted to link any UcoObject, including perdurants."@en ; + rdfs:seeAlso + , + + ; + owl:assertionProperty rdfs:subPropertyOf ; + owl:sourceInvididual uco-core:source ; + owl:targetInvididual gufo:mediates ; + ] , + [ + a owl:NegativePropertyAssertion ; + rdfs:comment "gufo:mediates has range gufo:Endurant, but a uco-core:Relationship is permitted to link any UcoObject, including perdurants."@en ; + rdfs:seeAlso + , + + ; + owl:assertionProperty rdfs:subPropertyOf ; + owl:sourceInvididual uco-core:target ; + owl:targetInvididual gufo:mediates ; + ] + ; + owl:assertionProperty rdfs:subClassOf ; + owl:sourceInvididual uco-core:Relationship ; + owl:targetInvididual gufo:Relator ; + . + diff --git a/tests/exemplars.ttl b/tests/exemplars.ttl index c7786a8..c10d22c 100644 --- a/tests/exemplars.ttl +++ b/tests/exemplars.ttl @@ -46,11 +46,19 @@ kb:BluetoothAddressFacet-717b8cce-e9c2-4d59-81e4-1747d7e2d8ee a uco-observable:BluetoothAddressFacet ; . +kb:ContentData-0571dfb7-889e-4e8c-bec7-47a62ab9286f + a uco-observable:ContentData ; + . + kb:ContentData-179c7e84-f72d-47f7-b6f3-3f4a1f0938bd a uco-observable:ContentData ; uco-core:hasFacet kb:ContentDataFacet-a961d865-087b-43bd-ab31-0e33331c5628 ; . +kb:ContentData-3f13e43a-a3f4-4dcc-8db2-e934b24890ec + a uco-observable:ContentData ; + . + kb:ContentDataFacet-a961d865-087b-43bd-ab31-0e33331c5628 a uco-observable:ContentDataFacet ; . @@ -126,6 +134,14 @@ kb:QualityValueAttributionSituation-872b7dd1-b49a-4278-bfdf-df507493d63f gufo:hasEndPoint kb:Instant-c9ae3fce-ddcb-416b-971b-559c2f5bee95 ; . +kb:Relationship-2be6b54a-a051-499c-9dcd-63d17d813293 + a uco-core:Relationship ; + uco-core:isDirectional "true"^^xsd:boolean ; + uco-core:kindOfRelationship "Contained_Within" ; + uco-core:source kb:ContentData-0571dfb7-889e-4e8c-bec7-47a62ab9286f ; + uco-core:target kb:ContentData-3f13e43a-a3f4-4dcc-8db2-e934b24890ec ; + . + kb:Velocity-62bc6232-b570-45d7-b382-d4e0a36fceb9 a drafting:Velocity ; gufo:inheresIn kb:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc ; From 7db2539359e96b4eec282ecd6ac49593c66e65ff Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 17 Jun 2024 15:47:50 -0400 Subject: [PATCH 03/10] Run pre-commit autoupdate No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 456abf6..f7977dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.1.0 hooks: - id: flake8 - repo: https://github.com/pycqa/isort From f4f011ab71fbf3d149b933184c02fde53770e2b2 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 17 Jun 2024 17:17:43 -0400 Subject: [PATCH 04/10] Regenerate Make-managed files Signed-off-by: Alex Nelson --- shapes/catalog-v001.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shapes/catalog-v001.xml b/shapes/catalog-v001.xml index 6936bc2..2b67690 100644 --- a/shapes/catalog-v001.xml +++ b/shapes/catalog-v001.xml @@ -22,5 +22,5 @@ - + From 4ff898fc5945d570c177f309322a284f4be0c987 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 17 Jun 2024 15:54:14 -0400 Subject: [PATCH 05/10] Normalize Turtle with pre-commit hook No effects were observed on Make-managed files. Disclaimer: Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose. Signed-off-by: Alex Nelson --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f7977dd..0c82e1c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,3 +12,9 @@ repos: hooks: - id: isort name: isort (python) + - repo: https://github.com/casework/rdf-toolkit-action + rev: 2.0.3 + hooks: + - id: rdf-toolkit-normalizer + args: + - --autofix From 18f92be63d13448231177d30ac31c6b8482763ce Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 17 Jun 2024 15:56:54 -0400 Subject: [PATCH 06/10] Delegate Turtle normalization for ontology and shapes files to pre-commit hook No effects were observed on Make-managed files. Disclaimer: Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose. Signed-off-by: Alex Nelson --- .gitignore | 1 - ontology/Makefile | 33 --------------------------------- shapes/Makefile | 33 --------------------------------- 3 files changed, 67 deletions(-) diff --git a/.gitignore b/.gitignore index 3249754..605534e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ *.jar *.swp .*.done.log -.check-*.ttl .venv-pre-commit __pycache__ venv diff --git a/ontology/Makefile b/ontology/Makefile index 261a613..cae85be 100644 --- a/ontology/Makefile +++ b/ontology/Makefile @@ -20,37 +20,11 @@ top_srcdir := $(shell cd .. ; pwd) uco_srcdir := $(top_srcdir)/dependencies/UCO -RDF_TOOLKIT_JAR := $(uco_srcdir)/lib/rdf-toolkit.jar - ttl_basenames := $(wildcard uco-*.ttl) -check_ttl_targets := $(foreach ttl_basename,$(ttl_basenames),check-$(ttl_basename)) - all: \ catalog-v001.xml -.PHONY: \ - check-%.ttl - -.PRECIOUS: \ - .check-%.ttl - -$(RDF_TOOLKIT_JAR): - @echo "DEBUG:ontology/Makefile:top_srcdir=$(top_srcdir)" >&2 - @echo "ERROR:ontology/Makefile:rdf-toolkit.jar not found. Did you run `make` from the top source directory?" >&2 - @test -r $@ - -.check-%.ttl: \ - %.ttl \ - $(RDF_TOOLKIT_JAR) - java -jar $(RDF_TOOLKIT_JAR) \ - --inline-blank-nodes \ - --source $< \ - --source-format turtle \ - --target _$@ \ - --target-format turtle - mv _$@ $@ - catalog-v001.xml: \ $(top_srcdir)/.venv.done.log \ $(top_srcdir)/etc/domain_directories.tsv \ @@ -69,15 +43,8 @@ catalog-v001.xml: \ mv _$@ $@ check: \ - $(check_ttl_targets) \ catalog-v001.xml -check-%.ttl: \ - %.ttl \ - .check-%.ttl - diff $^ \ - || (echo "ERROR:ontology/Makefile:The local $< does not match the normalized version. If the above reported changes look fine, run 'cp .check-$< $<' while in the sub-folder ontology/ to get a file ready to commit to Git." >&2 ; exit 1) - clean: @rm -f \ _* \ diff --git a/shapes/Makefile b/shapes/Makefile index ed4546c..71e91ff 100644 --- a/shapes/Makefile +++ b/shapes/Makefile @@ -20,37 +20,11 @@ top_srcdir := $(shell cd .. ; pwd) uco_srcdir := $(top_srcdir)/dependencies/UCO -RDF_TOOLKIT_JAR := $(uco_srcdir)/lib/rdf-toolkit.jar - ttl_basenames := $(wildcard sh-*.ttl) -check_ttl_targets := $(foreach ttl_basename,$(ttl_basenames),check-$(ttl_basename)) - all: \ catalog-v001.xml -.PHONY: \ - check-%.ttl - -.PRECIOUS: \ - .check-%.ttl - -$(RDF_TOOLKIT_JAR): - @echo "DEBUG:shapes/Makefile:top_srcdir=$(top_srcdir)" >&2 - @echo "ERROR:shapes/Makefile:rdf-toolkit.jar not found. Did you run `make` from the top source directory?" >&2 - @test -r $@ - -.check-%.ttl: \ - %.ttl \ - $(RDF_TOOLKIT_JAR) - java -jar $(RDF_TOOLKIT_JAR) \ - --inline-blank-nodes \ - --source $< \ - --source-format turtle \ - --target _$@ \ - --target-format turtle - mv _$@ $@ - catalog-v001.xml: \ $(top_srcdir)/.venv.done.log \ $(top_srcdir)/etc/domain_directories.tsv \ @@ -69,15 +43,8 @@ catalog-v001.xml: \ mv _$@ $@ check: \ - $(check_ttl_targets) \ catalog-v001.xml -check-%.ttl: \ - %.ttl \ - .check-%.ttl - diff $^ \ - || (echo "ERROR:shapes/Makefile:The local $< does not match the normalized version. If the above reported changes look fine, run 'cp .check-$< $<' while in the sub-folder shapes/ to get a file ready to commit to Git." >&2 ; exit 1) - clean: @rm -f \ _* \ From 91878fcafd102faf472e1cc7b4586a7a60fd8153 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 17 Jun 2024 18:17:23 -0400 Subject: [PATCH 07/10] Bump gUFO shapes pointer No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- dependencies/CDO-Shapes-gufo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/CDO-Shapes-gufo b/dependencies/CDO-Shapes-gufo index 3cde0e8..b61c058 160000 --- a/dependencies/CDO-Shapes-gufo +++ b/dependencies/CDO-Shapes-gufo @@ -1 +1 @@ -Subproject commit 3cde0e8cbf1fcc682ee99b1567815d9c3c973771 +Subproject commit b61c0583d33f81fc66aa20e9c87e86b551625902 From 9ccdc955759b8e7301b381c9c0aae5a8e27ce3d6 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 21 Jun 2024 10:49:15 -0400 Subject: [PATCH 08/10] Align AlternateDataStream as a subclass of gufo:Object No effects were observed on Make-managed files. Reported-by: Paul Brandt Signed-off-by: Alex Nelson --- ontology/uco-gufo.ttl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ontology/uco-gufo.ttl b/ontology/uco-gufo.ttl index 3144894..af74787 100644 --- a/ontology/uco-gufo.ttl +++ b/ontology/uco-gufo.ttl @@ -220,6 +220,10 @@ uco-identity:Person uco-observable:AlternateDataStream a gufo:Kind ; + rdfs:subClassOf + drafting:Endurant , + gufo:Object + ; . uco-observable:BluetoothAddressFacet From d028352e1aad5d321df6cc395d29768b7e2c2248 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Fri, 21 Jun 2024 14:17:29 -0400 Subject: [PATCH 09/10] Bump gUFO shapes pointer No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- dependencies/CDO-Shapes-gufo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/CDO-Shapes-gufo b/dependencies/CDO-Shapes-gufo index b61c058..eef27bd 160000 --- a/dependencies/CDO-Shapes-gufo +++ b/dependencies/CDO-Shapes-gufo @@ -1 +1 @@ -Subproject commit b61c0583d33f81fc66aa20e9c87e86b551625902 +Subproject commit eef27bd132f731efbad44847be5a2a9760734655 From f817871ba0df9e9ba651815f7794bbe8ee5157fd Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 2 Jul 2024 08:12:59 -0400 Subject: [PATCH 10/10] Bump gUFO shapes pointer No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- dependencies/CDO-Shapes-gufo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/CDO-Shapes-gufo b/dependencies/CDO-Shapes-gufo index eef27bd..aebe018 160000 --- a/dependencies/CDO-Shapes-gufo +++ b/dependencies/CDO-Shapes-gufo @@ -1 +1 @@ -Subproject commit eef27bd132f731efbad44847be5a2a9760734655 +Subproject commit aebe0182fc7b75b5ef148f5b12cfe82192cd4336