get_example: Get an example SPARQL query from Wikidata

Description Usage Arguments Details Value See Also Examples

View source: R/utils.R

Description

Gets the specified example(s) from SPARQL query service examples page using Wikidata's MediaWiki API.

Usage

1
get_example(example_name)

Arguments

example_name

the names of the examples as they appear on this page

Details

If you are planning on extracting multiple examples, please provide all the names as a single vector for efficiency.

Value

The SPARQL query as a character vector.

See Also

query_wikidata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
sparql_query <- extract_example(c("Cats", "Horses"))
query_wikidata(sparql_query)
# returns a named list with two data frames
# one called "Cats" and one called "Horses"

sparql_query <- extract_example("Largest cities with female mayor")
cat(sparql_query)
query_wikidata(sparql_query)

## End(Not run)

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