Skip to content
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

Sync API #104

Open
aldonline opened this issue Aug 3, 2015 · 3 comments
Open

Sync API #104

aldonline opened this issue Aug 3, 2015 · 3 comments

Comments

@aldonline
Copy link

Would it be possible to provide a ( possibly restricted ) sync API to work with in-memory stores?

@antoniogarrote
Copy link
Owner

Hi, what kind of synching are we talking about?

Is the callbacks support not enough to sync changes in the local graph(s)?

Thanks.

@aldonline
Copy link
Author

Right. I meant sync as in "no callbacks".
I am writing some fairly complex logic that requires multiple dependent SPARQL queries and programmatic processing of results on top of an RDF graph. Having to deal with callback/promise hell makes the code explode in complexity pretty fast.
Are you relying on some low level async APIs for basic SPARQL processing? Is Async only inherited from the persistence layer?
You could provide an in-memory storage option that relied on simple data structures for indices, etc. for small in data size but complex in logic programs.

@antoniogarrote
Copy link
Owner

Got it, a synchronous API.

You're right about the possibility of building a synchronous version of the API for the in-memory store. That was the case for the first version of the library that was implementing a synchronous engine for the non-persistent store and an asynchronus one for the persistent one. However the public interface was still asynchronous because in the execution of queries you have to interact with asynchronus code: a parser in a load query, an AJAX request loading a remote graph, etc.

In the new version, I removed the asynchronous engine because it was increasing the complexity of the code a lot. It's really easier to mantain just a single asynchronous engine conected to the sync memory index/lexicon or the async IndexDB index/lexicon.

It would still be possible with some refactoring to provide an API that would accept both, a callback and return the value at the same time if the result is available, but it would only work with the in-memory implementation and certain SPARQL queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants