Implement third party triplestore as backend and sparql endpoint

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Implement third party triplestore as backend and sparql endpoint

mehling
Hello,

in our research project we developed the causalgraph package to represent causal graphs in knowledge graphs based on owlready2 (https://pypi.org/project/causalgraph/).

From other projects, we have a big legacy of semantic web technology solutions on Java (https://github.com/komma?language=java, similar to owlready2 but in java).

We would love to combine our solutions based on komma and owlready2. Specifically we want to use the storage backend and SPARQL endpoint from komma in owlready2.

How would one implement a custom storage backend? (Which files to add / edit)
How would one substitute the owlready2 SPARQL function / implement a new one to use the komma endpoint?

Thanks a lot in advance!

Kind Regards

Willy
Reply | Threaded
Open this post in threaded view
|

Re: Implement third party triplestore as backend and sparql endpoint

Jiba
Administrator
Hello,

The SQLite3 storage backend is implemented in triplelite.py, and the SPARQL engine in the sparql/ directory. However, some parts of Owlready perform direct SQL calls and possibly need to to updated as well.

However, changing the backend is problematic for performances: SQLite3 provides high performance because it runs in the same process as Python. Most other databases (like PostgresQL or MySQL) run in a separate process and you need inter-process communication, usually achieved by network calls. A call a needed each time you query the store, i.e. each time you do "entity.property". These repeated calls have a high cost, making this option about 10 times slower than SQLite3.

Before planning another backend, you need to consider how Python will communicate with that backend. I looked rapidly to komma, but it is not clear to me where the data are stored (file ? database ? memory ?) and how it can be accessed by Python.

Possibly the inverse operation is easier: add support for Owlready SQLite3 files in komma?

Jiba