Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ontload for burak #90

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0bb8f9f
removing case conflict
tmsincomb Oct 31, 2019
125b51c
new elastic search wrapper
tmsincomb Nov 5, 2019
80e4753
Merge remote-tracking branch 'upstream/master'
tmsincomb Nov 5, 2019
ff55c49
Merge remote-tracking branch 'upstream/master'
tmsincomb Nov 7, 2019
c7c71df
shortcut to sql and update print on ontopandas
tmsincomb Dec 13, 2019
1825020
Merge remote-tracking branch 'upstream/master'
tmsincomb Dec 13, 2019
72901e4
Merge remote-tracking branch 'upstream/master'
Jan 7, 2020
4559c51
this was lost
Jan 7, 2020
a27a253
update ilx references
Jan 7, 2020
3c72023
updates
tmsincomb Feb 25, 2020
33c738b
Merge remote-tracking branch 'upstream/master'
tmsincomb Feb 25, 2020
0a56d4c
Merge remote-tracking branch 'upstream/master'
tmsincomb Feb 28, 2020
dbb9293
Merge remote-tracking branch 'upstream/master'
tmsincomb Feb 28, 2020
b7627b7
Merge remote-tracking branch 'upstream/master'
tmsincomb Feb 28, 2020
d7d935a
Merge remote-tracking branch 'upstream/master'
tmsincomb Feb 28, 2020
5d4f786
Merge remote-tracking branch 'upstream/master'
tmsincomb Mar 9, 2020
7bac845
Merge remote-tracking branch 'upstream/master'
tmsincomb Mar 24, 2020
53d71c4
updated tutorials
tmsincomb Apr 10, 2020
3e5e5c9
fixed bugs
tmsincomb Apr 10, 2020
8f8c722
Merge remote-tracking branch 'upstream/master'
tmsincomb Apr 10, 2020
ede39d7
Merge remote-tracking branch 'upstream/master'
tmsincomb Apr 29, 2020
665ea4c
Merge remote-tracking branch 'upstream/master'
tmsincomb May 4, 2020
9091b0b
Merge remote-tracking branch 'upstream/master'
tmsincomb May 8, 2020
e75362f
bug fixes
tmsincomb May 21, 2020
4a866b9
Merge remote-tracking branch 'upstream/master'
tmsincomb May 21, 2020
ebf0a3c
Merge remote-tracking branch 'upstream/master'
tmsincomb Jul 14, 2020
c0c1692
gradual updates
tmsincomb Oct 1, 2020
c81ef18
Merge remote-tracking branch 'upstream/master'
tmsincomb Oct 1, 2020
62cf03e
hardcoded to merge specific ontologies
tmsincomb Oct 1, 2020
84b1093
sync to tgbugs
tmsincomb Oct 1, 2020
107430c
-
tmsincomb Oct 1, 2020
4ac6082
-
tmsincomb Oct 1, 2020
6fae27a
-
tmsincomb Oct 1, 2020
15c70bd
sparc-view.ttl added to load
tmsincomb Oct 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions pyontutils/ontload.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,15 @@ def inner(local_filepath, remote=False):
def loadall(git_local, repo_name, local=False, dobig=False):
local_base = jpth(git_local, repo_name)
lb_ttl = os.path.realpath(jpth(local_base, 'ttl'))

#match = (rdflib.term.URIRef('http://purl.org/dc/elements/1.1/member'), # iao.owl
#rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
#rdflib.term.URIRef('http://www.w3.org/2002/07/owl#AnnotationProperty'))

done = []
filenames = [f for g in ('*', '*/*', '*/*/*') for f in glob(lb_ttl + '/' + g + '.ttl')]
git_path = '/home/tmsincomb/Dropbox/git/'
hardcoded_files = [repo_name + '/' + 'extra.ttl'] + [git_path+'sparc-view.ttl', git_path+'fma_slim.ttl', git_path+'emapa.ttl', git_path+'uberon.ttl', git_path+'mondo.ttl']
filenames = hardcoded_files + [f for g in ('*', '*/*', '*/*/*') for f in glob(lb_ttl + '/' + g + '.ttl')]
graph = OntGraph()
for f in filenames:
print(f)
Expand All @@ -598,12 +600,17 @@ def repeat(dobig=dobig): # we don't really know when to stop, so just adjust
for s, o in graph.subject_objects(owl.imports):
if os.path.basename(o) not in done and o not in done:
#if (o, rdf.type, owl.Ontology) not in graph:
if not o.startswith('/home/tmsincomb'):
continue
print(o)
done.append(o)
ext = os.path.splitext(o)[1]
fmt = 'turtle' if ext == '.ttl' else 'xml'
if noneMembers(o, *bigleaves) or dobig:
graph.parse(o, format=fmt)
try:
graph.parse(o, format=fmt)
except:
print('FAILED:', o)
#if match in graph:
#raise BaseException('Evil file found %s' % o)

Expand Down Expand Up @@ -670,7 +677,7 @@ def inner(graph):

records = {c:[l, s, p] for c, l, s, p in inner(graph) if l or s}
with open(os.path.expanduser('~/files/ontology-classes-with-labels-synonyms-parents.json'), 'wt') as f:
json.dump(records, f, sort_keys=True, indent=2)
json.dump(records, f, sort_keys=True, indent=2)


def make_post_clone(git_local, repo_name, remote_base):
Expand Down