* is the dynamic dataset from the collection of graphs from the dataset
* that go to make up the default graph (union) and named graphs.
*/
public static DatasetGraph dynamicDataset(Collection<Node> defaultGraphs, Collection<Node> namedGraphs, DatasetGraph dsg, boolean defaultUnionGraph)
{
Graph dft = new GraphUnionRead(dsg, defaultGraphs) ;
DatasetGraph dsg2 = new DatasetGraphMap(dft) ;
// The named graphs.
for ( Node gn : namedGraphs )
{
Graph g = GraphOps.getGraph(dsg, gn) ;
if ( g != null )
dsg2.addGraph(gn, g) ;
}
if ( dsg.getContext() != null )
dsg2.getContext().putAll(dsg.getContext()) ;
if ( defaultUnionGraph && defaultGraphs.size() == 0 )
{
// Create a union graph - there were no defaultGraphs explicitly named.
Graph unionGraph = new GraphUnionRead(dsg, namedGraphs) ;
dsg2.setDefaultGraph(unionGraph) ;
}
// read-only, <urn:x-arq:DefaultGraph> and <urn:x-arq:UnionGraph> processing.
dsg2 = new DynamicDatasetGraph(dsg2) ;