I have a number of graphs in an anzograph. Using rdflib, I want to access them as a union graph.
Without the store
and parsing the graphs into memory, it works fine as a ConjunctiveGraph
. However, when attaching to Anzo as a store, I cannot get the union graph.
Here are the snippets:
import rdflib
import rdflib.plugins.stores.sparqlstore as store
store = store.SPARQLUpdateStore("http://192.168.1.104:7070/sparql", "http://192.168.1.104:7070/update")
graph = rdflib.ConjunctiveGraph(store=store)
Then
for c, in graph.query("select (count(*)as ?c) {?s ?p ?o}"):
print(c)
gives this output
0
While
for g, c in graph.query("select distinct ?g (count(*)as ?c) {graph ?g{?s ?p ?o}}group by ?g"):
print(g, c)
gives
urn:2022-11-25.ttl 5760
urn:2022-11-27.ttl 9160
urn:2022-11-24.ttl 5565
urn:2022-11-26.ttl 7645
urn:2022-11-22.ttl 2820
urn:2022-11-23.ttl 7250
The rdflib manual states
A ConjunctiveGraph is an (unnamed) aggregation of all the named graphs in a store. ... All queries are carried out against the union of all graphs.
Is there any setup to achieve a union graph with Anzo as the store?