Does Comunica support any kind of "live"/reactive querying? #819
-
I'm a little new to RDF, so I may be a bit fuzzy on what I'm even asking about. I'd like to build a React app and back it with queries to Comunica, much as I might back it with GraphQL queries to Apollo. If I have queries over local data, say in Quadstore, is there a good way to open a "live" query through Comunica and stream in data as it updates? That is, given the data from the SPARQL Overview Example, can I query Comunica with something like: PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name (COUNT(?friend) AS ?count)
WHERE {
?person foaf:name ?name .
?person foaf:knows ?friend .
} GROUP BY ?person ?name in one component, and read off the following results:
then elsewhere in the app add the triples: @prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://example.org/bob#me> foaf:knows <http://example.org/charlie#me> .
<http://example.org/charlie#me> foaf:knows <http://example.org/bob#me> . and have some kind of event back at my original query now give me:
? A naive way to do this would be to watch for any update to the store and rerun the query. But that's expensive because a) the data added to the store may be unrelated to the query, and b) rerunning the query (presumably) recomputes partial results that could theoretically be reused between queries. Is there an efficient way to accomplish this today? If not, is there any plan for it, or an obvious way to extend Comunica to support it? Or would this be beyond the scope of the project? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That's an interesting question! What you may be looking for is called RDF Stream Processing (RSP), which allows continuous querying over data streams (possibly over moving time windows). As you said, an alternative approach is indeed rerunning the whole query upon data changes. |
Beta Was this translation helpful? Give feedback.
That's an interesting question!
What you may be looking for is called RDF Stream Processing (RSP), which allows continuous querying over data streams (possibly over moving time windows).
This is something that is unfortunately not possible at the moment with Comunica.
Architecturally, RSP support can definitely be added, it would just require some implementation effort.
It's not on the roadmap at the moment, but contributions are definitely welcome.
As you said, an alternative approach is indeed rerunning the whole query upon data changes.
But this may indeed be less efficient, but shouldn't be too big of a problem for smaller datasets.
If you follow this route, make sure to invalid the i…