Skip to content

Commit

Permalink
Replace several uses of owltools with robot. (#28893)
Browse files Browse the repository at this point in the history
  • Loading branch information
balhoff authored Sep 10, 2024
1 parent dbcf61a commit 088fc8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/ontology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ deploy-release:
gzip -c $< > $@.tmp && mv $@.tmp $@

%.json: %.owl
$(OWLTOOLS) $(USECAT) $< -o -f json $@
$(ROBOT) convert --input $< -f json -o $@
.PRECIOUS: %.json

# ----------------------------------------
Expand Down Expand Up @@ -215,8 +215,7 @@ $(GO_PLUS).owl: reasoned.owl imports/go-computed-taxon-constraints.owl
# GO artifacts to merge are hardcoded here. Would make sense to eventually consolidate go-plus
# as just the merge of go-base.
go-base.owl: enhanced.owl
$(OWLTOOLS) $(USECAT) $< --remove-imports-declarations -o -f ofn $@.tmp &&\
$(ROBOT) merge -i $@.tmp -i extensions/go-gci.owl -i extensions/go-bridge.owl -i extensions/ro_pending.owl -i imports/x-disjoint.ofn annotate -O $(BASE)/$@ -V $(RELEASE_URIBASE)/$@ -o $@ && rm $@.tmp
$(ROBOT) remove -i $< --select imports --trim false merge -i extensions/go-gci.owl -i extensions/go-bridge.owl -i extensions/ro_pending.owl -i imports/x-disjoint.ofn annotate -O $(BASE)/$@ -V $(RELEASE_URIBASE)/$@ -o $@

$(GO_GAF).owl: extensions/go-gaf-edit.ofn $(GO_PLUS).owl extensions/gorel.owl mirror/cl.owl mirror/taxslim.owl mirror/taxslim-disjoint-over-in-taxon.owl
$(ROBOT) merge -i $< --collapse-import-closure true --include-annotations false reason -r ELK --exclude-duplicate-axioms true --remove-redundant-subclass-axioms true --exclude-tautologies structural annotate -O $(BASE)/$@ -V $(RELEASE_URIBASE)/$@ -o $@
Expand Down Expand Up @@ -350,13 +349,12 @@ imports/%_terms_combined.txt: imports/%_terms.txt seed.txt

# Use ROBOT for imports

# Inserting extra taxon disjoints here because ROBOT is used (standard disjoints come from owltools; could migrate to all via SPARQL like this one)
imports/%_import_pre.owl: mirror/%.owl imports/%_terms_combined.txt $(SRC) ../sparql/add-taxon-disjoints.ru
$(ROBOT) extract -i $< -T imports/$*_terms_combined.txt --method BOT query --update ../sparql/add-taxon-disjoints.ru reason --exclude-duplicate-axioms true --exclude-tautologies structural annotate -O $(BASE)/imports/$*_import.owl -V $(RELEASE_URIBASE)/imports/$*_import.owl -o $@
imports/%_import_pre.owl: mirror/%.owl imports/%_terms_combined.txt $(SRC)
$(ROBOT) extract -i $< -T imports/$*_terms_combined.txt --method BOT reason --exclude-duplicate-axioms true --exclude-tautologies structural annotate -O $(BASE)/imports/$*_import.owl -V $(RELEASE_URIBASE)/imports/$*_import.owl -o $@
.PRECIOUS: imports/%_import_pre.owl

imports/ncbitaxon_import.owl: imports/ncbitaxon_import_pre.owl
$(OWLTOOLS) $< --create-taxon-disjoint-over-in-taxon -s -r NCBITaxon:1 -m --set-ontology-id $(BASE)/$@ -o $@
imports/ncbitaxon_import.owl: imports/ncbitaxon_import_pre.owl ../sparql/add-taxon-sibling-disjoints.ru ../sparql/add-taxon-disjoints.ru ../sparql/add-in-taxon-disjoints.ru
$(ROBOT) query -i $< --update ../sparql/add-taxon-sibling-disjoints.ru --update ../sparql/add-taxon-disjoints.ru --update ../sparql/add-in-taxon-disjoints.ru -o $@

# Ensure every row in the taxon constraints files has the same number of columns (only one line should be output by `sort`)
check_taxon_constraint_columns_%: ../taxon_constraints/%.tsv
Expand Down Expand Up @@ -417,7 +415,7 @@ imports/chebi_import.owl: imports/chebi_import_nogci.owl seed.owl bio-chebi.owl
.PRECIOUS: imports/chebi_import.owl

imports/%_import.obo: imports/%_import.owl
$(OWLTOOLS) $(USECAT) $< -o -f obo --no-check $@.tmp && grep -v ^owl-axioms: $@.tmp > $@
$(ROBOT) convert --input $< --format obo --check false --output $@.tmp && grep -v ^owl-axioms: $@.tmp > $@

# ----------------------------------------
# CACHEING EXTERNAL ONTOLOGIES
Expand Down
5 changes: 5 additions & 0 deletions src/sparql/add-taxon-disjoints.ru
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX in_taxon: <http://purl.obolibrary.org/obo/RO_0002162>
INSERT {
?subtaxon rdfs:subClassOf [
a owl:Restriction ;
owl:onProperty in_taxon: ;
owl:someValuesFrom ?subtaxon ;
] .
[
a owl:Restriction ;
owl:onProperty in_taxon: ;
Expand Down

0 comments on commit 088fc8c

Please sign in to comment.