Jena ARQ QueryExecutionFactory.sparqlService() and Choosing the Reasoning Level

3 views
Skip to first unread message

david....@gmail.com

unread,
Feb 18, 2014, 2:42:48 PM2/18/14
to sta...@clarkparsia.com
Good afternoon,

I have just started using StarDog v2 - downloaded, unpacked and running within minutes - kudos to the team on making that so easy!

I am trying to run SPARQL queries using Jena against the StarDog HTTP endpoint. I leveraged the HttpAuthenticator support in Jena 2.11 I am able to successfully execute queries against the StarDog HTTP endpoint with authentication enabled. However, I have not been able to figure out how to set the HTTP header with the SD-Connection-String parameter. It appears that this is the only way to have StarDog run the reasoner in response to a query. Is it possible to make this work using the sparqlService() method versus using StarDog-specific classes for the connection?

The header I'm referring to is mentioned in the documentation (http://docs.stardog.com/owl2/#sd-Using-Reasoning) and specifically shows an example where an HTTP header is added:
curl -u admin:admin -X GET -H "SD-Connection-String: reasoning=QL" \
      "http://localhost:5822/myDB/query?query=..."

Thank you,

Dave Read

Stephen Nowell

unread,
Feb 18, 2014, 2:56:52 PM2/18/14
to sta...@clarkparsia.com
Hi Dave,

The preferred way of passing in a connection string via HTTP as of
Stardog 2.1 is via the sd-connection-string URL parameter instead of the
header.

curl -u admin:admin -X GET
"http://localhost:5822/myDB/query?sd-connection-string=reasoning%3DQL&query=..."

I will update our documentation to reflect this. Thanks for pointing it out!

-Stephen
> --
> -- --
> 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

david....@gmail.com

unread,
Feb 18, 2014, 3:23:29 PM2/18/14
to sta...@clarkparsia.com, ste...@clarkparsia.com
Stephen,

Thank you! That works perfectly.

Dave

Rob Vesse

unread,
Feb 19, 2014, 4:17:19 AM2/19/14
to sta...@clarkparsia.com
Just to close the loop on how you'd do this with Jena

When you call QueryExecutionFactory.sparqlService() you get back a QueryExecution which is of type QueryEngineHTTP, if you cast to this class you can then call the addParam() method to add custom parameters.

Hope this helps,

Rob

To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

david....@gmail.com

unread,
Feb 21, 2014, 11:53:19 PM2/21/14
to sta...@clarkparsia.com
Rob,

I appreciate the additional info. That will come in handy for setting other parameters in the request.

Dave
Reply all
Reply to author
Forward
0 new messages