Skip to content

Commit

Permalink
Start UCO-gufo profile from base branch
Browse files Browse the repository at this point in the history
A follow-on patch will regenerate Make-managed files.

Signed-off-by: Alex Nelson <[email protected]>
  • Loading branch information
ajnelson-nist committed Jan 30, 2024
1 parent db05f77 commit 04fcafe
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 306 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "dependencies/CDO-Shapes-gufo"]
path = dependencies/CDO-Shapes-gufo
url = https://github.com/Cyber-Domain-Ontology/CDO-Shapes-gufo.git
branch = main
[submodule "dependencies/UCO"]
path = dependencies/UCO
url = https://github.com/ucoProject/UCO.git
Expand Down
26 changes: 5 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@ PYTHON3 ?= python3

all: \
.venv-pre-commit/var/.pre-commit-built.log \
all-ontology \
all-shapes
all-ontology

.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 All @@ -41,7 +38,9 @@ all: \
# dependency on other profiles.
.git_submodule_init_imports.done.log: \
.gitmodules
# TODO - Initialize non-CDO submodule here.
git submodule update \
--init \
dependencies/CDO-Shapes-gufo
touch $@

.git_submodule_init.done.log: \
Expand Down Expand Up @@ -104,17 +103,11 @@ 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-shapes
check-ontology
$(MAKE) \
--directory tests \
check
Expand All @@ -140,12 +133,6 @@ 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 @@ -192,9 +179,6 @@ clean:
@$(MAKE) \
--directory tests \
clean
@$(MAKE) \
--directory shapes \
clean
@$(MAKE) \
--directory ontology \
clean
Expand Down
1 change: 1 addition & 0 deletions dependencies/CDO-Shapes-gufo
Submodule CDO-Shapes-gufo added at 0981d4
48 changes: 2 additions & 46 deletions dependencies/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,9 @@ top_srcdir := $(shell cd .. ; pwd)

uco_srcdir := $(top_srcdir)/dependencies/UCO

RDF_TOOLKIT_JAR := $(uco_srcdir)/lib/rdf-toolkit.jar

all: \
catalog-v001.xml

$(RDF_TOOLKIT_JAR):
@echo "DEBUG:dependencies/Makefile:top_srcdir=$(top_srcdir)" >&2
@echo "ERROR:dependencies/Makefile:rdf-toolkit.jar not found. Did you run `make` from the top source directory?" >&2
@test -r $@

catalog-v001.xml: \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/etc/domain_directories.tsv \
Expand All @@ -49,51 +42,14 @@ catalog-v001.xml: \
check: \
catalog-v001.xml

# TODO: This recipe deletes files generated by Make. The line deleting
# example.ttl should be adapted.
clean:
@rm -f \
catalog-v001.xml \
example.ttl \
imports-transitive.ttl

# TODO: Adapt this recipe to normalize a submodule's file, or downloaded
# file, in the same manner as CDO ontologies are normalized.
example.ttl: \
example/example.owl \
$(RDF_TOOLKIT_JAR) \
$(top_srcdir)/.venv.done.log
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--shacl UCO/ontology/owl/owl.ttl \
$<
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source $< \
--source-format rdf-xml \
--target _$@ \
--target-format turtle
mv _$@ $@

# This recipe intentionally does not incorporate CDO ontologies (UCO,
# CASE, etc.), to avoid redundant imports between multiple profiles.
# TODO: Adapt this recipe to depend instead on the normalized file, as
# well as any profile submodules' imports-transitive files.
# Note that the piping command, analagous to the concatenate ('cat')
# command but for RDF graph files, will combine all recipe dependencies
# into one file, using the $^ ("all dependencies") Make variable.
imports-transitive.ttl: \
example.ttl
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$^ \
> __$@
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
$(top_srcdir)/dependencies/CDO-Shapes-gufo/dependencies/imports-transitive.ttl
cp $< _$@
mv _$@ $@
16 changes: 0 additions & 16 deletions dependencies/example.ttl

This file was deleted.

3 changes: 0 additions & 3 deletions dependencies/example/README.md

This file was deleted.

18 changes: 0 additions & 18 deletions dependencies/example/example.owl

This file was deleted.

5 changes: 3 additions & 2 deletions etc/dependency_files.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
http://example.org/ontology/example/0.0.1 ${top_srcdir}/dependencies/example.ttl
http://example.org/shapes/example ${top_srcdir}/shapes/sh-example.ttl
http://example.org/shapes/gufo ${top_srcdir}/dependencies/CDO-Shapes-gufo/shapes/sh-gufo.ttl
http://example.org/ontology/uco-gufo ${top_srcdir}/ontology/uco-gufo.ttl
http://purl.org/nemo/gufo#/1.0.0 ${top_srcdir}/dependencies/CDO-Shapes-gufo/dependencies/gufo.ttl
1 change: 0 additions & 1 deletion etc/domain_directories.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
https://example.org/ ${top_srcdir}/ontology/
https://ontology.unifiedcyberontology.org/ ${top_srcdir}/dependencies/UCO/ontology/
23 changes: 0 additions & 23 deletions ontology/uco-example.ttl

This file was deleted.

37 changes: 37 additions & 0 deletions ontology/uco-gufo.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# imports: http://purl.org/nemo/gufo#/1.0.0
# imports: https://ontology.unifiedcyberontology.org/uco/uco/1.3.0

@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 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 xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.org/ontology/uco-gufo>
a owl:Ontology ;
owl:imports
<http://purl.org/nemo/gufo#/1.0.0> ,
<https://ontology.unifiedcyberontology.org/uco/uco/1.3.0>
;
.

uco-action:Action
rdfs:subClassOf gufo:Event ;
.

uco-core:Event
rdfs:subClassOf gufo:Event ;
.

uco-identity:Organization
rdfs:subClassOf gufo:Object ;
.

uco-identity:Person
rdfs:subClassOf gufo:Object ;
.

84 changes: 0 additions & 84 deletions shapes/Makefile

This file was deleted.

26 changes: 0 additions & 26 deletions shapes/catalog-v001.xml

This file was deleted.

Loading

0 comments on commit 04fcafe

Please sign in to comment.