Skip to content

Commit

Permalink
Import RO axioms (#145)
Browse files Browse the repository at this point in the history
* import ro terms

* add catalog

* update ro_import

* update relationship labels and ro_import

* update ro_import pipeline

---------

Co-authored-by: Anita Caron <[email protected]>
  • Loading branch information
Anita Caron and anitacaron authored Jul 12, 2023
1 parent b8527d0 commit 83708bd
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ src/__pycache__/
*.pyc
.vscode
/site

src/mirror/
68 changes: 43 additions & 25 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OLD_VERSION = False

TODAY ?= $(shell date +%Y-%m-%d)
VERSION = $(TODAY)

CATALOG = --catalog catalog-v001.xml
OWL_CLASS_FILES_OLD = $(patsubst %, ../owl/last_official_ASCTB_release/ccf_%_classes.owl, $(JOBS_OLD))
OWL_ANNOTATION_FILES_OLD = $(patsubst %, ../owl/%_annotations.owl, $(JOBS_OLD))
OWL_CLASS_FILES = $(patsubst %, ../owl/ccf_%_classes.owl, $(JOBS))
Expand Down Expand Up @@ -40,44 +40,44 @@ validation_reports_release_%: ../logs/%/README.md
.PRECIOUS: ../docs/%/graph.md

../owl/ccf_%_classes_t.owl: ../templates/class_template_%.csv ../logs/%/README.md
${ROBOT} template --add-prefix "CCFH: http://ccf_tools_helpers/class_helper.owl#" \
$(ROBOT) $(CATALOG) template --add-prefix "CCFH: http://ccf_tools_helpers/class_helper.owl#" \
--add-prefix "dc: http://purl.org/dc/elements/1.1/" \
--add-prefix "skos: http://www.w3.org/2004/02/skos/core#" \
--input helper.owl --template $< \
--output $@

../owl/ub_%_ASCTB_subset.owl: ../templates/temp_ub_%_ASCTB_subset.csv ../docs/%/graph.md
if [ $(OLD_VERSION) = False ]; then ${ROBOT} template --input helper.owl --template $< --output $@ && \
if [ $(OLD_VERSION) = False ]; then $(ROBOT) $(CATALOG) template --input helper.owl --template $< --output $@ && \
rm $<; fi

../owl/cl_%_ASCTB_subset.owl: ../templates/temp_cl_%_ASCTB_subset.csv
if [ $(OLD_VERSION) = False ]; then ${ROBOT} template --input helper.owl --template $< --output $@ && \
if [ $(OLD_VERSION) = False ]; then $(ROBOT) $(CATALOG) template --input helper.owl --template $< --output $@ && \
rm $<; fi

../owl/%_no-valid.owl: ../templates/%_no-valid.csv
if [ $(OLD_VERSION) = False ]; then ${ROBOT} template --input helper.owl --template $< --output $@ && \
if [ $(OLD_VERSION) = False ]; then $(ROBOT) $(CATALOG) template --input helper.owl --template $< --output $@ && \
rm $<; fi

../owl/%_ASCTB_subset.json: ../owl/ub_%_ASCTB_subset.owl ../owl/cl_%_ASCTB_subset.owl
if [ $(OLD_VERSION) = False ]; then ${ROBOT} merge $(patsubst %, -i %, $^) \
if [ $(OLD_VERSION) = False ]; then $(ROBOT) merge $(patsubst %, -i %, $^) \
annotate --ontology-iri http://purl.org/ccf/latest/$*_ASCTB_subset.owl \
convert --format json -o $@; fi

.PRECIOUS: ../owl/%_ASCTB_subset.json

../owl/%_sec_reduced.owl: ../owl/%_sec.owl
if [ $(OLD_VERSION) = False ]; then ${ROBOT} merge --input helper.owl --input $< reduce --reasoner ELK -o ../owl/$*_sec_reduced.owl && \
if [ $(OLD_VERSION) = False ]; then $(ROBOT) $(CATALOG) merge --input helper.owl --input $< reduce --reasoner ELK -o ../owl/$*_sec_reduced.owl && \
rm ../owl/$*_sec.owl; fi

../owl/ccf_%_classes.owl: ../owl/ccf_%_classes_t.owl ../owl/%_annotations.owl ../owl/%_no-valid.owl ../owl/%_sec_reduced.owl
if [ $(OLD_VERSION) = False ]; then ${ROBOT} merge --input helper.owl -i ../owl/ccf_$*_classes_t.owl -i ../owl/$*_annotations.owl -o $@ \
if [ $(OLD_VERSION) = False ]; then $(ROBOT) $(CATALOG) merge --input helper.owl -i ../owl/ccf_$*_classes_t.owl -i ../owl/$*_annotations.owl -o $@ \
merge --input ../owl/$*_sec_reduced.owl -o ../owl/$*_extended.owl \
reduce --reasoner ELK \
merge -i ../owl/ccf_$*_classes_t.owl \
merge --input ../owl/$*_no-valid.owl \
annotate --ontology-iri http://purl.org/ccf/latest/ccf_$*_classes.owl \
convert --format json -o $*.json && \
${ROBOT} annotate --input ../owl/$*_sec_reduced.owl --ontology-iri http://purl.org/ccf/latest/$*_sec_reduced.owl convert -o $*_sec_reduced.json && \
$(ROBOT) annotate --input ../owl/$*_sec_reduced.owl --ontology-iri http://purl.org/ccf/latest/$*_sec_reduced.owl convert -o $*_sec_reduced.json && \
python graph_construct.py $*.json $*_sec_reduced.json $*_f.json "color" "green" && \
og2dot.js -s ../style/ubergraph-style.json $*_f.json > $*.dot && \
dot $*.dot -Tpng -Grankdir=LR > ../graphs/ccf_$*_graph.png && \
Expand All @@ -88,7 +88,7 @@ validation_reports_release_%: ../logs/%/README.md
rm $*.dot; fi

../owl/last_official_ASCTB_release/ccf_%_classes.owl: ../owl/ccf_%_classes_t.owl ../owl/%_annotations.owl
if [ $(OLD_VERSION) = True ]; then ${ROBOT} merge --input helper.owl -i ../owl/ccf_$*_classes_t.owl -i ../owl/$*_annotations.owl -o $@ \
if [ $(OLD_VERSION) = True ]; then $(ROBOT) merge --input helper.owl -i ../owl/ccf_$*_classes_t.owl -i ../owl/$*_annotations.owl -o $@ \
annotate --ontology-iri http://purl.org/ccf/latest_official_ASCTB_release/ccf_$*_classes.owl \
convert --format json -o $*.json && \
og2dot.js -s ../style/ubergraph-style.json $*.json > $*.dot &&\
Expand All @@ -101,30 +101,30 @@ release_notes:
python release_notes_generation.py
rm tables_version.txt

../owl/CCF_AS_CT.owl: ${OWL_CLASS_FILES} ${OWL_CLASS_SEC_FILES} release_notes
if [ $(OLD_VERSION) = False ]; then ${ROBOT} merge $(patsubst %, -i %, ${OWL_CLASS_FILES}) \
merge $(patsubst %, -i %, ${OWL_CLASS_SEC_FILES}) \
../owl/CCF_AS_CT.owl: $(OWL_CLASS_FILES) $(OWL_CLASS_SEC_FILES) release_notes
if [ $(OLD_VERSION) = False ]; then $(ROBOT) $(CATALOG) merge $(patsubst %, -i %, $(OWL_CLASS_FILES)) \
merge $(patsubst %, -i %, $(OWL_CLASS_SEC_FILES)) \
reduce --reasoner ELK \
annotate --ontology-iri "http://purl.org/ccf/latest/CCF_AS_CT.owl" \
--version-iri "http://purl.org/ccf/releases/$(VERSION)/CCF_AS_CT.owl" \
--output $@ && \
rm ${OWL_ANNOTATION_FILES} && \
rm ${OWL_CLASS_SEC_FILES}; fi
rm $(OWL_ANNOTATION_FILES) && \
rm $(OWL_CLASS_SEC_FILES); fi

../owl/last_official_ASCTB_release/CCF_AS_CT.owl: ${OWL_CLASS_FILES_OLD}
if [ $(OLD_VERSION) = True ]; then ${ROBOT} merge $(patsubst %, -i %, $^) \
../owl/last_official_ASCTB_release/CCF_AS_CT.owl: $(OWL_CLASS_FILES_OLD)
if [ $(OLD_VERSION) = True ]; then $(ROBOT) merge $(patsubst %, -i %, $^) \
annotate --ontology-iri "http://purl.org/ccf/latest/CCF_AS_CT.owl" \
--version-iri "http://purl.org/ccf/releases/$(VERSION)/CCF_AS_CT.owl" \
--output $@ && \
rm ${OWL_ANNOTATION_FILES_OLD}; fi
rm $(OWL_ANNOTATION_FILES_OLD); fi

../owl/UB_ASCTB_subset.owl: ${OWL_UB_SUBSET_FILES} ${JSON_CLASSES_SUBSET}
if [ $(OLD_VERSION) = False ]; then ${ROBOT} merge $(patsubst %, -i %, ${OWL_UB_SUBSET_FILES}) --output $@ && \
rm ${OWL_UB_SUBSET_FILES}; fi
../owl/UB_ASCTB_subset.owl: $(OWL_UB_SUBSET_FILES) $(JSON_CLASSES_SUBSET)
if [ $(OLD_VERSION) = False ]; then $(ROBOT) $(CATALOG) merge $(patsubst %, -i %, $(OWL_UB_SUBSET_FILES)) --output $@ && \
rm $(OWL_UB_SUBSET_FILES); fi

../owl/CL_ASCTB_subset.owl: ${OWL_CL_SUBSET_FILES}
if [ $(OLD_VERSION) = False ]; then ${ROBOT} merge $(patsubst %, -i %, $^) --output $@ && \
rm ${OWL_CL_SUBSET_FILES}; fi
../owl/CL_ASCTB_subset.owl: $(OWL_CL_SUBSET_FILES)
if [ $(OLD_VERSION) = False ]; then $(ROBOT) $(CATALOG) merge $(patsubst %, -i %, $^) --output $@ && \
rm $(OWL_CL_SUBSET_FILES); fi

official_release:
make ../owl/CCF_AS_CT.owl ../owl/UB_ASCTB_subset.owl ../owl/CL_ASCTB_subset.owl -B
Expand All @@ -136,4 +136,22 @@ last_official_release:

build-docker-v%:
docker buildx use ccf-tools-dep-builder
docker buildx build --platform linux/amd64,linux/arm64 -t anitacaron/ccf-tools-dep:v$* --push ../
docker buildx build --platform linux/amd64,linux/arm64 -t anitacaron/ccf-tools-dep:v$* --push ../


### Import ODK standard
TODAY ?= $(shell date +%Y-%m-%d)
VERSION= $(TODAY)
ANNOTATE_ONTOLOGY_VERSION =
ANNOTATE_CONVERT_FILE = annotate --ontology-iri http://ccf_tools_helpers/class_helper/ro_import $(ANNOTATE_ONTOLOGY_VERSION) convert -f ofn --output $@.tmp.owl && mv $@.tmp.owl $@

mirror/ro.owl:
curl -L http://purl.obolibrary.org/obo/ro.owl --create-dirs -o mirror/ro.owl --retry 4 --max-time 200 && $(ROBOT) convert -i mirror/ro.owl -o $@.tmp.owl && mv $@.tmp.owl $@
.PRECIOUS: mirror/ro.owl

imports/ro_import.owl: mirror/ro.owl imports/ro_terms.txt
$(ROBOT) filter --input $< --term-file imports/ro_terms.txt --select "self annotations" \
annotate --ontology-iri http://ccf_tools_helpers/class_helper/imports/ro_import.owl \
annotate -V http://ccf_tools_helpers/class_helper/releases/imports/$(VERSION)/ro_import.owl --annotation owl:versionInfo $(VERSION) \
convert -f ofn --output $@.tmp.owl && mv $@.tmp.owl $@
.PHONY: imports/ro_import.owl
6 changes: 6 additions & 0 deletions src/catalog-v001.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group id="Folder Repository, directory=, recursive=false, Auto-Update=false, version=2" prefer="public" xml:base="">
<uri name="http://ccf_tools_helpers/class_helper/imports/ro_import.owl" uri="imports/ro_import.owl"/>
</group>
</catalog>
38 changes: 1 addition & 37 deletions src/helper.owl
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)


Ontology(<http://ccf_tools_helpers/class_helper.owl>
Import(<http://ccf_tools_helpers/class_helper/imports/ro_import.owl>)

Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/BFO_0000050>))
Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/BFO_0000051>))
Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/RO_0002131>))
Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/RO_0002170>))
Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/RO_0002202>))
Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/RO_0001025>))
Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/RO_0002150>))
Declaration(ObjectProperty(<https://purl.org/ccf/latest/ccf.owl#ccf_part_of>))
Declaration(ObjectProperty(<https://purl.org/ccf/latest/ccf.owl#ccf_located_in>))
Declaration(AnnotationProperty(:IN_OBO))
Expand All @@ -29,36 +23,6 @@ Declaration(Class(<http://purl.obolibrary.org/obo/NCBITaxon_9606>))
# Object Properties
############################

# Object Property: <http://purl.obolibrary.org/obo/BFO_0000050> (part_of)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/BFO_0000050> "part_of")
TransitiveObjectProperty(<http://purl.obolibrary.org/obo/BFO_0000050>)

# Object Property: <http://purl.obolibrary.org/obo/BFO_0000051> (has_part)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/BFO_0000051> "has_part")

# Object Property: <http://purl.obolibrary.org/obo/RO_0002131> (overlaps)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/RO_0002131> "overlaps")

# Object Property: <http://purl.obolibrary.org/obo/RO_0002170> (connected_to)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/RO_0002170> "connected_to")
TransitiveObjectProperty(<http://purl.obolibrary.org/obo/RO_0002170>)

# Object Property: <http://purl.obolibrary.org/obo/RO_0002202> (develops_from)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/RO_0002202> "develops_from")

# Object Property: <http://purl.obolibrary.org/obo/RO_0001025> (located_in)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/RO_0001025> "located_in")

# Object Property: <http://purl.obolibrary.org/obo/RO_0002150> (continuous_with)

AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/RO_0002150> "continuous_with")

# Object Property: <https://purl.org/ccf/latest/ccf.owl#ccf_part_of> (https://purl.org/ccf/latest/ccf.owl#ccf_part_of)

AnnotationAssertion(rdfs:label <https://purl.org/ccf/latest/ccf.owl#ccf_part_of> "ccf_part_of")
Expand Down
Loading

0 comments on commit 83708bd

Please sign in to comment.