Reputation: 174
I'm trying to insert data my CumulusRDF via REST.
Problem: If i'm doing a query, it works nice, with the GET method
Ex: A simple query:
select *
where
{
?s ?p ?o.
}
GET method:
curl -X GET --header 'Accept: application/sparql-results' 'http://localhost:9090/cumulus/sparql?query=select+*+where+%7B%3Fs+%3Fp+%3Fo.%7D&accept=text%2Fhtml'
But, when i try to insert data, it fails.
Query:
PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT DATA
{
<http://example/book1> dc:title "Harry Potter".
}
POST method:
curl -i -X POST -H 'Content-Type: application/sparql-query' 'http://localhost:9090/cumulus/sparql?query=PREFIX+dc%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0AINSERT+DATA%0A%7B+%0A++%3Chttp%3A%2F%2Fexample%2Fbook1%3E+dc%3Atitle+%22Harry+Potter%22.%0A%7D
Erro:
HTTP/1.1 400 Bad Request
What i'm doing wrong? CumulusRDF is instaled in a Docker with Apache Cassandra DB.
Upvotes: 0
Views: 45
Reputation: 16700
In SPARQL queries are not updates. There are two separate languages.
If you use the HTTP query string, content-type is irrelevant. It should be?update=
.
Better is to POST with the update in the HTTP body and using
Content-Type: application/sparql-update
Upvotes: 3