This query derives SPARQL filter statement using the IN syntax.

construct_filter(sparql_variable, filter_values, use_str = FALSE)

Arguments

sparql_variable

A character scalar to be used in IN clause, without ?.

filter_values

A vector of filter values to be verified against in the filter statement.

use_str

A logical, defaults to FALSE, if TRUE it produces str(?variable) instead of ?variable.

Value

A character scalar corresponding to SPARQL filter expression.

Details

For instance, arguments sparql_variable = "time" and filter_values = c(2011, 2012) will result in a expression FILTER (?time IN ( "2011, 2012" )).

Examples

# This function is not exported from the package as it's mostly used # internally. SmarterScotland:::construct_filter(sparql_variable = "time", filter_values = c(2011, 2012))
#> [1] "FILTER (?time IN ('2011', '2012'))"
SmarterScotland:::construct_filter(sparql_variable = "time", use_str = TRUE, filter_values = c(2011, 2012))
#> [1] "FILTER (str(?time) IN ('2011', '2012'))"