Skip to content

Commit

Permalink
Merge pull request #6 from ucoProject/Kinds-and-UCO-Issue-567
Browse files Browse the repository at this point in the history
Apply EndurantType hierarchy for Qualities of vehicle example
  • Loading branch information
plbt5 authored Mar 8, 2024
2 parents 98eb888 + 22b71d5 commit 3c7c89a
Show file tree
Hide file tree
Showing 7 changed files with 275 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand All @@ -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: \
Expand Down Expand Up @@ -202,6 +217,9 @@ clean:
@$(MAKE) \
--directory tests \
clean
@$(MAKE) \
--directory shapes \
clean
@$(MAKE) \
--directory ontology \
clean
Expand Down
1 change: 1 addition & 0 deletions etc/dependency_files.tsv
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions ontology/uco-gufo.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@prefix uco-action: <https://ontology.unifiedcyberontology.org/uco/action/> .
@prefix uco-core: <https://ontology.unifiedcyberontology.org/uco/core/> .
@prefix uco-identity: <https://ontology.unifiedcyberontology.org/uco/identity/> .
@prefix uco-observable: <https://ontology.unifiedcyberontology.org/uco/observable/> .
@prefix uco-types: <https://ontology.unifiedcyberontology.org/uco/types/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

Expand All @@ -20,6 +21,23 @@
;
.

drafting:Bearing
a
gufo:Kind ,
owl:Class
;
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 <https://github.com/ucoProject/UCO/issues/567> ;
.

drafting:Endurant
a owl:Class ;
rdfs:subClassOf
Expand Down Expand Up @@ -48,6 +66,29 @@ drafting:Quality
rdfs:seeAlso <https://github.com/ucoProject/UCO/issues/535> ;
.

drafting:Vehicle
a owl:Class ;
rdfs:subClassOf uco-observable:Device ;
rdfs:seeAlso <https://github.com/ucoProject/UCO/issues/567> ;
.

drafting:Velocity
a
gufo:Kind ,
owl:Class
;
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 <https://github.com/ucoProject/UCO/issues/567> ;
.

uco-action:Action
rdfs:subClassOf drafting:Perdurant ;
.
Expand Down Expand Up @@ -105,6 +146,13 @@ uco-identity:Person
;
.

uco-observable:Device
rdfs:subClassOf
drafting:Endurant ,
gufo:Object
;
.

uco-types:Hash
rdfs:subClassOf gufo:AbstractIndividual ;
.
Expand Down
84 changes: 84 additions & 0 deletions shapes/Makefile
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions shapes/catalog-v001.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<uri id="User Entered Import Resolution" uri="../dependencies/CDO-Shapes-gufo/dependencies/gufo.ttl" name="http://purl.org/nemo/gufo#/1.0.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/dependencies/collections-ontology/collections.owl" name="http://purl.org/co"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/dependencies/error/docs/current/error.ttl" name="http://purl.org/spar/error"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/co/co.ttl" name="https://ontology.unifiedcyberontology.org/co/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/owl/owl.ttl" name="https://ontology.unifiedcyberontology.org/owl/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/action/action.ttl" name="https://ontology.unifiedcyberontology.org/uco/action/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/analysis/analysis.ttl" name="https://ontology.unifiedcyberontology.org/uco/analysis/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/configuration/configuration.ttl" name="https://ontology.unifiedcyberontology.org/uco/configuration/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/core/core.ttl" name="https://ontology.unifiedcyberontology.org/uco/core/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/identity/identity.ttl" name="https://ontology.unifiedcyberontology.org/uco/identity/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/location/location.ttl" name="https://ontology.unifiedcyberontology.org/uco/location/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/marking/marking.ttl" name="https://ontology.unifiedcyberontology.org/uco/marking/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/master/uco.ttl" name="https://ontology.unifiedcyberontology.org/uco/uco/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/observable/observable.ttl" name="https://ontology.unifiedcyberontology.org/uco/observable/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/pattern/pattern.ttl" name="https://ontology.unifiedcyberontology.org/uco/pattern/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/role/role.ttl" name="https://ontology.unifiedcyberontology.org/uco/role/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/time/time.ttl" name="https://ontology.unifiedcyberontology.org/uco/time/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/tool/tool.ttl" name="https://ontology.unifiedcyberontology.org/uco/tool/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/types/types.ttl" name="https://ontology.unifiedcyberontology.org/uco/types/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/victim/victim.ttl" name="https://ontology.unifiedcyberontology.org/uco/victim/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../dependencies/UCO/ontology/uco/vocabulary/vocabulary.ttl" name="https://ontology.unifiedcyberontology.org/uco/vocabulary/1.3.0"/>
<uri id="User Entered Import Resolution" uri="../ontology/uco-gufo.ttl" name="http://example.org/ontology/uco-gufo"/>
<uri id="User Entered Import Resolution" uri="sh-uco-gufo.ttl" name="http://example.org/shapes/sh-uco-gufo"/>
</catalog>
41 changes: 41 additions & 0 deletions shapes/sh-uco-gufo.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# imports: http://example.org/ontology/uco-gufo

@prefix drafting: <http://example.org/ontology/drafting/> .
@prefix gufo: <http://purl.org/nemo/gufo#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix sh-uco-gufo: <http://example.org/shapes/sh-uco-gufo/> .
@prefix uco-observable: <https://ontology.unifiedcyberontology.org/uco/observable/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.org/shapes/sh-uco-gufo>
a owl:Ontology ;
owl:imports <http://example.org/ontology/uco-gufo> ;
.

sh-uco-gufo:Bearing-shape
a sh:NodeShape ;
rdfs:seeAlso <https://github.com/ucoProject/UCO/issues/567> ;
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 <https://github.com/ucoProject/UCO/issues/567> ;
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 ;
.

55 changes: 55 additions & 0 deletions tests/exemplars.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix uco-action: <https://ontology.unifiedcyberontology.org/uco/action/> .
@prefix uco-core: <https://ontology.unifiedcyberontology.org/uco/core/> .
@prefix uco-identity: <https://ontology.unifiedcyberontology.org/uco/identity/> .
Expand All @@ -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 ;
.
Expand All @@ -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 ;
.
Expand All @@ -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
;
.

0 comments on commit 3c7c89a

Please sign in to comment.