Getting HPE_INVALID_CONSTANT response from conn.query using stardog.js in node with Stardog 3.x

11 views
Skip to first unread message

jrh...@thematix.com

unread,
Apr 29, 2015, 3:00:37 PM4/29/15
to sta...@clarkparsia.com
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);
});
})

Edgar Rodriguez

unread,
Apr 29, 2015, 3:29:31 PM4/29/15
to sta...@clarkparsia.com
It seems like your endpoint has not been set up correctly, please refer to the following example that seems to do something similar to your code, but using express[1]: https://github.com/Complexible/stardog.js/blob/develop/examples/express-app/index.js#L14

[1] http://expressjs.com/

Cheers,
Edgar

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Kendall Clark

unread,
Apr 29, 2015, 3:32:03 PM4/29/15
to sta...@clarkparsia.com
As Edgar implied, it might be good to spell the endpoint correctly. You want "http://".
--
Reply all
Reply to author
Forward
0 new messages