Skip to content

Commit

Permalink
Merge pull request #54 from INCATools/registry
Browse files Browse the repository at this point in the history
registry
  • Loading branch information
cmungall authored Sep 9, 2022
2 parents a30df2a + dbfde35 commit 4603b84
Show file tree
Hide file tree
Showing 9 changed files with 518 additions and 37 deletions.
49 changes: 12 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ stage/%.db.gz: db/%.db

# INSTALL
include install.Makefile
#include ontologies.Makefile

# ---
# tests
Expand Down Expand Up @@ -132,50 +133,25 @@ db/go.owl: STAMP
db/monarch.owl:
robot merge -I http://purl.obolibrary.org/obo/upheno/monarch.owl -o $@

db/phenio.owl:
curl -L -s https://github.com/monarch-initiative/phenio/releases/download/latest/phenio.owl > $@.tmp && mv $@.tmp $@

db/bero.owl:
curl -L -s https://github.com/berkeleybop/bero/releases/download/2022-05-26/bero.owl > $@.tmp && mv $@.tmp $@

db/aio.owl:
curl -L -s https://raw.githubusercontent.com/berkeleybop/artificial-intelligence-ontology/main/aio.owl > $@.tmp && mv $@.tmp $@

db/reacto.owl:
curl -L -s http://purl.obolibrary.org/obo/go/extensions/reacto.owl > $@.tmp && mv $@.tmp $@

db/go-lego.owl:
curl -L -s http://purl.obolibrary.org/obo/go/extensions/go-lego.owl > $@.tmp && mv $@.tmp $@

db/bao.owl:
robot merge -I http://www.bioassayontology.org/bao/bao_complete.owl -o $@

db/biolink.owl:
robot merge -I https://w3id.org/biolink/biolink-model.owl.ttl -o $@
db/reactome-Homo-sapiens.owl: download/reactome-biopax.zip db/biopax.owl
unzip -p $< Homo_sapiens.owl > $@.tmp &&\
robot merge -i $@.tmp -i db/biopax.owl -o $@

# https://github.com/ontodev/rdftab.rs/issues/21
db/biopax.owl:
robot convert -I http://www.biopax.org/release/biopax-level3.owl -o $@
download/reactome-biopax.zip:
curl -L -s https://reactome.org/download/current/biopax.zip > $@

# https://github.com/enanomapper/ontologies/issues/323
db/enanomapper.owl:
robot merge -I https://raw.githubusercontent.com/enanomapper/ontologies/master/enanomapper.owl -o $@
## Additional ontologies

db/efo.owl: STAMP
robot merge -I http://www.ebi.ac.uk/efo/efo.owl -o $@
src/semsql/builder/registry/registry_schema.py: src/semsql/builder/registry/registry_schema.yaml
$(RUN) gen-python $< > $@

db/edam.owl:
curl -L -s http://edamontology.org/EDAM.owl > $@
ontologies.Makefile: src/semsql/builder/registry/ontologies.yaml
$(RUN) semsql generate-makefile $< > $@.tmp && mv $@.tmp $@

db/sweetAll.owl:
robot merge -I http://sweetontology.net/sweetAll -o $@
include ontologies.Makefile

db/reactome-Homo-sapiens.owl: download/reactome-biopax.zip db/biopax.owl
unzip -p $< Homo_sapiens.owl > $@.tmp &&\
robot merge -i $@.tmp -i db/biopax.owl -o $@

download/reactome-biopax.zip:
curl -L -s https://reactome.org/download/current/biopax.zip > $@

#fma.owl:#
# http://purl.org/sig/ont/fma.owl
Expand Down Expand Up @@ -232,7 +208,6 @@ $(SQLA_DIR)/%.py: $(YAML_DIR)/%.yaml
bin/%:
echo `poetry run which $*` '$$*' > $@ && chmod +x $@


### DEPLOY

DATE = $(shell date -u +"%Y-%m-%d")
Expand Down
43 changes: 43 additions & 0 deletions ontologies.Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
db/phenio.owl: STAMP
curl -L -s https://github.com/monarch-initiative/phenio/releases/download/latest/phenio.owl > $@.tmp && mv $@.tmp $@

db/bero.owl: STAMP
curl -L -s https://github.com/berkeleybop/bero/releases/download/2022-05-26/bero.owl > $@.tmp && mv $@.tmp $@

db/aio.owl: STAMP
curl -L -s https://raw.githubusercontent.com/berkeleybop/artificial-intelligence-ontology/main/aio.owl > $@.tmp && mv $@.tmp $@

db/reacto.owl: STAMP
curl -L -s http://purl.obolibrary.org/obo/go/extensions/reacto.owl > $@.tmp && mv $@.tmp $@

db/go-lego.owl: STAMP
curl -L -s http://purl.obolibrary.org/obo/go/extensions/go-lego.owl > $@.tmp && mv $@.tmp $@

db/bao.owl: STAMP
robot merge -I http://www.bioassayontology.org/bao/bao_complete.owl -o $@

db/biolink.owl: STAMP
robot merge -I https://w3id.org/biolink/biolink-model.owl.ttl -o $@

db/biopax.owl: STAMP
curl -L -s http://www.biopax.org/release/biopax-level3.owl > $@.tmp && mv $@.tmp $@

db/enanomapper.owl: STAMP
robot merge -I http://enanomapper.github.io/ontologies/enanomapper.owl -o $@

db/efo.owl: STAMP
robot merge -I http://www.ebi.ac.uk/efo/efo.owl -o $@

db/edam.owl: STAMP
curl -L -s http://edamontology.org/EDAM.owl > $@.tmp && mv $@.tmp $@

db/sweetAll.owl: STAMP
robot merge -I http://sweetontology.net/sweetAll -o $@

db/lov.owl: STAMP
robot merge -I https://lov.linkeddata.es/lov.n3.gz -o $@

db/schema-dot-org.owl: STAMP
curl -L -s https://schema.org/version/latest/schemaorg-current-https.rdf > $@.tmp && mv $@.tmp $@


27 changes: 27 additions & 0 deletions src/semsql/builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
from typing import Optional

import requests
from linkml_runtime.loaders import yaml_loader
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from semsql.builder.registry import registry_schema

this_path = Path(__file__).parent


Expand Down Expand Up @@ -103,3 +106,27 @@ def connect(owl_file: str):
Session = sessionmaker(bind=engine)
session = Session()
return session

def compile_registry(registry_path: str) -> str:
"""
Generate makefile content from registry
:param registry_path:
:return:
"""
registry: registry_schema.Registry
registry = yaml_loader.load(registry_path, target_class=registry_schema.Registry)
mkfile = ""
onts = []
for ont in registry.ontologies.values():
target = f"db/{ont.id}.owl"
dependencies = ["STAMP"]
if ont.has_imports or (ont.format and ont.format != 'rdfxml'):
command = f"robot merge -I {ont.url} -o $@"
else:
command = f"curl -L -s {ont.url} > [email protected] && mv [email protected] $@"
dependencies_str = " ".join(dependencies)
mkfile += f"{target}: {dependencies_str}\n\t{command}\n\n"
onts.append(ont.id)
mkfile += f"EXTRA_ONTOLOGIES = {' '.join(onts)}"
return mkfile
9 changes: 9 additions & 0 deletions src/semsql/builder/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ def make(path, docker):
builder.make(path, docker_config=docker_config)


@main.command()
@click.argument("registry")
def generate_makefile(registry):
"""
Generates makefile
"""
print(builder.compile_registry(registry))


@main.command()
@click.option("-o", "--output")
@click.argument("ontology")
Expand Down
10 changes: 10 additions & 0 deletions src/semsql/builder/prefixes/prefixes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ allotrope.role,http://purl.allotrope.org/ontologies/role#
allotrope.equipment,http://purl.allotrope.org/ontologies/equipment#
allotrope,http://purl.allotrope.org/ontologies/
aio,https://w3id.org/aio/
NPO,http://purl.bioontology.org/ontology/npo#NPO_
CHEMINF,http://semanticscience.org/resource/CHEMINF_
aopkb,http://aopkb.org/aop_ontology#
ENM.net,http://purl.enanomapper.net/onto/ENM_
cito,http://purl.org/spar/cito/
fabio,http://purl.org/spar/fabio/
SIO,http://semanticscience.org/resource/SIO_
doap,http://usefulinc.com/ns/doap#
wikidata,http://www.wikidata.org/entity/
schema,https://schema.org/
ICD10CM,http://purl.bioontology.org/ontology/ICD10CM/
ICD10WHO,https://icd.who.int/browse10/2019/en#/
PSO,http://purl.obolibrary.org/obo/PSO_
Expand Down
10 changes: 10 additions & 0 deletions src/semsql/builder/prefixes/prefixes_curated.csv
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,15 @@ allotrope.role,http://purl.allotrope.org/ontologies/role#
allotrope.equipment,http://purl.allotrope.org/ontologies/equipment#
allotrope,http://purl.allotrope.org/ontologies/
aio,https://w3id.org/aio/
NPO,http://purl.bioontology.org/ontology/npo#NPO_
CHEMINF,http://semanticscience.org/resource/CHEMINF_
aopkb,http://aopkb.org/aop_ontology#
ENM.net,http://purl.enanomapper.net/onto/ENM_
cito,http://purl.org/spar/cito/
fabio,http://purl.org/spar/fabio/
SIO,http://semanticscience.org/resource/SIO_
doap,http://usefulinc.com/ns/doap#
wikidata,http://www.wikidata.org/entity/
schema,https://schema.org/
ICD10CM,http://purl.bioontology.org/ontology/ICD10CM/
ICD10WHO,https://icd.who.int/browse10/2019/en#/
48 changes: 48 additions & 0 deletions src/semsql/builder/registry/ontologies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
id: semantic-sql-registry
description: Registry overlap for Semantic-SQL designed to supplement OBO vocabularies
license: CC0
ontologies:
phenio:
description: Monarch Phenomics Integrated Ontology
url: https://github.com/monarch-initiative/phenio/releases/download/latest/phenio.owl
bero:
url: https://github.com/berkeleybop/bero/releases/download/2022-05-26/bero.owl
aio:
url: https://raw.githubusercontent.com/berkeleybop/artificial-intelligence-ontology/main/aio.owl
reacto:
url: http://purl.obolibrary.org/obo/go/extensions/reacto.owl
go-lego:
url: http://purl.obolibrary.org/obo/go/extensions/go-lego.owl
bao:
url: http://www.bioassayontology.org/bao/bao_complete.owl
has_imports: true
biolink:
url: https://w3id.org/biolink/biolink-model.owl.ttl
jsonld_context: https://biolink.github.io/biolink-model/context.jsonld
format: turtle
#
biopax:
url: http://www.biopax.org/release/biopax-level3.owl
enanomapper:
url: http://enanomapper.github.io/ontologies/enanomapper.owl
has_imports: true
prefixmap:
evs.ncit: http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#
fix: http://purl.org/obo/owl/FIX#
efo:
url: http://www.ebi.ac.uk/efo/efo.owl
has_imports: true
edam:
url: http://edamontology.org/EDAM.owl
sweetAll:
url: http://sweetontology.net/sweetAll
has_imports: true
named_prefixmaps:
- sweet
- prefixcc
lov:
url: https://lov.linkeddata.es/lov.n3.gz
format: n3
compression: gzip
schema-dot-org:
url: https://schema.org/version/latest/schemaorg-current-https.rdf
Loading

0 comments on commit 4603b84

Please sign in to comment.