I like to explore the contents of my triplestores with either the rrdf or SPARQL packages in R. I believe they use cURL under the hood. They can take additional parameters, beyond the endpoint address and the query itself.
Here's GraphDB's notes on cURL-based queries: http://graphdb.ontotext.com/documentation/standard/quick-start-guide.html#query-data-programmatically
I could swear I connected to some password-protected triplestore from R in the past, but I can't remember how I did it. It might have been Stardog or Blazegraph.
I'll be connecting over a VPN. I hope that I can relax the usual rule about not embedding sensitive data (like a password) in a plain text URL.
From RCurl: HTTP Authentication When Site Responds With HTTP 401 Code Without WWW-Authenticate:
the key is specifying the type of authentication (httpauth
) as a bitmap option (1L
), to be passed to rCURL.
library(SPARQL)
graphdb.address.port <- "http://localhost:7200"
selected.repo <- "mymedicalrecrods"
sparql.base <-
paste0(graphdb.address.port, "/repositories/", selected.repo)
sparql.prefixes <- ""
api.user <- "markmiller"
api.pass <- rstudioapi::askForPassword()
placeholder.q <- paste0(
'
PREFIX owl: <http://www.w3.org/2002/07/owl#>
select *
where {
graph ?g {
?s ?p ?o
}
}
limit 9
')
sparql.result <-
SPARQL::SPARQL(
url = sparql.base,
query = placeholder.q,
curl_args = list('userpwd' = paste0(api.user,":", api.pass), "httpauth" = 1L)
)
sparql.result<- sparql.result$results