INCATools / ontology-access-kit

Ontology Access Kit: A python library and command line application for working with ontologies
https://incatools.github.io/ontology-access-kit/
Apache License 2.0
124 stars 29 forks source link

Misc small `SqlImplementation` issues #294

Open joeflack4 opened 2 years ago

joeflack4 commented 2 years ago

I was going to make an issue about having a problem with SqlImplementation.entities() not getting any entities and producing errors, but I think I'm having more general problems with SqlImplementation.

My version: oaklib==0.1.23 edit: I realize now that this is outdated. I fixed that on my end. I will need to re-run and see if still empty.

Sub-issue list

Checked means fixed.

Sub-issues

1. Orphan .template.db.tmp

I think that it hung at some point; possibly related to issue (4) below. I think that when I terminated, OAK did not exit gracefully and delete this temp file from the directory where I called.

This still applies to 0.2.0, when using OAK or semsql separately.

Related: https://github.com/INCATools/semantic-sql/issues/47

2. Unsquelched stdout

Last tried version: 0.1.23 I don't know if this is useful to some users. I'd prefer not seeing it by default.

What I ran From Python:

ontology = SqlImplementation(OntologyResource(slug='mondo-ingest/src/ontology/components/omim.owl', local=True))

Output

cat /Users/joeflack4/virtualenvs/mondo-ingest/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/joeflack4/virtualenvs/mondo-ingest/lib/python3.9/site-packages/semsql/builder//prefixes/prefixes.csv prefix" && \
    mv .template.db.tmp .template.db
.exit
robot remove -i components/omim.owl --axioms "equivalent disjoint annotation" -o components/omim-min.owl
relation-graph --disable-owl-nothing true \
                       --ontology-file components/omim-min.owl\
                       --output-file components/omim-relation-graph.tsv.ttl.tmp \
                       --equivalence-as-subclass true \
                   --output-subclasses true \
                       --reflexive-subclasses true && \

Possible solutions Add a bool argument verbose to the necessary super / interface classes, defaulting to False. Can then connect this to the CLI with a --verbose option.

3. Unhandled error: missing local file

I ran Python from my IDE:

ontology = SqlImplementation(OntologyResource(slug='components/omim.owl', local=True))

But I think it had the wrong working directory at first, and I got this error:

make: *** No rule to make targetcomponents/omim.db'. Stop.`

Suggestion: Handle this exception and instead show something like:

FileNotFoundError: 'components/omim.owl'

4. Interactive sqlite session when running Python script from makefile

My Python script got ran from a makefile. I believe that this is the line which triggered the following terminal output:

ontology = SqlImplementation(OntologyResource(slug='components/omim.owl', local=True))

Terminal output:

/usr/local/lib/python3.10/dist-packages/rdflib_jsonld/__init__.py:9: DeprecationWarning: The rdflib-jsonld package has been integrated into rdflib as of rdflib==6.0.0.  Please remove rdflib-jsonld from your project's dependencies.
  warnings.warn(
make[1]: Entering directory '/work/src/ontology'
cat /usr/local/lib/python3.10/dist-packages/semsql/builder//sql_schema/semsql.sql | sqlite3 .template.db.tmp && \
sqlite3 -echo .template.db.tmp -cmd ".mode csv" -cmd ".import /usr/local/lib/python3.10/dist-packages/semsql/builder//prefixes/prefixes.csv prefix" -cmd ".exit" && \
mv .template.db.tmp .template.db
SQLite version 3.37.2 2022-01-06 13:25:41
Enter ".help" for usage hints.
sqlite>

This may be related to my issue (1) above. I think when I quit this, it may have left remnants of some temp DB file, but I'm not sure.

Also at some point, my terminal froze, and I tried CTRL+D plus like 7 other ways to try to kill the process, but I couldn't terminate and ultimately had to close the window. It may have been related to this issue; not sure.

5. .entities() returns nothing

This was the case for 0.1.23. I haven't tried again using 0.2.0, though I did see that my 0.2.0 DB that was created manually by semsql was not empty.

Related: https://github.com/INCATools/semantic-sql/issues/48

joeflack4 commented 2 years ago

Still experiencing these issues, so I moved them over from #90 to this new issue.