Giter Club home page Giter Club logo

Comments (7)

matentzn avatar matentzn commented on June 9, 2024

I guess I was missing a piece.. It needs to be a SQL db, cant be an arbitrary obo/owl file.. Now looking for how to convert first.

This also wont work:

resource = OntologyResource(slug='sqlite:mondo.db', local=False)

How do I convert a local obo file into a db file? Assuming that is what the issue is I mean.

from ontology-access-kit.

cmungall avatar cmungall commented on June 9, 2024

from ontology-access-kit.

matentzn avatar matentzn commented on June 9, 2024

Cant get it to work, like this?

resource = OntologyResource(slug='mondo.owl', local=True)
oi = SqlImplementation(resource)

from ontology-access-kit.

cmungall avatar cmungall commented on June 9, 2024

I believe that should work

from ontology-access-kit.

matentzn avatar matentzn commented on June 9, 2024
from oaklib.resource import OntologyResource
from oaklib.implementations.sqldb.sql_implementation import SqlImplementation
import os
print(os.path.exists('mondo.owl'))
resource = OntologyResource(slug='mondo.owl', local=True)
oi = SqlImplementation(resource)

Results in

True
---------------------------------------------------------------------------
ArgumentError                             Traceback (most recent call last)
<ipython-input-26-3f3e82a428e8> in <module>
      1 print(os.path.exists('mondo.owl'))
      2 resource = OntologyResource(slug='mondo.owl', local=True)
----> 3 oi = SqlImplementation(resource)

~/opt/anaconda3/lib/python3.8/site-packages/oaklib/implementations/sqldb/sql_implementation.py in __init__(self, resource, strict, engine, _session, _connection, **_kwargs)

~/opt/anaconda3/lib/python3.8/site-packages/oaklib/implementations/sqldb/sql_implementation.py in __post_init__(self)
     40     def __post_init__(self):
     41         if self.engine is None:
---> 42             self.engine = create_engine(self.resource.slug)  ## TODO
     43 
     44 

<string> in create_engine(url, **kwargs)

~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py in warned(fn, *args, **kwargs)
    307                         stacklevel=3,
    308                     )
--> 309             return fn(*args, **kwargs)
    310 
    311         doc = fn.__doc__ is not None and fn.__doc__ or ""

~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/engine/create.py in create_engine(url, **kwargs)
    528 
    529     # create url.URL object
--> 530     u = _url.make_url(url)
    531 
    532     u, plugins, kwargs = u._instantiate_plugins(kwargs)

~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/engine/url.py in make_url(name_or_url)
    729 
    730     if isinstance(name_or_url, util.string_types):
--> 731         return _parse_rfc1738_args(name_or_url)
    732     else:
    733         return name_or_url

~/opt/anaconda3/lib/python3.8/site-packages/sqlalchemy/engine/url.py in _parse_rfc1738_args(name)
    790 
    791     else:
--> 792         raise exc.ArgumentError(
    793             "Could not parse rfc1738 URL from string '%s'" % name
    794         )

ArgumentError: Could not parse rfc1738 URL from string 'mondo.owl'

from ontology-access-kit.

cmungall avatar cmungall commented on June 9, 2024

try with the latest version from 2 days ago

from your stacktrace that seems to be a (quite) old version?

this is what post_init looks like now:

https://github.com/INCATools/ontology-access-kit/blob/v0.1.19/src/oaklib/implementations/sqldb/sql_implementation.py#L103-L116

this is my output:

➜  mondo-build git:(minor-edits) ✗ /Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/bin/python t.py
True
cat /Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/lib/python3.9/site-packages/semsql/builder//sql_schema/semsql.sql | sqlite3 .template.db.tmp && \
        echo .exit | sqlite3 -echo .template.db.tmp -cmd ".mode csv" -cmd ".import /Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/lib/python3.9/site-packages/semsql/builder//prefixes/prefixes.csv prefix" && \
        mv .template.db.tmp .template.db
.exit
robot remove -i mondo.owl --axioms "equivalent disjoint annotation" -o mondo-min.owl
relation-graph --disable-owl-nothing true \
                       --ontology-file mondo-min.owl\
                       --output-file mondo-relation-graph.tsv.ttl.tmp \
                       --equivalence-as-subclass true \
                       --output-subclasses true \
                       --reflexive-subclasses true && \
        riot --out RDFXML mondo-relation-graph.tsv.ttl.tmp > mondo-relation-graph.tsv.owl.tmp && \
        sqlite3 mondo-relation-graph.tsv.db.tmp -cmd ".mode csv" ".import /Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/lib/python3.9/site-packages/semsql/builder//prefixes/prefixes.csv prefix" && \
        rdftab mondo-relation-graph.tsv.db.tmp < mondo-relation-graph.tsv.owl.tmp && \
        sqlite3 mondo-relation-graph.tsv.db.tmp -cmd '.separator "\t"' -cmd '.header on' "SELECT subject,predicate,object FROM statements " > mondo-relation-graph.tsv.tmp && \
        mv mondo-relation-graph.tsv.tmp mondo-relation-graph.tsv && \
        rm mondo-relation-graph.tsv.*.tmp
2022.06.02 14:22:35:933 zio-default-async-1 INFO org.renci.relationgraph.Main.program:57
    Running reasoner
2022.06.02 14:22:48:433 zio-default-async-1 INFO org.renci.relationgraph.Main.program:60
    Done running reasoner
2022.06.02 14:23:42:579 zio-default-async-16 INFO org.renci.relationgraph.Main.program:70
    Computed relations in 54.116s
cp .template.db mondo.db.tmp && \
        rdftab mondo.db.tmp < mondo.owl && \
        sqlite3 mondo.db.tmp -cmd '.separator "\t"' ".import mondo-relation-graph.tsv entailed_edge" && \
        gzip -f mondo-relation-graph.tsv && \
        cat /Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/lib/python3.9/site-packages/semsql/builder//indexes/*.sql | sqlite3 mondo.db.tmp && \
        mv mondo.db.tmp mondo.db
rm mondo-min.owl

from ontology-access-kit.

joeflack4 avatar joeflack4 commented on June 9, 2024

I had some other issues here, but I moved them to #294 , as I think they are unrelated to this issue.

from ontology-access-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.