From d8afa8e6fb18597775e8680b6af3c4a0c99fe4c0 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Tue, 5 Mar 2024 15:10:41 -0500 Subject: [PATCH 1/2] Apply EndurantType hierarchy for Qualities of vehicle example No effects were observed on Make-managed files. References: * https://github.com/ucoProject/UCO/issues/567 Signed-off-by: Alex Nelson --- ontology/uco-gufo.ttl | 25 ++++++++++++++++++++ tests/exemplars.ttl | 55 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/ontology/uco-gufo.ttl b/ontology/uco-gufo.ttl index ffd81f0..fa2bd51 100644 --- a/ontology/uco-gufo.ttl +++ b/ontology/uco-gufo.ttl @@ -9,6 +9,7 @@ @prefix uco-action: . @prefix uco-core: . @prefix uco-identity: . +@prefix uco-observable: . @prefix uco-types: . @prefix xsd: . @@ -20,6 +21,15 @@ ; . +drafting:Bearing + a + gufo:Kind , + owl:Class + ; + rdfs:subClassOf drafting:Quality ; + rdfs:seeAlso ; + . + drafting:Endurant a owl:Class ; rdfs:subClassOf @@ -48,6 +58,21 @@ drafting:Quality rdfs:seeAlso ; . +drafting:Vehicle + a owl:Class ; + rdfs:subClassOf uco-observable:Device ; + rdfs:seeAlso ; + . + +drafting:Velocity + a + gufo:Kind , + owl:Class + ; + rdfs:subClassOf drafting:Quality ; + rdfs:seeAlso ; + . + uco-action:Action rdfs:subClassOf drafting:Perdurant ; . diff --git a/tests/exemplars.ttl b/tests/exemplars.ttl index 7665e7f..94c7027 100644 --- a/tests/exemplars.ttl +++ b/tests/exemplars.ttl @@ -6,6 +6,7 @@ @prefix owl: . @prefix rdf: . @prefix rdfs: . +@prefix time: . @prefix uco-action: . @prefix uco-core: . @prefix uco-identity: . @@ -28,6 +29,11 @@ kb:Action-13c91d40-9ca0-4558-81a1-4f7db888c371 gufo:hasEndPointInXSDDateTimeStamp "2021-02-03T04:05:06Z"^^xsd:dateTimeStamp ; . +kb:Bearing-74c2bb20-1e4f-40ac-807e-bc2c528e39da + a drafting:Bearing ; + gufo:inheresIn kb:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc ; + . + kb:ContentData-179c7e84-f72d-47f7-b6f3-3f4a1f0938bd a uco-observable:ContentData ; . @@ -49,6 +55,26 @@ kb:Hash-4c3d0623-d365-4c69-a1a1-01523c6502fa uco-types:hashValue "da39a3ee5e6b4b0d3255bfef95601890afd80709"^^xsd:hexBinary ; . +kb:Instant-24d2c5f3-d194-4db9-972a-9472c267d047 + a time:Instant ; + . + +kb:Instant-2918592a-9d87-4b30-acbc-521a19f97fcd + a time:Instant ; + time:inXSDDateTimeStamp "2023-11-22T15:30:00Z"^^xsd:dateTimeStamp ; + . + +kb:Instant-c9ae3fce-ddcb-416b-971b-559c2f5bee95 + a time:Instant ; + . + +kb:Interval-336d4db4-727e-4694-8bf0-5902c6ae504f + a time:Interval ; + time:hasBeginning kb:Instant-24d2c5f3-d194-4db9-972a-9472c267d047 ; + time:hasEnd kb:Instant-c9ae3fce-ddcb-416b-971b-559c2f5bee95 ; + time:inside kb:Instant-2918592a-9d87-4b30-acbc-521a19f97fcd ; + . + kb:Organization-3b542161-47e1-40cd-a1b1-e1b9d07af81f a uco-identity:Organization ; . @@ -63,3 +89,32 @@ kb:Quality-4b765c1f-362c-4562-a50f-7bb781fe4737 gufo:inheresIn kb:ContentData-179c7e84-f72d-47f7-b6f3-3f4a1f0938bd ; . +kb:QualityValueAttributionSituation-3ec99074-3cd1-4d24-a2c0-2339850ab9d2 + a gufo:QualityValueAttributionSituation ; + gufo:concernsQualityType drafting:Bearing ; + gufo:concernsQualityValue "90 degrees" ; + gufo:hasBeginPoint kb:Instant-24d2c5f3-d194-4db9-972a-9472c267d047 ; + gufo:hasEndPoint kb:Instant-c9ae3fce-ddcb-416b-971b-559c2f5bee95 ; + . + +kb:QualityValueAttributionSituation-872b7dd1-b49a-4278-bfdf-df507493d63f + a gufo:QualityValueAttributionSituation ; + gufo:concernsQualityType drafting:Velocity ; + gufo:concernsQualityValue "50 km/h" ; + gufo:hasBeginPoint kb:Instant-24d2c5f3-d194-4db9-972a-9472c267d047 ; + gufo:hasEndPoint kb:Instant-c9ae3fce-ddcb-416b-971b-559c2f5bee95 ; + . + +kb:Velocity-62bc6232-b570-45d7-b382-d4e0a36fceb9 + a drafting:Velocity ; + gufo:inheresIn kb:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc ; + . + +kb:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc + a drafting:Vehicle ; + gufo:standsInQualifiedAttribution + kb:QualityValueAttributionSituation-3ec99074-3cd1-4d24-a2c0-2339850ab9d2 , + kb:QualityValueAttributionSituation-872b7dd1-b49a-4278-bfdf-df507493d63f + ; + . + From 22b71d5e13e0731d18dde2d0ee546a063933312b Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 6 Mar 2024 16:22:35 -0500 Subject: [PATCH 2/2] Restrict gufo:inheresIn and restore profile-level shapes Suggested-by: Paul Brandt Signed-off-by: Alex Nelson --- Makefile | 22 ++++++++++- etc/dependency_files.tsv | 1 + ontology/uco-gufo.ttl | 27 ++++++++++++- shapes/Makefile | 84 ++++++++++++++++++++++++++++++++++++++++ shapes/catalog-v001.xml | 26 +++++++++++++ shapes/sh-uco-gufo.ttl | 41 ++++++++++++++++++++ 6 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 shapes/Makefile create mode 100644 shapes/catalog-v001.xml create mode 100644 shapes/sh-uco-gufo.ttl diff --git a/Makefile b/Makefile index 6d7b946..7575201 100644 --- a/Makefile +++ b/Makefile @@ -20,14 +20,17 @@ PYTHON3 ?= python3 all: \ .venv-pre-commit/var/.pre-commit-built.log \ - all-ontology + all-ontology \ + all-shapes .PHONY: \ all-dependencies \ all-ontology \ + all-shapes \ check-dependencies \ check-mypy \ check-ontology \ + check-shapes \ check-supply-chain \ check-supply-chain-cdo-profile \ check-supply-chain-pre-commit \ @@ -103,11 +106,17 @@ all-ontology: \ $(MAKE) \ --directory ontology +all-shapes: \ + all-dependencies + $(MAKE) \ + --directory shapes + check: \ .venv-pre-commit/var/.pre-commit-built.log \ check-mypy \ check-dependencies \ - check-ontology + check-ontology \ + check-shapes $(MAKE) \ --directory tests \ check @@ -133,6 +142,12 @@ check-ontology: \ --directory ontology \ check +check-shapes: \ + all-shapes + $(MAKE) \ + --directory shapes \ + check + # This target's dependencies potentially modify the working directory's # Git state, so it is intentionally not a dependency of check. check-supply-chain: \ @@ -202,6 +217,9 @@ clean: @$(MAKE) \ --directory tests \ clean + @$(MAKE) \ + --directory shapes \ + clean @$(MAKE) \ --directory ontology \ clean diff --git a/etc/dependency_files.tsv b/etc/dependency_files.tsv index 4e93864..9984e05 100644 --- a/etc/dependency_files.tsv +++ b/etc/dependency_files.tsv @@ -1,3 +1,4 @@ http://example.org/ontology/uco-gufo ${top_srcdir}/ontology/uco-gufo.ttl http://example.org/shapes/gufo ${top_srcdir}/dependencies/CDO-Shapes-gufo/shapes/sh-gufo.ttl +http://example.org/shapes/sh-uco-gufo ${top_srcdir}/shapes/sh-uco-gufo.ttl http://purl.org/nemo/gufo#/1.0.0 ${top_srcdir}/dependencies/CDO-Shapes-gufo/dependencies/gufo.ttl diff --git a/ontology/uco-gufo.ttl b/ontology/uco-gufo.ttl index fa2bd51..95b7c6a 100644 --- a/ontology/uco-gufo.ttl +++ b/ontology/uco-gufo.ttl @@ -26,7 +26,15 @@ drafting:Bearing gufo:Kind , owl:Class ; - rdfs:subClassOf drafting:Quality ; + rdfs:subClassOf + drafting:Quality , + [ + a owl:Restriction ; + rdfs:comment "This restriction is more suited for any gUFO Object + UCO Object with a physical projection, but such a class is not defined yet in gUFO or UCO."@en ; + owl:onProperty gufo:inheresIn ; + owl:allValuesFrom uco-observable:Device ; + ] + ; rdfs:seeAlso ; . @@ -69,7 +77,15 @@ drafting:Velocity gufo:Kind , owl:Class ; - rdfs:subClassOf drafting:Quality ; + rdfs:subClassOf + drafting:Quality , + [ + a owl:Restriction ; + rdfs:comment "This restriction is more suited for any gUFO Object + UCO Object with a physical projection, but such a class is not defined yet in gUFO or UCO."@en ; + owl:onProperty gufo:inheresIn ; + owl:allValuesFrom uco-observable:Device ; + ] + ; rdfs:seeAlso ; . @@ -130,6 +146,13 @@ uco-identity:Person ; . +uco-observable:Device + rdfs:subClassOf + drafting:Endurant , + gufo:Object + ; + . + uco-types:Hash rdfs:subClassOf gufo:AbstractIndividual ; . diff --git a/shapes/Makefile b/shapes/Makefile new file mode 100644 index 0000000..e6360e7 --- /dev/null +++ b/shapes/Makefile @@ -0,0 +1,84 @@ +#!/usr/bin/make -f + +# Portions of this file contributed by NIST are governed by the following +# statement: +# +# This software was developed at the National Institute of Standards +# and Technology by employees of the Federal Government in the course +# of their official duties. Pursuant to title 17 Section 105 of the +# United States Code this software is not subject to copyright +# protection and is in the public domain. NIST assumes no +# responsibility whatsoever for its use by other parties, and makes +# no guarantees, expressed or implied, about its quality, +# reliability, or any other characteristic. +# +# We would appreciate acknowledgement if the software is used. + +SHELL := /bin/bash + +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 \ + $(top_srcdir)/etc/dependency_files.tsv \ + $(uco_srcdir)/ontology/uco/master/catalog-v001.xml \ + $(uco_srcdir)/src/create-catalog-v001.xml.py + rm -f _$@ + source $(top_srcdir)/venv/bin/activate \ + && python3 $(uco_srcdir)/src/create-catalog-v001.xml.py \ + --catalog-xml $(uco_srcdir)/ontology/uco/master/catalog-v001.xml \ + _$@ \ + $(top_srcdir)/etc/domain_directories.tsv \ + $(top_srcdir)/etc/dependency_files.tsv \ + "$(top_srcdir)" \ + $(ttl_basenames) + 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 \ + _* \ + catalog-v001.xml diff --git a/shapes/catalog-v001.xml b/shapes/catalog-v001.xml new file mode 100644 index 0000000..4584c5b --- /dev/null +++ b/shapes/catalog-v001.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shapes/sh-uco-gufo.ttl b/shapes/sh-uco-gufo.ttl new file mode 100644 index 0000000..611859c --- /dev/null +++ b/shapes/sh-uco-gufo.ttl @@ -0,0 +1,41 @@ +# imports: http://example.org/ontology/uco-gufo + +@prefix drafting: . +@prefix gufo: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix sh-uco-gufo: . +@prefix uco-observable: . +@prefix xsd: . + + + a owl:Ontology ; + owl:imports ; + . + +sh-uco-gufo:Bearing-shape + a sh:NodeShape ; + rdfs:seeAlso ; + sh:property [ + a sh:PropertyShape ; + rdfs:comment "This shape is more suited for any gUFO Object + UCO Object with a physical projection, but such a class is not defined yet in gUFO or UCO."@en ; + sh:class uco-observable:Device ; + sh:path gufo:inheresIn ; + ] ; + sh:targetClass drafting:Bearing ; + . + +sh-uco-gufo:Velocity-shape + a sh:NodeShape ; + rdfs:seeAlso ; + sh:property [ + a sh:PropertyShape ; + rdfs:comment "This shape is more suited for any gUFO Object + UCO Object with a physical projection, but such a class is not defined yet in gUFO or UCO."@en ; + sh:class uco-observable:Device ; + sh:path gufo:inheresIn ; + ] ; + sh:targetClass drafting:Velocity ; + . +