RdfNamedGraph class final
Represents an immutable named graph in an RDF dataset
A named graph is a pair consisting of:
- An IRI that uniquely identifies the graph within a dataset
- An RDF graph containing zero or more triples
This class provides a type-safe way to associate graph names with their content, enabling:
- Clear separation of concerns in multi-graph datasets
- Provenance and context tracking for RDF data
- Support for SPARQL GRAPH operations
- Dataset construction and manipulation
Design Principles
- Immutability: Once created, neither name nor graph can be changed
- Type Safety: Prevents mismatched name-graph associations
- Standard Compliance: Follows RDF 1.1 specification exactly
- Simplicity: Minimal interface focused on the essential pairing
Performance Characteristics
- Construction: O(1) - simple field assignment
- Access: O(1) - direct field access
- Memory: Minimal overhead beyond the constituent name and graph
Example:
// Create a named graph for organizational data
final orgGraph = RdfGraph(triples: organizationTriples);
final namedGraph = RdfNamedGraph(
IriTerm('http://example.org/graphs/organization'),
orgGraph
);
// Use in dataset operations
final dataset = RdfDataset.withGraphs([namedGraph]);
final retrievedGraph = dataset.graph(namedGraph.name);
assert(retrievedGraph == namedGraph.graph);
Constructors
- RdfNamedGraph.new(RdfGraphName name, RdfGraph graph)
- Creates a new named graph with the specified name and content
Properties
- graph → RdfGraph
-
The RDF graph containing the actual triple data
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → RdfGraphName
-
The IRI name that uniquely identifies this graph within a dataset
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited