I am using Ontotext GraphDB to store semantic data.
GraphDB allows to store/save sparql queries which are exposed as web services.
However I want to store/save sparql queries through HTTP POST request. Below is my query and name of the query will be Query-1
:
let $Query := fn:concat('PREFIX dc: <http://insert/>
INSERT DATA
{
dc:a@gmail.com dc:played dc:1234 .
}
')
let $EncodeUri := fn:encode-for-uri($Query)
Can anyone help me to write HTTP-POST request command to save this query in GraphDB? I want to use xdmp:http-post()
only.
To get the query result I have used xdmp:http-get('http://localhost:8080//rest/sparql/saved-queries/Query-2')
which works fine.
You can execute a POST request to store queries. Following example is using curl:
curl -X POST http://localhost:8080/rest/sparql/saved-queries\
-H 'Content-Type:application/json'\
-d '{
"body": "select * { ?s ?p ?o }",
"name": "Query-2"
}'
You can also find more details about the REST API using GraphDB Workbench (Admin -> REST API Documentation)