Description
A set of RDF statements across one or more graphs.
An RDF dataset is a set, so inserting the same statement twice leaves one. Identity is the statement's N-Quads serialization, which makes two statements the same exactly when they denote the same RDF statement -- including blank node labels, which are part of a statement's identity within a dataset even though they carry no meaning outside it.
Iteration is in serialization order rather than insertion order. That costs nothing here and buys a property worth having: two datasets built by different routes iterate identically, so comparing them, printing them, or hashing them needs no separate sort.
"="
function "=" (Left, Right : Dataset) return Boolean
Compare two datasets as sets of statements.
This is equality of labelled statements, not isomorphism: two datasets that differ only in their blank node labels are not equal here. Deciding that requires canonicalization.
Parameters
- Left
First dataset
- Right
Second dataset
Return value
True when both hold the same statements
Clear
procedure Clear (Value : in out Dataset)
Discard every statement.
Parameters
- Value
Dataset to empty
Contains
function Contains
(Value : Dataset; Statement : Quads.Quad) return Boolean
Report whether a statement is present.
Parameters
- Value
Dataset to search
- Statement
Statement to look for
Return value
True when Statement is present
Dataset
type Dataset is private;
A collection of statements.
Delete
procedure Delete (From : in out Dataset; Value : Quads.Quad)
Remove a statement, ignoring one that is absent.
Parameters
- From
Dataset to reduce
- Value
Statement to remove
Empty
function Empty return Dataset
An empty dataset.
Return value
A dataset containing no statements
Graph_Count
function Graph_Count (Value : Dataset) return Natural
Report the number of distinct graphs holding at least one statement, counting the default graph when it is used.
Parameters
- Value
Dataset to measure
Return value
Graph count
Insert
procedure Insert (Into : in out Dataset; Value : Quads.Quad)
Add a statement, ignoring one that is already present.
Parameters
- Into
Dataset to extend
- Value
Statement to add
Insert
procedure Insert
(Into : in out Dataset;
Value : Quads.Quad;
Inserted : out Boolean)
Add a statement and report whether it was new.
Parameters
- Into
Dataset to extend
- Value
Statement to add
- Inserted
True when Value was not already present
Is_Empty
function Is_Empty (Value : Dataset) return Boolean
Report whether the dataset holds no statements.
Parameters
- Value
Dataset to test
Return value
True when Length is zero
Iterate
procedure Iterate
(Value : Dataset;
Process : not null access procedure (Statement : Quads.Quad))
Visit every statement in serialization order.
Parameters
- Value
Dataset to traverse
- Process
Callback receiving each statement
Iterate_Graph
procedure Iterate_Graph
(Value : Dataset;
Graph : Quads.Graph_Name;
Process : not null access procedure (Statement : Quads.Quad))
Visit every statement of one graph, in serialization order.
Parameters
- Value
Dataset to traverse
- Graph
Graph to restrict to
- Process
Callback receiving each statement
Iterate_Graphs
procedure Iterate_Graphs
(Value : Dataset;
Process : not null access procedure (Graph : Quads.Graph_Name))
Visit each graph that holds at least one statement, in serialization order, with the default graph first when present.
Parameters
- Value
Dataset to traverse
- Process
Callback receiving each graph name
Length
function Length (Value : Dataset) return Natural
Report the number of distinct statements.
Parameters
- Value
Dataset to measure
Return value
Statement count
To_NQuads
function To_NQuads (Value : Dataset) return String
Serialize the whole dataset as N-Quads, one statement per line, each terminated by a line feed. Statements appear in serialization order, so the result is a deterministic function of the dataset's contents.
Parameters
- Value
Dataset to serialize
Return value
The dataset in N-Quads syntax