Skip to contents

Fetch data from a SPARQL endpoint and store the output in a dataframe

Usage

sparql2df(endpoint, query, autoproxy = FALSE, auth = NULL)

Arguments

endpoint

The SPARQL endpoint (a URL)

query

The SPARQL query (character)

autoproxy

Try to detect a proxy automatically (boolean). Useful on Windows machines behind corporate firewalls

auth

Authentication Information (httr-authenticate-object)

Value

SPARQL query result in data.frame format

Examples

library(SPARQLchunks)
endpoint <- "https://lindas.admin.ch/query"
query <- "PREFIX schema: <http://schema.org/>
  SELECT * WHERE {
  ?sub a schema:DataCatalog .
  ?subtype a schema:DataType .
}"
result_df <- sparql2df(endpoint, query)
#> Preparing to send query to: https://lindas.admin.ch/query
#> SPARQL string:
#> PREFIX schema: <http://schema.org/>
#>   SELECT * WHERE {
#>   ?sub a schema:DataCatalog .
#>   ?subtype a schema:DataType .
#> }
#> Query URL:
#> https://lindas.admin.ch/query?query=PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0A%20%20SELECT%20%2A%20WHERE%20%7B%0A%20%20%3Fsub%20a%20schema%3ADataCatalog%20.%0A%20%20%3Fsubtype%20a%20schema%3ADataType%20.%0A%7D