Skip to contents

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

Usage

ods_print_query(dataset, geography = NULL, labelled = FALSE, ...)

Arguments

dataset

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

geography

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

labelled

logical. To indicate whether to include `refAreaLabelled` column.

...

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#>                 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>                 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> ?refArea. ?data <http://purl.org/linked-data/sdmx/2009/dimension#refPeriod> ?refPeriodURI.      ?refPeriodURI rdfs:label ?refPeriod. ?data <http://purl.org/linked-data/cube#measureType> ?measureType. ?data ?measureType ?value. }"