From 69841d0af92e2fc51ca3a324abf85fab487681e7 Mon Sep 17 00:00:00 2001
From: cmungall <cjm@berkeleybop.org>
Date: Tue, 3 Jan 2023 17:10:33 -0800
Subject: [PATCH 1/2] Hacky short term solution for
 https://github.com/INCATools/ontology-access-kit/issues/427

---
 utils/ncbo2owl.pl | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100755 utils/ncbo2owl.pl

diff --git a/utils/ncbo2owl.pl b/utils/ncbo2owl.pl
new file mode 100755
index 0000000..2f4c0d7
--- /dev/null
+++ b/utils/ncbo2owl.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl -np
+# See: https://github.com/INCATools/ontology-access-kit/issues/427
+s@skos:prefLabel @rdfs:label @;
+s@<http://purl.bioontology.org/ontology/\w+/isa> @rdfs:subClassOf @;
+s@umls:cui """(\w+)"""\^\^xsd:string@skos:exactMatch umls:$1@;
+s@umls:cui """(\w+)"""\^\^xsd:string@skos:exactMatch umls:$1@;
+s@(<http://purl.bioontology.org/ontology/RXNORM/(has_ingredient|consists_of|has_dose_form|tradename_of)>) (<http://purl.bioontology.org/ontology/RXNORM/\d+>)@rdfs:subClassOf [a owl:Restriction; owl:onProperty $1; owl:someValuesFrom $3]@;

From 25f52d66ca86a37d6fb8a21fb222c1ec16d3c943 Mon Sep 17 00:00:00 2001
From: cmungall <cjm@berkeleybop.org>
Date: Tue, 3 Jan 2023 17:11:12 -0800
Subject: [PATCH 2/2] regen

---
 Makefile                                       |  8 ++++----
 ontologies.Makefile                            | 13 ++++++++++++-
 src/semsql/builder/prefixes/prefixes.csv       |  1 +
 src/semsql/builder/prefixes/prefixes_local.csv |  1 +
 src/semsql/builder/registry/ontologies.yaml    |  3 +++
 5 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 2062528..c884839 100644
--- a/Makefile
+++ b/Makefile
@@ -34,10 +34,10 @@ selected: $(patsubst %,all-%,$(SELECTED_ONTS))
 
 all-%: db/%.db
 	sqlite3 $< "SELECT COUNT(*) FROM statements"
-#stage/%.db.gz: db/%.db
-#	gzip -c $< > $@.tmp && mv $@.tmp $@
-stage/%.db.gz: 
-	gzip -c db/$*.db > $@.tmp && mv $@.tmp $@
+stage/%.db.gz: db/%.db
+	gzip -c $< > $@.tmp && mv $@.tmp $@
+#stage/%.db.gz: 
+#	gzip -c db/$*.db > $@.tmp && mv $@.tmp $@
 .PRECIOUS: stage/%.db.gz
 
 list-onts:
diff --git a/ontologies.Makefile b/ontologies.Makefile
index a0c1c0c..a9b27b1 100644
--- a/ontologies.Makefile
+++ b/ontologies.Makefile
@@ -416,6 +416,17 @@ db/complexportal.owl: download/complexportal.owl
 	cp $< $@
 
 
+download/drugmechdb.owl: STAMP
+	curl -L -s None > $@.tmp
+	sha256sum -b $@.tmp > $@.sha256
+	mv $@.tmp $@
+
+.PRECIOUS: download/drugmechdb.owl
+
+db/drugmechdb.owl: download/drugmechdb.owl
+	cp $< $@
+
+
 download/%.owl: STAMP
 	curl -L -s http://purl.obolibrary.org/obo/$*.owl > $@.tmp
 	sha256sum -b $@.tmp > $@.sha256
@@ -426,4 +437,4 @@ download/%.owl: STAMP
 db/%.owl: download/%.owl
 	robot merge -i $< -o $@
 
-EXTRA_ONTOLOGIES = chiro ncit maxo foodon chebiplus msio phenio comploinc bero aio reacto go go-lego bao orcid cpont biolink biopax enanomapper mlo ito reactome-Homo-sapiens efo edam sweetAll lov schema-dot-org cosmo co_324 hgnc.genegroup hgnc dictybase eccode uniprot rhea drugbank drugcentral complexportal
+EXTRA_ONTOLOGIES = chiro ncit maxo foodon chebiplus msio phenio comploinc bero aio reacto go go-lego bao orcid cpont biolink biopax enanomapper mlo ito reactome-Homo-sapiens efo edam sweetAll lov schema-dot-org cosmo co_324 hgnc.genegroup hgnc dictybase eccode uniprot rhea drugbank drugcentral complexportal drugmechdb
diff --git a/src/semsql/builder/prefixes/prefixes.csv b/src/semsql/builder/prefixes/prefixes.csv
index 88de6c2..98da06e 100644
--- a/src/semsql/builder/prefixes/prefixes.csv
+++ b/src/semsql/builder/prefixes/prefixes.csv
@@ -70,6 +70,7 @@ uniprot.obo,http://purl.obolibrary.org/obo/uniprot_
 drugbank,http://purl.obolibrary.org/obo/drugbank_
 drugbank,http://purl.obolibrary.org/obo/drugcentral_
 complexportal,http://purl.obolibrary.org/obo/complexportal_
+MESH,http://id.nlm.nih.gov/mesh/
 RBO,http://purl.obolibrary.org/obo/RBO_
 RBO,http://purl.obolibrary.org/obo/RBO_
 CLYH,http://purl.obolibrary.org/obo/CLYH_
diff --git a/src/semsql/builder/prefixes/prefixes_local.csv b/src/semsql/builder/prefixes/prefixes_local.csv
index 8038244..0901583 100644
--- a/src/semsql/builder/prefixes/prefixes_local.csv
+++ b/src/semsql/builder/prefixes/prefixes_local.csv
@@ -18,3 +18,4 @@ uniprot.obo,http://purl.obolibrary.org/obo/uniprot_
 drugbank,http://purl.obolibrary.org/obo/drugbank_
 drugbank,http://purl.obolibrary.org/obo/drugcentral_
 complexportal,http://purl.obolibrary.org/obo/complexportal_
+MESH,http://id.nlm.nih.gov/mesh/
diff --git a/src/semsql/builder/registry/ontologies.yaml b/src/semsql/builder/registry/ontologies.yaml
index c4dde36..e32cea0 100644
--- a/src/semsql/builder/registry/ontologies.yaml
+++ b/src/semsql/builder/registry/ontologies.yaml
@@ -164,3 +164,6 @@ ontologies:
     compression: gzip
     prefixmap:
       complexportal: http://purl.obolibrary.org/obo/complexportal_
+  drugmechdb:
+    prefixmap:
+      MESH: http://id.nlm.nih.gov/mesh/
