Skip to contents

Initialize a query object.

Usage

spq_init(
  endpoint = "wikidata",
  request_control = spq_control_request(user_agent = getOption("glitter.ua",
    "glitter R package (https://github.com/lvaudor/glitter)"), max_tries =
    getOption("glitter.max_tries", 3L), max_seconds = getOption("glitter.max_seconds",
    120L), timeout = getOption("glitter.timeout", 1000L), request_type = c("url",
    "body-form")),
  endpoint_info = spq_endpoint_info(label_property = "rdfs:label")
)

Arguments

endpoint

Endpoint, either name if it is in usual_endpoints, or an URL

request_control

An object as returned by spq_control_request()

endpoint_info

Do not use for an usual endpoint in usual_endpoints! Information about the endpoint

Value

A query object

Printing

SPARQL queries are shown using the cli package, with a built-in theme. You can change it by using the cli.user_theme option. We use

  • .emph for keywords and functions,

  • .field for variables,

  • .pkg for prefixes,

  • .val for strings,

  • .url for prefix URLs.

You can also turn off the cli behavior by setting the environment variable "GLITTER.NOCLI" to any non-empty string. That's what we do in glitter snapshot tests.