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 committed Apr 23, 2021
1 parent 9832141 commit bcf5c5d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 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
9 changes: 4 additions & 5 deletions ontology/catalog-v001.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri id="Imports Wizard Entry" name="http://emmo.info/domain-crystallography/0.0.1/cif_top" uri="https://raw.githubusercontent.com/emmo-repo/CIF-ontology/main/ontology/cif_top.ttl"/>
<group id="Folder Repository, directory=, recursive=true, Auto-Update=false, version=2" prefer="public" xml:base="">
<uri name="http://emmo.info/domain-crystallography/cif_top" uri="cif_top.ttl"/>
<uri name="http://emmo.info/domain-crystallography/0.0.1/cif_top" uri="cif_top.ttl"/>
<uri name="http://emmo.info/domain-crystallography/0.0.1/cif_core" uri="cif_core.ttl"/>
<uri name="http://emmo.info/domain-crystallography/0.0.1/cif_example" uri="cif_example.ttl"/>
<uri name="http://emmo.info/domain-crystallography/0.0.1/cif_top" uri="https://raw.githubusercontent.com/emmo-repo/CIF-ontology/gh-pages/versions/0.1.0/cif_top.ttl"/>
<uri name="http://emmo.info/domain-crystallography/0.0.1/cif_core" uri="https://raw.githubusercontent.com/emmo-repo/CIF-ontology/gh-pages/versions/0.1.0/cif_core.ttl"/>
<uri name="http://emmo.info/domain-crystallography/0.0.1/cif_example" uri="https://raw.githubusercontent.com/emmo-repo/CIF-ontology/gh-pages/versions/0.1.0/cif_example.ttl"/>
<uri name="http://emmo.info/domain-crystallography/0.0.1/crystallography" uri="crystallography.ttl"/>
<uri name="https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/master/versions/1.0.0-beta/emmo-inferred-chemistry/1.0.0-beta"
uri="https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/master/versions/1.0.0-beta/emmo-inferred-chemistry2.ttl"/>
</group>
</catalog>
2 changes: 1 addition & 1 deletion ontology/crystallography.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<http://emmo.info/domain-crystallography/crystallography> rdf:type owl:Ontology ;
owl:versionIRI <http://emmo.info/domain-crystallography/0.0.1/crystallography> ;
owl:imports <http://emmo.info/domain-crystallography/0.0.1/cif_core> ,
<https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/master/versions/1.0.0-beta/emmo-inferred-chemistry/1.0.0-beta> ;
<https://raw.githubusercontent.com/emmo-repo/emmo-repo.github.io/master/versions/1.0.0-beta/emmo-inferred-chemistry2.ttl> ;
dcterms:abstract """A toplevel crystallography ontology based on EMMO and the CIF core dictionary.
It is implemented as a formal language.""" ;
Expand Down

0 comments on commit bcf5c5d

Please sign in to comment.