Arthur Keen
2014-07-31 21:47:11 UTC
For executing CREATE or DELETE GRAPH in Fuseki
I tried to use them the same way as SPARQL INSERT/DELETE by posting to ../ds/update, but this did not work
Which Endpoint URL pattern I should use:
http://localhost:8080/ds/update,
http://localhost:8080/ds/graph
For Creating a graph do you use an http put or post request?
For deleting a graph do you use an http delete request
And the name of the variable to bind the query to. Using query, update, etc as variable names, see commented out lines of code below
Thanks very much,
Any guidance would be much appreciated
Arthur
For context, here is the node.js code that I am using to call fuseki, with commented out variations of httpreq that I have tried
//http://localhost:3000/graph/create?graphName=http://testGraph
app.get('/api/graph/create', function(req, res){
var update = "CREATE SILENT GRAPH <?:graphName>";
var graphName = req.param("graphName");
update = update.replaceAll("?:"+"graphName", graphName);
//httpreq.post(endpoint.getUpdateURL(), {parameters: {update: update}}, function (geterr, getres){
//httpreq.post(endpoint.getGraphURL(), {parameters: {update: update}}, function (geterr, getres){
httpreq.put(endpoint.getGraphURL(), {parameters: {query: update}}, function (geterr, getres){
if (geterr) return console.log(geterr);
res.send(endpoint.getGraphURL()+" "+ update+" "+ graphName);
});
});
//http://localhost:3000/graph/delete?graphName=http://testGraph
app.get('/graph/delete', function(req, res) {
var update = "DELETE SILENT GRAPH <?:graphName>";
var graphName = req.param("graphName");
update = update.replaceAll("?:" + "graphName", graphName);
//httpreq.post(endpoint.getUpdateURL(), {parameters: {update: update}}, function(geterr, getres) {
httpreq.delete(endpoint.getGraphURL(), {parameters: {graph: update}}, function(geterr, getres) {
if (geterr)
return console.log(geterr);
console.log(update);
res.send(endpoint.getGraphURL());
});
});
I tried to use them the same way as SPARQL INSERT/DELETE by posting to ../ds/update, but this did not work
Which Endpoint URL pattern I should use:
http://localhost:8080/ds/update,
http://localhost:8080/ds/graph
For Creating a graph do you use an http put or post request?
For deleting a graph do you use an http delete request
And the name of the variable to bind the query to. Using query, update, etc as variable names, see commented out lines of code below
Thanks very much,
Any guidance would be much appreciated
Arthur
For context, here is the node.js code that I am using to call fuseki, with commented out variations of httpreq that I have tried
//http://localhost:3000/graph/create?graphName=http://testGraph
app.get('/api/graph/create', function(req, res){
var update = "CREATE SILENT GRAPH <?:graphName>";
var graphName = req.param("graphName");
update = update.replaceAll("?:"+"graphName", graphName);
//httpreq.post(endpoint.getUpdateURL(), {parameters: {update: update}}, function (geterr, getres){
//httpreq.post(endpoint.getGraphURL(), {parameters: {update: update}}, function (geterr, getres){
httpreq.put(endpoint.getGraphURL(), {parameters: {query: update}}, function (geterr, getres){
if (geterr) return console.log(geterr);
res.send(endpoint.getGraphURL()+" "+ update+" "+ graphName);
});
});
//http://localhost:3000/graph/delete?graphName=http://testGraph
app.get('/graph/delete', function(req, res) {
var update = "DELETE SILENT GRAPH <?:graphName>";
var graphName = req.param("graphName");
update = update.replaceAll("?:" + "graphName", graphName);
//httpreq.post(endpoint.getUpdateURL(), {parameters: {update: update}}, function(geterr, getres) {
httpreq.delete(endpoint.getGraphURL(), {parameters: {graph: update}}, function(geterr, getres) {
if (geterr)
return console.log(geterr);
console.log(update);
res.send(endpoint.getGraphURL());
});
});