Reputation: 137
I am using python to insert data into blazegraph. I want to specify the named graph to which the data gets inserted, but the code I am using is triggering the error:
SPARQLWrapper.SPARQLExceptions.QueryBadFormed: QueryBadFormed: a bad request has been sent to the endpoint, probably the sparql query is bad formed.
How can I solve this error and insert data into the given named graph?
from SPARQLWrapper import SPARQLWrapper, JSON, TURTLE, RDFXML
query='''
PREFIX dcterms: <http://purl.org/dc/terms/>
INSERT DATA {
GRAPH <http://example/shelf_A> {
<http://example/author> dcterms:name "author" .
<http://example/book> dcterms:title "book" ;
dcterms:author <http://example/author> .
}
}
'''
sparql =SPARQLWrapper("http://localhost:9999/blazegraph/namespace/kb/sparql")
sparql.setQuery(query)
sparql.method = 'POST'
sparql.query()
I also tried running this query from the update tab of blazegraph and the same error happens. What am I doing wrong?
Upvotes: 1
Views: 589