RdfDataset.fromGraphs constructor
- List<
RdfNamedGraph> graphs
Creates a dataset from a list of named graphs with an empty default graph
This factory constructor is convenient when you have a collection of named graphs and want to create a dataset with them. The default graph will be empty.
Parameters:
graphs
List of RdfNamedGraph instances to include in the dataset
Throws:
- ArgumentError if multiple graphs have the same name
Example:
final namedGraphs = [
RdfNamedGraph(IriTerm('http://example.org/graph1'), graph1),
RdfNamedGraph(IriTerm('http://example.org/graph2'), graph2),
];
final dataset = RdfDataset.fromGraphs(namedGraphs);
Implementation
RdfDataset.fromGraphs(List<RdfNamedGraph> graphs)
: defaultGraph = RdfGraph(),
_namedGraphs = Map.fromIterable(
graphs,
key: (g) => g.name,
value: (g) => g.graph,
);