ods_print_query returns a valid SPARQL query to call on the statistics.gov.scot API

ods_print_query(dataset, start_date = NULL, end_date = NULL,
  geography = NULL, ...)

Arguments

dataset

string. The identifying final part of a URI for a dataset on statistics.gov.scot.

start_date

string. Filter data points after this date.

end_date

string. Filter data points before this date.

geography

string. A valid SG geography code, or portion thereof.

...

Arbitrary filters requiring valid scheme = value structure.

Value

string. A valid SPARQL query.

Details

The dataset parameter must be passed a valid dataset name (a full list can be obtained by calling ods_all_datasets(). Other parameters can also be used to filter the dataset.

Examples

ods_print_query("average-household-size")
#> [1] "PREFIX qb: <http://purl.org/linked-data/cube#>\n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> select ?refArea ?refPeriod ?measureType ?value where { ?data qb:dataSet <http://statistics.gov.scot/data/average-household-size>. ?data <http://purl.org/linked-data/sdmx/2009/dimension#refArea> ?refAreaURI. ?refAreaURI rdfs:label ?refArea. ?data <http://purl.org/linked-data/sdmx/2009/dimension#refPeriod> ?refPeriodURI. ?refPeriodURI rdfs:label ?refPeriod. ?data <http://purl.org/linked-data/cube#measureType> ?measureTypeURI. ?measureTypeURI rdfs:label ?measureType. ?data ?measureTypeURI ?value. }"