query_factory: Convert a parameterized SPARQL query to an R function

Description Usage Arguments Value Examples

View source: R/db-access-high-level.R

Description

The function ‘query_factory'’s purpose is to manufacture a function executing a specified SPARQL query against a specified endpoint.

Usage

1
2
query_factory(p_query, submit_function = submit_sparql, access_options,
  prefixes = NA, ...)

Arguments

p_query

character. A parameterized SPARQL query. Parameters are given with percent sign in front

submit_function

function. The function that should be used to submit the query - i.e. whether to use the READ endpoint or the UPDATE endpoint. One of submit_sparql, or submit_sparql_update. The detault is submit_sparql - i.e. use the READ endpoint.

access_options

triplestore_access_options.

prefix

named character

Value

the query function (closure)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
p_query = "SELECT DISTINCT ?id WHERE {
   ?id rdfs:label '%label'
 }"

 p_query2 = "SELECT * WHERE {
   ?s ?p ?o
 } LIMIT 100"

drop_query = "DROP GRAPH %subgraph"

simple_lookup = query_factory(p_query, access_options = graphdb)
simplest_f = query_factory(p_query2, access_options = graphdb)
drop_g = query_factory(drop_query, submit_function = submit_sparql_update, access_options = graphdb_secret)

vsenderov/rdf4r documentation built on May 3, 2019, 4:02 p.m.