From 9bf2a1b780feeee1f262d08a710bfe9c73c73c51 Mon Sep 17 00:00:00 2001
From: cmungall <cjm@berkeleybop.org>
Date: Fri, 17 Mar 2023 07:57:22 -0700
Subject: [PATCH 1/2] Dividing user makefile from release manager makefile,
 fixes #72

---
 Makefile                          | 25 ++++++++++++++-----------
 src/semsql/builder/build.Makefile | 22 ----------------------
 2 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index c5daece..ba3664c 100644
--- a/Makefile
+++ b/Makefile
@@ -81,22 +81,25 @@ realclean-%:
 # ---
 # Prefixes
 # ---
-# TODO: sync with bioregistry
-# NOTE: move this to build folder
 
-build_prefixes: $(PREFIX_DIR)/prefixes.csv
+build_prefixes: $(PREFIX_DIR)/prefixes.csv $(PREFIX_DIR)/prefixes.yaml
 
-#$(PREFIX_DIR)/obo_prefixes.owl:
-#	robot convert -I http://purl.obolibrary.org/meta/obo_prefixes.ttl -o $@
+$(PREFIX_DIR)/obo_prefixes.owl: $(STAMP)
+	robot convert -I http://purl.obolibrary.org/meta/obo_prefixes.ttl -o $@
 
-#$(PREFIX_DIR)/obo_prefixes.db: $(PREFIX_DIR)/obo_prefixes.owl
-#	sqlite3 $@ < $(PREFIX_DIR)/prefix_ddl.sql && ./bin/rdftab $@ < $<
+$(PREFIX_DIR)/obo_prefixes.db: $(PREFIX_DIR)/obo_prefixes.owl
+	sqlite3 $@ < $(PREFIX_DIR)/prefix_ddl.sql && rdftab $@ < $<
 
-#$(PREFIX_DIR)/obo_prefixes.csv: $(PREFIX_DIR)/obo_prefixes.db
-#	sqlite3 $< -cmd ".separator ','" "SELECT p.value AS prefix, ns.value AS base FROM statements AS p JOIN statements AS ns ON (p.subject=ns.subject) WHERE p.predicate='<http://www.w3.org/ns/shacl#prefix>' AND ns.predicate='<http://www.w3.org/ns/shacl#namespace>'" > $@
+$(PREFIX_DIR)/obo_prefixes.csv: $(PREFIX_DIR)/obo_prefixes.db
+	sqlite3 $< -cmd ".separator ','" "SELECT p.value AS prefix, ns.value AS base FROM statements AS p JOIN statements AS ns ON (p.subject=ns.subject) WHERE p.predicate='<http://www.w3.org/ns/shacl#prefix>' AND ns.predicate='<http://www.w3.org/ns/shacl#namespace>'" > $@
+
+$(PREFIX_DIR)/prefixes.csv: $(PREFIX_DIR)/prefixes_curated.csv $(PREFIX_DIR)/prefixes_local.csv $(PREFIX_DIR)/obo_prefixes.csv
+	cat $^ > $@
+
+# see https://github.com/INCATools/relation-graph/issues/168
+$(PREFIX_YAML_PATH): $(PREFIX_CSV_PATH)
+	grep -v ^prefix, $< | grep -v ^obo, | perl -npe 's@,(.*)@: "$$1"@'  > $@.tmp && mv $@.tmp $@
 
-#$(PREFIX_DIR)/prefixes.csv: $(PREFIX_DIR)/prefixes_curated.csv $(PREFIX_DIR)/obo_prefixes.csv#
-#	cat $^ > $@
 
 
 # ---
diff --git a/src/semsql/builder/build.Makefile b/src/semsql/builder/build.Makefile
index ce1d1fe..1d53d51 100644
--- a/src/semsql/builder/build.Makefile
+++ b/src/semsql/builder/build.Makefile
@@ -86,25 +86,3 @@ PREFIX_YAML_PATH = $(PREFIX_DIR)/prefixes.yaml
 %-properties.txt:
 	touch $@
 
-# ---
-# Prefixes
-# ---
-
-build_prefixes: $(PREFIX_DIR)/prefixes.csv $(PREFIX_DIR)/prefixes.yaml
-
-$(PREFIX_DIR)/obo_prefixes.owl:
-	robot convert -I http://purl.obolibrary.org/meta/obo_prefixes.ttl -o $@
-
-$(PREFIX_DIR)/obo_prefixes.db: $(PREFIX_DIR)/obo_prefixes.owl
-	sqlite3 $@ < $(PREFIX_DIR)/prefix_ddl.sql && rdftab $@ < $<
-
-$(PREFIX_DIR)/obo_prefixes.csv: $(PREFIX_DIR)/obo_prefixes.db
-	sqlite3 $< -cmd ".separator ','" "SELECT p.value AS prefix, ns.value AS base FROM statements AS p JOIN statements AS ns ON (p.subject=ns.subject) WHERE p.predicate='<http://www.w3.org/ns/shacl#prefix>' AND ns.predicate='<http://www.w3.org/ns/shacl#namespace>'" > $@
-
-$(PREFIX_DIR)/prefixes.csv: $(PREFIX_DIR)/prefixes_curated.csv $(PREFIX_DIR)/prefixes_local.csv $(PREFIX_DIR)/obo_prefixes.csv
-	cat $^ > $@
-
-# see https://github.com/INCATools/relation-graph/issues/168
-$(PREFIX_YAML_PATH): $(PREFIX_CSV_PATH)
-	grep -v ^prefix, $< | grep -v ^obo, | perl -npe 's@,(.*)@: "$$1"@'  > $@.tmp && mv $@.tmp $@
-

From 7d32f44bddcd60dca50082181e27ac94c3add774 Mon Sep 17 00:00:00 2001
From: cmungall <cjm@berkeleybop.org>
Date: Fri, 17 Mar 2023 09:16:08 -0700
Subject: [PATCH 2/2] rebuild

---
 ontologies.Makefile                           | 24 ++++++++++++++++++-
 src/semsql/builder/prefixes/prefixes.csv      |  1 +
 .../builder/prefixes/prefixes_local.csv       |  2 ++
 src/semsql/builder/registry/ontologies.yaml   | 11 ++++++++-
 4 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/ontologies.Makefile b/ontologies.Makefile
index a064ed3..9a820e3 100644
--- a/ontologies.Makefile
+++ b/ontologies.Makefile
@@ -152,6 +152,17 @@ db/bcio.owl: download/bcio.owl
 	cp $< $@
 
 
+download/oeo.owl: STAMP
+	curl -L -s http://openenergy-platform.org/ontology/oeo/ > $@.tmp
+	sha256sum -b $@.tmp > $@.sha256
+	mv $@.tmp $@
+
+.PRECIOUS: download/oeo.owl
+
+db/oeo.owl: download/oeo.owl
+	cp $< $@
+
+
 download/go.owl: STAMP
 	curl -L -s http://purl.obolibrary.org/obo/go/extensions/go-plus.owl > $@.tmp
 	sha256sum -b $@.tmp > $@.sha256
@@ -383,6 +394,17 @@ db/co_324.owl: download/co_324.owl
 	cp $< $@
 
 
+download/interpro.owl: STAMP
+	curl -L -s https://w3id.org/biopragmatics/resources/interpro/92.0/interpro.obo > $@.tmp
+	sha256sum -b $@.tmp > $@.sha256
+	mv $@.tmp $@
+
+.PRECIOUS: download/interpro.owl
+
+db/interpro.owl: download/interpro.owl
+	robot merge -i $< -o $@
+
+
 download/hgnc.genegroup.owl: STAMP
 	curl -L -s https://github.com/biopragmatics/obo-db-ingest/raw/main/export/hgnc.genegroup/hgnc.genegroup.owl.gz | gzip -dc > $@.tmp
 	sha256sum -b $@.tmp > $@.sha256
@@ -525,4 +547,4 @@ download/%.owl: STAMP
 db/%.owl: download/%.owl
 	robot merge -i $< -o $@
 
-EXTRA_ONTOLOGIES = chiro ncit fma maxo foodon chebiplus msio modl phenio comploinc bero aio reacto bcio go go-lego bao orcid cpont biolink biopax enanomapper mlo ito reactome-Homo-sapiens efo hcao edam sweetAll lov schema-dot-org cellosaurus cosmo dbpendiaont co_324 hgnc.genegroup hgnc dictybase eccode uniprot rhea swisslipid drugbank drugcentral complexportal drugmechdb rxnorm
+EXTRA_ONTOLOGIES = chiro ncit fma maxo foodon chebiplus msio modl phenio comploinc bero aio reacto bcio oeo go go-lego bao orcid cpont biolink biopax enanomapper mlo ito reactome-Homo-sapiens efo hcao edam sweetAll lov schema-dot-org cellosaurus cosmo dbpendiaont co_324 interpro hgnc.genegroup hgnc dictybase eccode uniprot rhea swisslipid drugbank drugcentral complexportal drugmechdb rxnorm
diff --git a/src/semsql/builder/prefixes/prefixes.csv b/src/semsql/builder/prefixes/prefixes.csv
index 45dcdc2..6bc5834 100644
--- a/src/semsql/builder/prefixes/prefixes.csv
+++ b/src/semsql/builder/prefixes/prefixes.csv
@@ -58,6 +58,7 @@ modl,https://archive.org/services/purl/purl/modular_ontology_design_library#
 biolink,https://w3id.org/biolink/vocab/
 loinc,https://loinc.org/
 BCIO,http://humanbehaviourchange.org/ontology/BCIO_
+OEO,http://openenergy-platform.org/ontology/oeo/OEO_
 orcid,https://orcid.org/
 evs.ncit,http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#
 old.fix,http://purl.org/obo/owl/FIX#
diff --git a/src/semsql/builder/prefixes/prefixes_local.csv b/src/semsql/builder/prefixes/prefixes_local.csv
index 1cd6567..bee36b6 100644
--- a/src/semsql/builder/prefixes/prefixes_local.csv
+++ b/src/semsql/builder/prefixes/prefixes_local.csv
@@ -6,6 +6,7 @@ modl,https://archive.org/services/purl/purl/modular_ontology_design_library#
 biolink,https://w3id.org/biolink/vocab/
 loinc,https://loinc.org/
 BCIO,http://humanbehaviourchange.org/ontology/BCIO_
+OEO,http://openenergy-platform.org/ontology/oeo/OEO_
 orcid,https://orcid.org/
 evs.ncit,http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#
 old.fix,http://purl.org/obo/owl/FIX#
@@ -13,6 +14,7 @@ mlo,http://www.a2rd.net.br/mlo#
 dbpediaont,http://dbpedia.org/ontology/
 dbpedia,http://dbpedia.org/
 co_324,https://cropontology.org/rdf/CO_324:
+InterPro,http://purl.obolibrary.org/obo/interpro_
 hgnc.genegroup,http://purl.obolibrary.org/obo/hgnc.genegroup_
 hgnc,http://purl.obolibrary.org/obo/hgnc_
 hgnc.genegroup,http://purl.obolibrary.org/obo/dictybase_
diff --git a/src/semsql/builder/registry/ontologies.yaml b/src/semsql/builder/registry/ontologies.yaml
index d9f3171..e3aff7f 100644
--- a/src/semsql/builder/registry/ontologies.yaml
+++ b/src/semsql/builder/registry/ontologies.yaml
@@ -58,6 +58,10 @@ ontologies:
     url: http://humanbehaviourchange.org/ontology/bcio.owl
     prefixmap:
       BCIO: http://humanbehaviourchange.org/ontology/BCIO_
+  oeo:
+    url: http://openenergy-platform.org/ontology/oeo/
+    prefixmap:
+      OEO: http://openenergy-platform.org/ontology/oeo/OEO_
   go:
     url: http://purl.obolibrary.org/obo/go/extensions/go-plus.owl
   go-lego:
@@ -91,7 +95,7 @@ ontologies:
       mlo: http://www.a2rd.net.br/mlo#
   ito:
     url: https://github.com/OpenBioLink/ITO/raw/master/ITO.owl.zip
-    zip_extract_file: ITO.owl
+    zip_extract_file: ITO.owl      
   reactome-Homo-sapiens:
     url: https://reactome.org/download/current/biopax.zip
     zip_extract_file: Homo_sapiens.owl
@@ -141,6 +145,11 @@ ontologies:
 
 ## PyOBO products      
 ## See https://github.com/INCATools/semantic-sql/issues/45
+  interpro:
+    url: https://w3id.org/biopragmatics/resources/interpro/92.0/interpro.obo
+    format: obo
+    prefixmap:
+      InterPro: http://purl.obolibrary.org/obo/interpro_
   hgnc.genegroup:
     url: https://github.com/biopragmatics/obo-db-ingest/raw/main/export/hgnc.genegroup/hgnc.genegroup.owl.gz
     compression: gzip
