rdf_query: Perform a SPARQL Query

Description Usage Arguments Value Examples

View source: R/rdf_query.R

Description

Perform a SPARQL Query

Usage

1

Arguments

rdf

an rdf object (e.g. from rdf_parse)

query

a SPARQL query, as text string

data.frame

logical, should the results be returned as a data.frame?

...

additional arguments to a redland initialize-Query

Value

a data.frame of all query results (default.) Columns will be named according to variable names in the SPARQL query. Returned object values will be coerced to match the corresponding R type to any associated datatype URI, if provided. If a column would result in mixed classes (e.g. strings and numerics), all types in the column will be coerced to character strings. If data.frame is false, results will be returned as a list with each element typed by its data URI.

Examples

1
2
3
4
5
6
7
8
9
doc <- system.file("extdata", "dc.rdf", package="redland")

sparql <-
'PREFIX dc: <http://purl.org/dc/elements/1.1/>
 SELECT ?a ?c
 WHERE { ?a dc:creator ?c . }'

rdf <- rdf_parse(doc)
rdf_query(rdf, sparql)

rdflib documentation built on Jan. 10, 2020, 9:07 a.m.