Rdf-aggregate-repo

An aggregate RDF::Repository supporting a subset of named graphs and zero or more named graphs mapped to the default graph.

RDF::AggregateRepo

An aggregate RDF::Repository supporting a subset of named graphs and zero or more named graphs mapped to the default graph.

Description

Maps named graphs from one or more RDF::Queryable instances into a single object, allowing a specific set of named graphs to be seen, as well as a default graph made up from one or more named graphs. This is used to implement SPARQL Datasets.

Examples

require 'rdf'
require 'rdf/nquads'
repo = RDF::Repository.load("http://ruby-rdf.github.com/rdf/etc/doap.nq")
# Instantiate a new aggregate repo based on an existing repo
aggregate = RDF::AggregateRepo.new(repo)
# Use the default graph from the repo as the default graph of the aggregate
aggregate.add_default(false)
# Use a single named graph
aggregate.add_named(RDF::URI("http://greggkellogg.net/foaf#me"))
# Retrieve all contexts
aggreggate.contexts.to_a #=> [RDF::URI("http://greggkellogg.net/foaf#me")]