Sends a query by POST (a VALUES block of a hundred URIs is too long for a
GET URL) and returns the results as a table. sparql_values() formats URIs
as a VALUES block.
Usage
sparql_query(
query,
endpoint = "https://publications.europa.eu/webapi/rdf/sparql",
pause = 1,
max_tries = 12L
)
sparql_values(variable, uris)Arguments
- query
Character. A SPARQL query.
- endpoint
Character. URL of the endpoint. By default the endpoint of the EU Publications Office (CELLAR).
- pause
Numeric. Minimum seconds between two queries to the endpoint.
- max_tries
Integer. Attempts per query.
- variable
Character. Variable name, without
?.- uris
Character vector of URIs.
Value
sparql_query(): a data.table with one character column per
selected variable, NA for an unbound variable. A query that still fails
after the retries is an error of class politecollect_request_failed.
sparql_values(): a string.
Details
Results are requested as SPARQL JSON rather than CSV: abstracts contain quotes and line breaks that make CSV parsing fragile.
The defaults come from build_eu_database. CELLAR answers 5xx when
overloaded, with outages of up to 14 minutes observed (2026-10-20), and
rate-limits bursts of queries with HTTP 429 and a Retry-After header
(1,800 s observed on 2026-10-16), which is honoured: a run can pause for
half an hour and then resume by itself. Up to 12 tries, over about 33
minutes. Do not run several harvests of an endpoint at once.
robots.txt is not read: an endpoint is an API, governed by its terms of use.