Skip to content

Commit

Permalink
Import from web instead of local files
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis authored and CasperWA committed Aug 18, 2021
1 parent eb552bd commit 4ec4ed6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions dic2owl/dic2owl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
__version__ = "0.1.0"
__author__ = "Jesper Friis"
__author_email__ = "[email protected]"

# Where versioned releases can be downloaded from
release_site = 'https://raw.githubusercontent.com/emmo-repo/CIF-ontology/gh-pages/versions'
11 changes: 9 additions & 2 deletions dic2owl/dic2owl/generate_cif.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from CifFile import CifDic

from __init__ import __version__, release_site


def en(s):
"""Returns `s` converted to a localised string in english."""
Expand All @@ -36,9 +38,14 @@ class Generator:
URI or file name of the cif_top ontology that will be imported.
"""

def __init__(self, dicfile, base_iri, cif_top="cif_top.ttl"):
def __init__(self, dicfile, base_iri, cif_top=None):
self.cd = CifDic(dicfile, do_dREL=False)
self.cif_top = ontology_dir() / cif_top
if not cif_top:
self.cif_top = f'{release_site}/{__version__}/cif_top.ttl'
elif cif_top.startswith('http'):
self.cif_top = cif_top
else:
self.cif_top = ontology_dir() / cif_top
self.categories = set()

# Load cif_top ontology
Expand Down

0 comments on commit 4ec4ed6

Please sign in to comment.