pythongraph-databasesrdflibanzograph

Using rdflib with anzograph


I am using the community edition of anzograph. I have no problem using the sparql http protocol, however when I try to use the graph store protocol via rdflib I get a result I don't understand. I am running the docker image from the anzo website and have mapped ports -p 80:8080 443:8443 7070:7070.

Here is the snippet from jupyter notbook

import rdflib
import rdflib.plugins.stores.sparqlstore as store

store = store.SPARQLStore("http://192.168.1.104:7070/rdf-graph-store")
graph = rdflib.ConjunctiveGraph(store=store)


graph.query("select (count(*) as ?c) {?s ?p ?o}")

This gives the message

ValueError: You did something wrong formulating either the URI or your SPARQL query

and an http error 406, higher up in the stack.

Is there anything obvious I should be changing?


Solution

  • Solved! In spite of what the documentation says, using /sparql (rather than /rdf-graph-store) together with the graph store port of 7070 works. So the correct snippet is:

    import rdflib
    import rdflib.plugins.stores.sparqlstore as store
    
    store = store.SPARQLStore("http://192.168.1.104:7070/sparql")
    graph = rdflib.ConjunctiveGraph(store=store)
    
    
    graph.query("select (count(*) as ?c) {?s ?p ?o}")