Code snippets from a node application I am building. This is a get handler I am using to test access to stardog.
Stardog is running locally, and I can execute the query successfully using the web console
Breakpointing the console.log(data.results.binding) line shows that the data object is an error object with error code HPE_INVALID_CONSTANT.
From what I see by searching the web, this appears to be a wrong header sent from stardog. I would be surprised if this was the case, but am at a loss to understand why I am getting this. Bytesparsed in the error object = 0.
var stardog = require("stardog");
var stardogconn = new stardog.Connection();
stardogconn.setEndpoint("http:localhost:5820/sdtest");
stardogconn.setCredentials("admin","admin");
vocabroutes.get('/:vocaburl/test', function(req,res) {
console.log(stardogconn.getEndpoint());
var qryobj = {
database: "sdtest"
};
qryobj.query = "SELECT DISTINCT ?g ?s WHERE {GRAPH ?g {?s ?p ?o}}";
stardogconn.query(qryobj, function (data) {
console.log(data.results.bindings);
});
})