-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add local db for performance reasons #10
Comments
After some more thought, adding a database to calamus is not really needed,we can use rdflib for that, since it already supports a multitude of DB backends through plugins. Instead, we can just support an RDFLib graph object, since that already allows reading/writing triples, and RDFLib supports several backends Including SPARQL endpoints, solving #9 ). Then we don't need to worry about how to store things, and instead we just need to interact with rdflib. The thing needed for this is to be able to deserialize rdflib triples to calamus objects and vice versa. An easy implementation would be to just use So in addition to JsonLd, it'd be great if we could serialize to rdflib triples as well. Proposal for an interface:
We could also think about supporting multiple graph, especially together with
Which would try to access objects in |
I wonder if it could be made even simpler, it still reads maybe a little verbose to me but I really like the general idea. I was just thinking that having a simple way to define what you want (e.g. a |
This seems to be exactly what we need: https://github.com/RDFLib/rdflib-hdt The interface seems to fit exactly into the use-case you sketched above. Extra bonus: it seems currently supported unlike 99% of RDF tools out there |
https://cayley.io/ could be an option |
A PoC for this was implemented in #47 with an interface like this: from calamus.backends.neo4j import CalamusNeo4JBackend
neo = CalamusNeo4JBackend()
neo.initialize()
book = BookSchema(session=neo).load(
neo.fetch_by_id(
"http://example.com/books/1"
)
) passing An improvement of this functionality was discussed to enable something like this: book = BookSchema().load({"_id": "http://example.com/books/1"}, session=neo) which would translate into a query for a book by that book = BookSchema().load(
{
"http://schema.org/author":
{
"http://schema.org/name": "Isaac Newton"
}
} which would create a query like
This example is with neo4j but it should be quite backend-independent. |
Instead of saving a flat list as a .json or .yaml file, it'd be nice to have a local db (key-value-sture) that saves objects by IRI.
this could be done with https://docs.python.org/3/library/dbm.html#module-dbm or https://github.com/coleifer/unqlite-python or https://github.com/RaRe-Technologies/sqlitedict (this doesn't seem to be actively supported). Also check if there's other solutions that could fit our needs better.
The text was updated successfully, but these errors were encountered: