Skip to content

Commit

Permalink
added outline for ontology patching during load
Browse files Browse the repository at this point in the history
updated methods.py with definition for ising
added techniques hierarchy to graphml -> ttl output
  • Loading branch information
tgbugs committed Mar 26, 2018
1 parent 404924c commit 04894b7
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 6 deletions.
10 changes: 10 additions & 0 deletions patches/doid-bridge-ext.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/ttl/bridge/doid-bridge.ttl
+++ b/ttl/bridge/doid-bridge.ttl
@@ -12,6 +12,7 @@
<http://ontology.neuinfo.org/NIF/ttl/generated/symp-dead.ttl>,
<http://ontology.neuinfo.org/NIF/ttl/generated/trans-dead.ttl>,
<http://ontology.neuinfo.org/NIF/ttl/nif_backend.ttl>,
+ <http://ontology.neuinfo.org/NIF/ttl/external/doid-ext.owl>,
<http://purl.obolibrary.org/obo/doid.owl> .

### Annotations
10 changes: 10 additions & 0 deletions patches/doid-ext-so.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/ttl/external/doid-ext.owl
+++ b/ttl/external/doid-ext.owl
@@ -15,5 +15,4 @@
Import(<http://purl.obolibrary.org/obo/doid/imports/hp_import.owl>)
Import(<http://purl.obolibrary.org/obo/doid/imports/omim_susc_import.owl>)
Import(<http://purl.obolibrary.org/obo/doid/imports/relations.owl>)
-Import(<http://purl.obolibrary.org/obo/doid/imports/so.owl>)
-)
\ No newline at end of file
+)
10 changes: 10 additions & 0 deletions patches/doid-ext.patch
Original file line number Diff line number Diff line change
@@ -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/">
<owl:Ontology rdf:about="http://purl.obolibrary.org/obo/doid.owl">
<owl:versionIRI rdf:resource="http://purl.obolibrary.org/obo/doid/releases/2018-03-02/doid.owl"/>
- <owl:imports rdf:resource="http://purl.obolibrary.org/obo/doid/obo/ext.owl"/>
<oboInOwl:date rdf:datatype="http://www.w3.org/2001/XMLSchema#string">02:03:2018 14:00</oboInOwl:date>
<oboInOwl:default-namespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">disease_ontology</oboInOwl:default-namespace>
<oboInOwl:saved-by rdf:datatype="http://www.w3.org/2001/XMLSchema#string">lschriml</oboInOwl:saved-by>
10 changes: 10 additions & 0 deletions patches/patches.yaml
Original file line number Diff line number Diff line change
@@ -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

3 changes: 2 additions & 1 deletion pyontutils/graphml_to_ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 18 additions & 1 deletion pyontutils/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions pyontutils/ontload.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-l --git-local=LBASE local path to look for ontology <repo> [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
Expand All @@ -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
Expand Down Expand Up @@ -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']
Expand All @@ -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
Expand All @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions pyontutils/scigraph_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand All @@ -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)

Expand Down

0 comments on commit 04894b7

Please sign in to comment.