Open robertbbb opened 3 years ago
I can confirm that the code above with the following lines to add
triples instead of add_graph
works fine:
mystore.add((
URIRef("http://example.org/John"),
URIRef("http://example.org/livesIn"),
URIRef("http://example.org/Vienna"),
))
I'll look into add_graph
next.
Another follow-up: I don't get a 415
error with your code above, instead I get no failure but also not graph addition. If I mangle the .../statements
URI then I get a 415
.
Also, when I look in the GraphDB query log after running the original code, i.e. add_graph
, I see:
[INFO ] 2021-02-08 21:10:42,973 [repositories/myrepo | c.o.t.m.MonitorRepositoryConnection] Incoming update:
CREATE GRAPH <http://example.org/mygraph>
So it looks to me like rdflib is passing the correct create graph message to GraphDB but GraphDB doesn't seem to be creating the graph correctly and there's no indication that the triples of the graph are being sent over.
Wehn I run CREATE GRAPH <http://example.org/mygraph>
directly in GraphDB's owl SPARQL UI, I get the message The number of statements did not change. Update took 0.1s, minutes ago. and no indication that a graph has actually been created (i.e. it's not listed), so it appears:
CREATE GRAPH <...>
add_graph
is sending a CREATE GRAPH <...>
command but no dataWith mystore.add(...) I get the exact same 415 error. In GraphDB's log it shows the following (for both add and add_graph):
[INFO ] 2021-02-08 13:36:27,926 [repositories/myrepo | c.o.f.s.GraphDBProtocolExceptionResolver] Client sent bad request ( 415) org.eclipse.rdf4j.http.server.ClientHTTPException: Unsupported MIME type: null
What versions did you use to run add() successfully? My setup is:
GraphDB 9.4.1 Python 3.9.1-64bit rdflib 5.0.0 (as installed by SPARQLWrapper, not directly)
GraphDB 8.10
Python 3.7
RDFLib 5.0.0
Definitely something odd there as I'm really not getting 415 errors.
I might have to look into the SPARQLUpdateStore code to see what headers are emitted.
I think I'm seeing the same behavior with Jena/Fuseki too. add
works fine but add_graph
gives no error but doesn't seem to do anything
I suspect I'm seeing a flavor of this problem with insert
and delete
updates in Fuseki. I'm working with rdflib 5.0.0, too. No errors are thrown. When I do a delete { ?s ?p ?o } where { ?s ?p ?o }
update on a non-empty graph, rdflib's local view of the graph is emptied, but when checking back on the Fuseki side, it turns out that the graph still contains all the triples from before. Similar effective-yet-not-effective effects are seen with insert
.
I'm seeing this when calling rdflib.Graph.update
on a named graph that has a SPARQLUpdateStore
referincing a Fuseki server as its underlying store.
I'm regularly using GraphDB with RDF libraries from a variety of languages, but could never make it with rdflib and hoped this will be solved in the major update that is 5.0.0. From what I was able to gather this is an issue of its SPARQLUpdateStore (which also happens to be weakly documented). The following is a piece of Python that attempts to write a graph into a GraphDB store.
Not sure if I'm doing something wrong or if there's a problem with rdflib, but what I get is:
requests.exceptions.HTTPError: 415 Client Error: for url: http://localhost:7200/repositories/myrepo/statements