diff --git a/patches/doid-bridge-ext.patch b/patches/doid-bridge-ext.patch new file mode 100644 index 00000000..50d00f48 --- /dev/null +++ b/patches/doid-bridge-ext.patch @@ -0,0 +1,10 @@ +--- a/ttl/bridge/doid-bridge.ttl ++++ b/ttl/bridge/doid-bridge.ttl +@@ -12,6 +12,7 @@ + , + , + , ++ , + . + + ### Annotations diff --git a/patches/doid-ext-so.patch b/patches/doid-ext-so.patch new file mode 100644 index 00000000..e4f1f52a --- /dev/null +++ b/patches/doid-ext-so.patch @@ -0,0 +1,10 @@ +--- a/ttl/external/doid-ext.owl ++++ b/ttl/external/doid-ext.owl +@@ -15,5 +15,4 @@ + Import() + Import() + Import() +-Import() +-) +\ No newline at end of file ++) diff --git a/patches/doid-ext.patch b/patches/doid-ext.patch new file mode 100644 index 00000000..6d623cf2 --- /dev/null +++ b/patches/doid-ext.patch @@ -0,0 +1,10 @@ +--- a/ttl/external/doid.owl ++++ b/ttl/external/doid.owl +@@ -12,7 +12,6 @@ + xmlns:dc="http://purl.org/dc/elements/1.1/"> + + +- + 02:03:2018 14:00 + disease_ontology + lschriml diff --git a/patches/patches.yaml b/patches/patches.yaml new file mode 100644 index 00000000..03ebd4b5 --- /dev/null +++ b/patches/patches.yaml @@ -0,0 +1,10 @@ +doid-import-patchset: + doid-ext.patch: + target: ttl/external/doid.owl + remote: http://purl.obolibrary.org/obo/doid.owl + doid-ext-so.patch: + target: ttl/external/doid-ext.owl + remote: http://purl.obolibrary.org/obo/doid/obo/ext.owl + doid-bridge-ext.patch: + target: ttl/bridge/doid-bridge.ttl + diff --git a/pyontutils/graphml_to_ttl.py b/pyontutils/graphml_to_ttl.py index 458f6eed..eb4c8ee4 100755 --- a/pyontutils/graphml_to_ttl.py +++ b/pyontutils/graphml_to_ttl.py @@ -202,7 +202,8 @@ def main(): Query = namedtuple('Query', ['root','relationshipType','direction','depth']) json = newgraph.make_scigraph_json('rdfs:subClassOf', direct=True) - t, te = creatTree(*Query('FIXME:n0', 'rdfs:subClassOf', 'INCOMING', 20), json=json) + t, te = creatTree(*Query('FIXME:n0', 'rdfs:subClassOf', 'INCOMING', 20), json=json) # methods + t, te = creatTree(*Query('FIXME:n236', 'rdfs:subClassOf', 'INCOMING', 20), json=json) # techniques print(t) newgraph.write() diff --git a/pyontutils/methods.py b/pyontutils/methods.py index 202c38cc..aace0f63 100644 --- a/pyontutils/methods.py +++ b/pyontutils/methods.py @@ -783,7 +783,24 @@ def d(self): return TEMP[str(next(self.counter))] ), _t(tech.ising, 'ising technique', - (ilxtr.hasPrimaryAspect, asp['is']),), + (ilxtr.hasPrimaryAspect, asp['is']), + def_=('Ising techniques are techniques that affect whether a thing \'is\' or not. ' + 'Whether they primary participant \'is\' in this context must shall be determined ' + 'by whether measurements made on the putative primary particiant ' + 'provide data that meet the necessary and sufficient criteria for the putative primary ' + 'participant to be assigned the categorical name as defined by the ' + 'primary particiant\'s owl:Class. For example if the primary particiant of a technique ' + 'is 100ml of liquid water, then a boiling technique which produces gaseous water from ' + 'liquid water negatively affects the isness of the 100ml of liquid water because we can ' + 'no longer assign the name liquid water to the steam that is produced by boiling.')), + + (tech.ising, rdfs.comment, + ('Because \'isness\' or \'being\' is modelled as an aspect it is implied that ' + '\'being\' in this context depends entirely on some measurement process and some ' + 'additional process for classifying or categorizing the object based on that measurement, ' + 'so that it can be assigned a name. The objective here is to demistify the process of ' + 'assigning a name to a thing so that it will be possible to provide exact provenance ' + 'for how the assignment of the name was determined.')), _t(tech.creating, 'creating technique', # FIXME mightent we want to subclass off of these directly? tech.ising, diff --git a/pyontutils/ontload.py b/pyontutils/ontload.py index e2aa1fc7..6eb6c4ba 100755 --- a/pyontutils/ontload.py +++ b/pyontutils/ontload.py @@ -16,6 +16,7 @@ -l --git-local=LBASE local path to look for ontology [default: /tmp] -z --zip-location=ZIPLOC local path in which to deposit build files [default: /tmp] -f --scigraph-config-folder=TP templates files live here [default: ../scigraph/] + -a --patches-folder=PF patch files live here [default: ../patches/] -t --graphload-config=CFG graphload.yaml location [default: graphload.yaml] if only the filename is given assued to be in scigraph-config-folder @@ -30,9 +31,11 @@ -C --scigraph-commit=SCOMMIT scigraph commit to build [default: HEAD] -S --scigraph-scp-loc=SGSCP where to scp the zipped graph file [default: user@localhost:/tmp/scigraph/] + -p --patch-config patchs.yaml location [default: patches.yaml] -u --curies=CURIEFILE curie definition file [default: nifstd_curie_map.yaml] if only the filename is given assued to be in scigraph-config-folder + -P --patch retrieve ontologies to patch and modify import chain accordingly -K --check-built check whether a local copy is present but do not build if it is not -d --debug call IPython embed when done @@ -520,6 +523,7 @@ def run(args): git_local = args['--git-local'] zip_location = args['--zip-location'] scigraph_config_folder = args['--scigraph-config-folder'] + patches_folder = args['--patches-folder'] graphload_config = args['--graphload-config'] org = args['--org'] branch = args['--branch'] @@ -529,7 +533,9 @@ def run(args): sbranch = args['--scigraph-branch'] scommit = args['--scigraph-commit'] sscp = args['--scigraph-scp-loc'] + patch_config = args['--patch-config'] curies_location = args['--curies'] + patch = args['--patch'] check_built = args['--check-built'] debug = args['--debug'] log = args['--logfile'] # TODO @@ -543,6 +549,9 @@ def run(args): graphload_config = jpth(scigraph_config_folder, graphload_config) if '/' not in curies_location: curies_location = jpth(scigraph_config_folder, curies_location) + if '/' not in patch_config: + patch_config = jpth(patches_folder, patch_config) + graphload_config = locate_config_file(graphload_config, git_local) curies_location = locate_config_file(curies_location, git_local) curies, curie_prefixes = getCuries(curies_location) diff --git a/pyontutils/scigraph_deploy.py b/pyontutils/scigraph_deploy.py index ad47a8bd..8130a903 100755 --- a/pyontutils/scigraph_deploy.py +++ b/pyontutils/scigraph_deploy.py @@ -45,6 +45,7 @@ import inspect from os.path import join as jpth from shlex import quote as squote +from pathlib import Path from functools import wraps from collections import namedtuple import yaml @@ -438,6 +439,8 @@ def build_services_config(self): self.graph_folder = services_config['graphConfiguration']['location'] #print(self.graph_folder) services_config_path = jpth(self.zip_location, self.services_config) # save loc + p = Path(services_config_path) + if not p.parent.exists(): p.parent.mkdir(parents=True) with open(services_config_path, 'wt') as f: yaml.dump(services_config, f, default_flow_style=False) @@ -748,10 +751,6 @@ def run(args): kwargs = {k.strip('--').strip('<').rstrip('>').replace('-','_'):v for k, v in args.items()} b = Builder(args, **kwargs) code = b.run() - if b.local: - return - #if b.check_built: - #return if b.debug: FILE = '/tmp/test.sh' with open(FILE, 'wt') as f: @@ -761,6 +760,10 @@ def run(args): with open(FILE, 'rt') as f: print(f.read()) #embed() + if b.local: + return + #if b.check_built: + #return else: print(code)