Skip to content

Commit

Permalink
Merge branch 'main' into classify_location
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnelson-nist committed Jul 18, 2024
2 parents ffcbd8a + abf0b66 commit 0784142
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 81 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
*.jar
*.swp
.*.done.log
.check-*.ttl
.venv-pre-commit
__pycache__
venv
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ 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
rev: 5.13.2
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
2 changes: 1 addition & 1 deletion dependencies/CDO-Shapes-gufo
33 changes: 0 additions & 33 deletions ontology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
_* \
Expand Down
53 changes: 53 additions & 0 deletions ontology/uco-gufo.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ uco-core:Item
;
.

uco-core:Relationship
rdfs:subClassOf
drafting:Endurant ,
gufo:Object
;
.

uco-core:endTime
rdfs:seeAlso
gufo:hasEndPoint ,
Expand Down Expand Up @@ -226,6 +233,14 @@ uco-location:Location
;
.

uco-observable:AlternateDataStream
a gufo:Kind ;
rdfs:subClassOf
drafting:Endurant ,
gufo:Object
;
.

uco-observable:BluetoothAddressFacet
a drafting:SpecificFacetType ;
.
Expand All @@ -237,6 +252,10 @@ uco-observable:Device
;
.

uco-observable:FileSystemObject
a gufo:Category ;
.

uco-observable:MACAddressFacet
a drafting:GeneralFacetType ;
.
Expand Down Expand Up @@ -268,3 +287,37 @@ uco-types:Hash
owl:annotatedSubject uco-core:Assertion ;
.

[]
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
<http://example.org/kb/lifecycle_phase-60a55e96-d39e-487e-9b39-3ba96e1ffc7a> ,
<https://github.com/casework/CASE-Examples/tree/dc6f6b901289c1684fd88e25e9bcec925974d155/examples/illustrations/forensic_lifecycle> ,
[
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
<http://example.org/kb/lifecycle_phase-60a55e96-d39e-487e-9b39-3ba96e1ffc7a> ,
<https://github.com/casework/CASE-Examples/tree/dc6f6b901289c1684fd88e25e9bcec925974d155/examples/illustrations/forensic_lifecycle>
;
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
<http://example.org/kb/lifecycle_phase-60a55e96-d39e-487e-9b39-3ba96e1ffc7a> ,
<https://github.com/casework/CASE-Examples/tree/dc6f6b901289c1684fd88e25e9bcec925974d155/examples/illustrations/forensic_lifecycle>
;
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 ;
.

33 changes: 0 additions & 33 deletions shapes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
_* \
Expand Down
49 changes: 37 additions & 12 deletions tests/exemplars.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,30 @@

kb:Action-13c91d40-9ca0-4558-81a1-4f7db888c371
a uco-action:Action ;
uco-action:endTime "2021-02-03T04:05:06Z"^^xsd:dateTime ;
uco-action:startTime "2020-01-02T03:04:05Z"^^xsd:dateTime ;
gufo:hasBeginPointInXSDDateTimeStamp "2020-01-02T03:04:05Z"^^xsd:dateTimeStamp ;
gufo:hasEndPointInXSDDateTimeStamp "2021-02-03T04:05:06Z"^^xsd:dateTimeStamp ;
uco-action:endTime "2021-02-03T04:05:06Z"^^xsd:dateTime ;
uco-action:startTime "2020-01-02T03:04:05Z"^^xsd:dateTime ;
.

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 <https://github.com/ucoProject/UCO/issues/590> ;
.

kb:AnalyticResult-34fb92db-d576-45a7-9d62-dae04510968f
a uco-analysis:AnalyticResult ;
.

kb:Bearing-74c2bb20-1e4f-40ac-807e-bc2c528e39da
a drafting:Bearing ;
gufo:inheresIn kb:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc ;
.

kb:BluetoothAddress-53c6bc31-4f9c-4ca7-96cb-c9c61d7e4ca2
a uco-observable:BluetoothAddress ;
uco-core:hasFacet
Expand All @@ -43,30 +57,33 @@ kb:BluetoothAddress-53c6bc31-4f9c-4ca7-96cb-c9c61d7e4ca2
;
.

kb:Bearing-74c2bb20-1e4f-40ac-807e-bc2c528e39da
a drafting:Bearing ;
gufo:inheresIn kb:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc ;
.

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 ;
.

kb:Event-03a1a1db-0579-4427-9a51-448c32281146
a uco-core:Event ;
uco-core:endTime "2011-02-03T04:05:06Z"^^xsd:dateTime ;
uco-core:startTime "2010-01-02T03:04:05Z"^^xsd:dateTime ;
gufo:hasBeginPointInXSDDateTimeStamp "2010-01-02T03:04:05Z"^^xsd:dateTimeStamp ;
gufo:hasEndPointInXSDDateTimeStamp "2011-02-03T04:05:06Z"^^xsd:dateTimeStamp ;
uco-core:endTime "2011-02-03T04:05:06Z"^^xsd:dateTime ;
uco-core:startTime "2010-01-02T03:04:05Z"^^xsd:dateTime ;
.

kb:Hash-4c3d0623-d365-4c69-a1a1-01523c6502fa
Expand Down Expand Up @@ -136,9 +153,12 @@ kb:QualityValueAttributionSituation-872b7dd1-b49a-4278-bfdf-df507493d63f
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: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:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc
Expand All @@ -149,3 +169,8 @@ kb:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc
;
.

kb:Velocity-62bc6232-b570-45d7-b382-d4e0a36fceb9
a drafting:Velocity ;
gufo:inheresIn kb:Vehicle-c7e910e8-4bed-473e-ad74-3df3eb63cbcc ;
.

18 changes: 18 additions & 0 deletions tests/test_exemplar_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -66,6 +68,22 @@ def test_exemplar_coverage() -> None:
assert isinstance(triple[0], URIRef)
classes_mapped.add(triple[0])

gufo_type_query = """\
PREFIX gufo: <http://purl.org/nemo/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 = """\
Expand Down

0 comments on commit 0784142

Please sign in to comment.