query_wikidata: Send one or more SPARQL queries to WDQS

Description Usage Arguments Value Query limits See Also Examples

View source: R/query.R

Description

Makes a POST request to Wikidata Query Service SPARQL endpoint.

Usage

1
query_wikidata(sparql_query, format = c("simple", "smart"))

Arguments

sparql_query

SPARQL query (can be a vector of queries)

format

"simple" uses CSV and returns pure character data frame, while "smart" fetches JSON-formatted data and returns a data frame with datetime columns converted to POSIXct

Value

A tibble data frame

Query limits

There is a hard query deadline configured which is set to 60 seconds. There are also following limits:

See Also

get_example

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
sparql_query <- "SELECT
  ?softwareVersion ?publicationDate
WHERE {
  BIND(wd:Q206904 AS ?R)
  ?R p:P348 [
    ps:P348 ?softwareVersion;
    pq:P577 ?publicationDate
  ] .
}"
query_wikidata(sparql_query)

## Not run: 
query_wikidata(sparql_query, format = "smart")

## End(Not run)

WikidataQueryServiceR documentation built on July 2, 2020, 2:12 a.m.