override base.py abreviated namespaces

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

override base.py abreviated namespaces

Bob van 't Padje
I'm trying to implement blazegraph(a graph database) in your package. The database is just a triple store. All the triples consist of the full iri's. e.g.
<file://test.owl#Testclass> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> .

Because all the uri's get abbreviated in the base.py file, all my uri's get abbreviated as well and have the following format:
<file://test.owl#Testclass>  6  18 .

I understand that this is necessary when working with relational databases but when working with a graph database I don't want this to happen. Is there a way to override this to just return the regular uri's instead of the abbreviations when the backend type is "blazegraph"?

For clarification, I already have a driver_blazegraph and edited the namespace file to set the Graph to my driver_blazegraph.Graph.

Reply | Threaded
Open this post in threaded view
|

Re: override base.py abreviated namespaces

Jiba
Administrator
Hi,

I suppose blazegraph performs a similar IRI abbreviation, so the abbreviation in Owlready is no longer needed.

All the abbreviation are stored as constant in base.py. I think it is important to keep them as constants, for performances.

The best solution is probably to rewrite _universal_abbrev() and _universal_abbrev_datatype().

You may also encounter another problem: Owlready assume that the abbreviated name (called storid) starts with a "_" for blank node. Is it the case in blazegraph?

Best regards,
Jean-Baptiste Lamy
MCF, LIMICS, Université Paris 13
Reply | Threaded
Open this post in threaded view
|

Re: override base.py abreviated namespaces

Bob van 't Padje
Hi Jean-Baptiste,

Because Blazegraph is a very fast noSQL database it's possible to save the complete iri's as triples in the database and this makes it unnecessary to use the methods in owlready2 to abbreviate the iri's.  

I would prefer to make owlready2 compatible with Blazegraph and don't break any of the other datastorage options because this would mean that I could just create a pull request and other people could use Blazegraph storage as well.

If I would just rewrite the _universal_abbrev() and _universal_abbrev_datatype() in the baze.py it would mean the current functionality with sqlite and postgresql would break. I would prefer to just override the functionality of these methods only when i'm using the Blazegraph backend, but I don't really see a way to do this without rewriting almost every file in the application (note that I don't have a lot of Python experience).

If you have an idea on how to make these methods overridable I would love to hear it. If not, I'm just going to rewrite these methods in the base.py (but this would mean that I can't create a pull-request and other people wouldn't have the opportunity to use Blazegraph in combination with owlReady2).

Kind regards,

Bob van 't Padje
Reply | Threaded
Open this post in threaded view
|

Re: override base.py abreviated namespaces

Jiba
Administrator
Hi,

I was thinking about adding 2 global functions in base.py: define_abbreviated_constants() and define_non_abbreviated_constants(). These functions would define the constants appropriately, and calling them would allow to switch between abbreviated and non abbreviated mode.

You also need to rewrite a few copies of those contants, for example in entity.py, EntityClass has the following class members that are copied from the constants: _owl_type, _rdfs_is_a, _owl_equivalent, _owl_disjointwith, _owl_alldisjoint.

It would be very interesting to compare the performances with Blazegraph and SQLite3 (I was disappointed by the performances of PostgresQL).

Best regards,
Jean-Baptiste Lamy
MCF, LIMICS, Université Paris 13
Reply | Threaded
Open this post in threaded view
|

Re: override base.py abreviated namespaces

Adlane
In reply to this post by Bob van 't Padje
Hi,

I'm interested in your work of connecting blazegraph with owlready. Did you succeed to make it work?
If it's possible I would know if it's possible to see your work.
Thank you.

By the way juba, your work on owlready is fantastic