Quad class final
Represents an immutable RDF quad with graph context
An RDF quad extends the triple model (subject, predicate, object) with a fourth component that specifies the graph containing the statement. This enables:
- Context tracking: Know which graph contains each statement
- Provenance management: Track the source or context of RDF data
- Dataset operations: Work with multi-graph RDF datasets efficiently
- N-Quads support: Direct compatibility with quad-based serialization
The graph component can be null to indicate the default graph, following RDF 1.1 Dataset semantics where every dataset has exactly one default graph and zero or more named graphs.
Design Principles
- Standard Parameter Order: Uses (S, P, O, G) order consistent with other RDF libraries
- Immutability: All components are final, ensuring thread safety
- Null Graph Handling: Null graph name represents the default graph
- Triple Compatibility: Easy bidirectional conversion with Triple class
Example:
// Create quad with named graph
final namedQuad = Quad(
IriTerm('http://example.org/alice'),
IriTerm('http://xmlns.com/foaf/0.1/name'),
LiteralTerm.string('Alice'),
IriTerm('http://example.org/graphs/people')
);
// Create quad in default graph
final defaultQuad = Quad(alice, foaf.email, aliceEmail);
Constructors
- Quad.new(RdfSubject subject, RdfPredicate predicate, RdfObject object, [RdfGraphName? graphName])
-
Creates a new RDF quad with the specified components
const
- Quad.fromTriple(Triple triple, [RdfGraphName? graphName])
- Creates a quad from an existing triple and optional graph name
Properties
- graphName → RdfGraphName?
-
The graph containing this statement
final
- hashCode → int
-
Provides a hash code for this quad based on all four components
no setteroverride
- isDefaultGraph → bool
-
Whether this quad belongs to the default graph
no setter
- object → RdfObject
-
The object (value) of this RDF statement
final
- predicate → RdfPredicate
-
The predicate (property) of this RDF statement
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subject → RdfSubject
-
The subject of this RDF statement
final
- triple → Triple
-
Extracts the triple component of this quad (without graph context)
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns a string representation of this quad
override
Operators
-
operator ==(
Object other) → bool -
Compares this quad to another object for equality
override