diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index f17004a6..4b33ba4f 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -23,7 +23,7 @@ When a new ontology release is created, follow these steps: 2. The version of UCO is hard-coded in `uco/Makefile` as part of titling the documentation. Update it to the new version. 3. Run `make clean`. 4. Run `make`. (`make -j` will work.) -5. Run `git add uco`. This will pick up all file deletions and new file creations. +5. Run `git add co uco`. This will pick up all file deletions and new file creations. 6. Commit the changes. 7. Push to Github. 8. Run `git pull` in the deployment space. diff --git a/Makefile b/Makefile index 13f1147d..ab3c4066 100644 --- a/Makefile +++ b/Makefile @@ -18,11 +18,15 @@ SHELL := /bin/bash HOST_PREFIX ?= http://localhost all: \ + all-co \ all-uco .PHONY: \ + all-co \ all-uco \ - check-service + check-co \ + check-service \ + check-uco # This target checks for a file's existence to confirm that the submodule @@ -63,6 +67,11 @@ all: \ dependencies/Ontospy[FULL] touch $@ +all-co: \ + .venv.done.log + $(MAKE) \ + --directory co + all-uco: \ .venv.done.log \ dependencies/UCO/tests/uco_monolithic.ttl @@ -70,6 +79,16 @@ all-uco: \ --directory uco check: \ + check-co \ + check-uco + +check-co: \ + all-co + $(MAKE) \ + --directory co \ + check + +check-uco: \ all-uco $(MAKE) \ --directory uco \ @@ -174,6 +193,9 @@ clean: @$(MAKE) \ --directory uco \ clean + @$(MAKE) \ + --directory co \ + clean @rm -f .*.done.log @test ! -r dependencies/UCO/README.md \ || $(MAKE) \ diff --git a/co/Makefile b/co/Makefile new file mode 100644 index 00000000..eecfaa47 --- /dev/null +++ b/co/Makefile @@ -0,0 +1,101 @@ +#!/usr/bin/make -f + +# 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) + +RDF_TOOLKT_JAR := $(top_srcdir)/dependencies/UCO/lib/rdf-toolkit.jar + +rdf_files := \ + co.rdf + +all: \ + $(rdf_files) \ + .symlinking.done.log \ + co.ttl + +.PHONY: \ + clean-symlinking + +.documentation.done.log: \ + $(top_srcdir)/.venv.done.log \ + $(top_srcdir)/dependencies/UCO/ontology/co/co.ttl + rm -rf documentation + mkdir documentation + source $(top_srcdir)/venv/bin/activate \ + && ontospy gendocs \ + --outputpath $$PWD/documentation \ + --theme darkly \ + --title co-shapes-docs \ + --type 2 \ + $(top_srcdir)/dependencies/UCO/ontology/co/co.ttl + touch $@ + +.%.symlinking.done.log: \ + %.ttl \ + .documentation.done.log + source $(top_srcdir)/venv/bin/activate \ + && python3 $(top_srcdir)/src/map_concepts_as_symlinks.py \ + $< + +.symlinking.done.log: \ + .co.symlinking.done.log + +check: \ + $(rdf_files) + # Test that generated RDF-XML is valid XML. + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --input-format xml \ + --no-out \ + co.rdf + +clean: \ + clean-symlinking + @rm -f \ + *.rdf \ + *.ttl \ + .*.done.log + @rm -rf \ + documentation + +clean-symlinking: + @rm -f \ + .symlinking.done.log + @find \ + . \ + -name '*.html' \ + -type l \ + -exec rm '{}' \; + +co.rdf: \ + $(top_srcdir)/dependencies/UCO/ontology/co/co.ttl \ + $(RDF_TOOLKT_JAR) \ + $(top_srcdir)/src/namespaces.sed + java -jar $(RDF_TOOLKT_JAR) \ + --inline-blank-nodes \ + --source $< \ + --source-format turtle \ + --target __$@ \ + --target-format rdf-xml + sed \ + -f $(top_srcdir)/src/namespaces.sed \ + __$@ \ + > _$@ + rm __$@ + mv _$@ $@ + +co.ttl: \ + $(top_srcdir)/dependencies/UCO/ontology/co/co.ttl + cp $< $@ diff --git a/uco/namespaces.sed b/src/namespaces.sed similarity index 96% rename from uco/namespaces.sed rename to src/namespaces.sed index 9e8228a4..97d93f30 100644 --- a/uco/namespaces.sed +++ b/src/namespaces.sed @@ -31,4 +31,5 @@ s_&tool;_https://ontology.unifiedcyberontology.org/uco/tool/_g s_&types;_https://ontology.unifiedcyberontology.org/uco/types/_g s_&victim;_https://ontology.unifiedcyberontology.org/uco/victim/_g s_&vocabulary;_https://ontology.unifiedcyberontology.org/uco/vocabulary/_g +s_&uco-co;_https://ontology.unifiedcyberontology.org/co/_g s_&xsd;_http://www.w3.org/2001/XMLSchema#_g diff --git a/uco/Makefile b/uco/Makefile index 5c2ccfe0..189c6888 100644 --- a/uco/Makefile +++ b/uco/Makefile @@ -94,7 +94,7 @@ all: \ action.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/action/action.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -102,7 +102,7 @@ action.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -142,7 +142,7 @@ clean-symlinking: core.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/core/core.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -150,7 +150,7 @@ core.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -163,7 +163,7 @@ core.ttl: \ identity.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/identity/identity.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -171,7 +171,7 @@ identity.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -184,7 +184,7 @@ identity.ttl: \ location.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/location/location.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -192,7 +192,7 @@ location.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -205,7 +205,7 @@ location.ttl: \ marking.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/marking/marking.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -213,7 +213,7 @@ marking.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -226,7 +226,7 @@ marking.ttl: \ observable.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/observable/observable.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -234,7 +234,7 @@ observable.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -247,7 +247,7 @@ observable.ttl: \ pattern.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/pattern/pattern.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -255,7 +255,7 @@ pattern.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -268,7 +268,7 @@ pattern.ttl: \ role.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/role/role.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -276,7 +276,7 @@ role.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -289,7 +289,7 @@ role.ttl: \ time.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/time/time.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -297,7 +297,7 @@ time.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -310,7 +310,7 @@ time.ttl: \ tool.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/tool/tool.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -318,7 +318,7 @@ tool.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -331,7 +331,7 @@ tool.ttl: \ types.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/types/types.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -339,7 +339,7 @@ types.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -352,7 +352,7 @@ types.ttl: \ uco.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/master/uco.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -360,7 +360,7 @@ uco.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -373,7 +373,7 @@ uco.ttl: \ victim.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/victim/victim.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -381,7 +381,7 @@ victim.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@ @@ -394,7 +394,7 @@ victim.ttl: \ vocabulary.rdf: \ $(top_srcdir)/dependencies/UCO/ontology/uco/vocabulary/vocabulary.ttl \ $(RDF_TOOLKT_JAR) \ - namespaces.sed + $(top_srcdir)/src/namespaces.sed java -jar $(RDF_TOOLKT_JAR) \ --inline-blank-nodes \ --source $< \ @@ -402,7 +402,7 @@ vocabulary.rdf: \ --target __$@ \ --target-format rdf-xml sed \ - -f namespaces.sed \ + -f $(top_srcdir)/src/namespaces.sed \ __$@ \ > _$@ rm __$@