Skip to content

datasets

This module contains a number of common tasks using the RDFLib Dataset class.

An RDFLib Dataset is an object that stores multiple Named Graphs - instances of RDFLib Graph identified by IRI - within it and allows whole-of-dataset or single Graph use.

Dataset extends Graph’s Subject, Predicate, Object structure to include Graph - archaically called Context - producing quads of s, p, o, g.

There is an older implementation of a Dataset-like class in RDFLib < 7.x called ConjunctiveGraph that is now deprecated.

Sections in this module:

  1. Creating & Growing Datasets
  2. Looping & Counting triples/quads in Datasets
  3. Manipulating Graphs with Datasets

Attributes:

d module-attribute

d = Dataset()

g_no_id module-attribute

g_no_id = Graph()

g_with_id module-attribute

g_with_id = Graph(identifier=URIRef('http://example.com/graph-3'))

graph_1_id module-attribute

graph_1_id = URIRef('http://example.com/graph-1')