RdfDataset.fromQuads constructor
Creates a dataset from a collection of RDF quads
This factory constructor processes a collection of quads and organizes them into the appropriate graphs based on their graph context. Quads with null graph names are added to the default graph, while quads with graph names are organized into their respective named graphs.
This is particularly useful when:
- Processing N-Quads data that includes graph context
- Converting from quad-based representations to dataset structure
- Bulk-loading RDF data with mixed graph contexts
Parameters:
quads
Collection of RDF quads to organize into dataset structure
Returns: A new RdfDataset with quads organized into default and named graphs.
Example:
final quads = [
Quad(alice, foaf.name, aliceName), // default graph
Quad(bob, foaf.age, bobAge, peopleGraph), // named graph
Quad(charlie, foaf.email, charlieEmail, peopleGraph), // same named graph
];
final dataset = RdfDataset.fromQuads(quads);
assert(dataset.defaultGraph.size == 1); // Alice's name
assert(dataset.graph(peopleGraph)?.size == 2); // Bob and Charlie
Implementation
RdfDataset.fromQuads(Iterable<Quad> quads) : this._fromQuadCollection(quads);