Query using R, Authentication question

19 views
Skip to first unread message

novas...@gmail.com

unread,
Oct 28, 2016, 12:51:28 PM10/28/16
to Stardog
Hello Stardog folks,

I'm new here, assessing a conversion from Virtuoso to Stardog.  I've installed Stardog and successfully uploaded .TTL files.  Now I wish to query the data base from other applications, including R. I am successfully using the R rrdf package to query a local Virtuoso store. When I change my R script to point to my new Stardog database I not unexpectedly receive an authentication error. I am unsure how to pass the user/authentication information in the connection string.  Can someone point me to a working example of a configuration and a connection string? 

   Stardog 4.2
   Windows 7 ( I know, I know!!  Not my choice...)
  
Is anyone using R to connect and query data from Stardog?

My R script:  

library(rrdf)
query = " SELECT * WHERE {?s ?p ?o . } LIMIT 10 "
data = sparql.remote(endpoint, query)

I receive message:
   Warning message:
   In .jcall("com/github/egonw/rrdf/RJenaHelper", "Lcom/github/egonw/rrdf/StringMatrix;",  :
  org.apache.http.HttpException: Expected HTTP 200, but got a 401: Unauthorized

Thanks for any advice you may have!

Tim

Stephen Nowell

unread,
Oct 28, 2016, 1:01:09 PM10/28/16
to sta...@clarkparsia.com
Hi Tim,

Taking a look at the source code for rrdf [1], it looks like the
sparql.remote function takes some optional parameters, two of which are
user and password. I would try passing those in and it should get you
around the 401 response. The out-of-the-box user/pass for a new Stardog
install is admin/admin, and the documentation [2] covers the ways to
make that better.

Cheers,
Stephen

[1] https://github.com/egonw/rrdf/blob/master/rrdf/R/sparql.remote.R
[2] http://docs.stardog.com/#_security
> --
> -- --
> 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

novas...@gmail.com

unread,
Oct 28, 2016, 1:09:52 PM10/28/16
to Stardog, ste...@stardog.com
Thanks, Stephen!

Immediately after posting I discovered the disable security option which allowed me to connect to and query the database.

stardog-admin.bat server start --disable-security

Now that I know I can connect and issue queries, I will try it with authentication.

Tim
Reply all
Reply to author
Forward
0 new messages