INCATools / semantic-sql

SQL and SQLite builds of OWL ontologies
https://incatools.github.io/semantic-sql/
BSD 3-Clause "New" or "Revised" License
37 stars 3 forks source link

Database created is empty #48

Closed joeflack4 closed 2 years ago

joeflack4 commented 2 years ago

Overview

I ran: semsql make doid.db, and when I examined the tables, everything except the following tables were empty:

  1. prefix
  2. sqlite_master

I don't think these two tables are specific to the ontology either; I think they are the same for every DB I would create, based on some kind of semsql templating.

Replicating this issue

  1. Have semsql
  2. Download and unzip doid.owl.zip
  3. Run semsql make doid.db from unzipped directory.

Log

pip freeze | grep semsql
semsql==0.2.0
sh run.sh semsql make mirror/doid.db
relation-graph --disable-owl-nothing true \
                       --ontology-file mirror/doid.owl\
                       --output-file mirror/doid-relation-graph.tsv.ttl.tmp \
                       --equivalence-as-subclass true \
               --output-subclasses true \
                       --reflexive-subclasses true && \
riot --out RDFXML mirror/doid-relation-graph.tsv.ttl.tmp > mirror/doid-relation-graph.tsv.owl.tmp && \
sqlite3 mirror/doid-relation-graph.tsv.db.tmp -cmd ".mode csv" ".import /usr/local/lib/python3.10/dist-packages/semsql/builder//prefixes/prefixes.csv prefix" && \
rdftab mirror/doid-relation-graph.tsv.db.tmp < mirror/doid-relation-graph.tsv.owl.tmp && \
sqlite3 mirror/doid-relation-graph.tsv.db.tmp -cmd '.separator "\t"' -cmd '.header on' "SELECT subject,predicate,object FROM statements " > mirror/doid-relation-graph.tsv.tmp && \
mv mirror/doid-relation-graph.tsv.tmp mirror/doid-relation-graph.tsv && \
rm mirror/doid-relation-graph.tsv.*.tmp
2022.08.10 20:27:14:401 zio-default-async-1 INFO org.renci.relationgraph.Main.program:57
    Running reasoner
2022.08.10 20:27:18:101 zio-default-async-1 INFO org.renci.relationgraph.Main.program:60
    Done running reasoner
2022.08.10 20:27:34:861 zio-default-async-4 INFO org.renci.relationgraph.Main.program:70
    Computed relations in 16.696s
cp .template.db mirror/doid.db.tmp && \
rdftab mirror/doid.db.tmp < mirror/doid.owl && \
sqlite3 mirror/doid.db.tmp -cmd '.separator "\t"' ".import mirror/doid-relation-graph.tsv entailed_edge" && \
gzip mirror/doid-relation-graph.tsv && \
cat /usr/local/lib/python3.10/dist-packages/semsql/builder//indexes/*.sql | sqlite3 mirror/doid.db.tmp && \
mv mirror/doid.db.tmp mirror/doid.db

Additional information

Version: 0.1.7: Using this version because I'm not currently able to use the next highest version, 0.2.0. Edit: I also tried 0.2.0 and this happens for that version as well.

Related: Point (5) in this comment of OAK issue 90: empty db.

joeflack4 commented 2 years ago

@matentzn FYI

cmungall commented 2 years ago

That's very unusual

Just to be completely sure, can you report the results of this:

sqlite3 mirror/doid.db -cmd "SELECT COUNT(*) FROM statements;"
joeflack4 commented 2 years ago

@cmungall My bad. I'm new to this PyCharm DB browser. It seems that, even after I deleted .template.db, that is the DB that was still somehow opening up when I was double clicking doid.db. The 0 results were consistent with nothing coming back from .entities() (under earlier circumstances), so I felt as if the DB browser was corroborating.

It seems I'm good now.