com.hp.hpl.jena.sparql.core
Class DatasetGraphMap

java.lang.Object
  extended by com.hp.hpl.jena.sparql.core.DatasetGraphBase
      extended by com.hp.hpl.jena.sparql.core.DatasetGraphBaseFind
          extended by com.hp.hpl.jena.sparql.core.DatasetGraphCollection
              extended by com.hp.hpl.jena.sparql.core.DatasetGraphMap
All Implemented Interfaces:
DatasetGraph, Closeable
Direct Known Subclasses:
DatasetGraphMaker

public class DatasetGraphMap
extends DatasetGraphCollection

Implementation of a DatasetGraph as an extensible set of graphs. Subclasses need to manage any implicit graph creation.


Constructor Summary
DatasetGraphMap(DatasetGraph dsg)
          Create a new DatasetGraph that initially shares the graphs of the givem DatasetGraph.
DatasetGraphMap(com.hp.hpl.jena.graph.Graph defaultGraph)
           
 
Method Summary
 void addGraph(com.hp.hpl.jena.graph.Node graphName, com.hp.hpl.jena.graph.Graph graph)
          Add the given graph to the dataset.
 void close()
          Close the dataset
 boolean containsGraph(com.hp.hpl.jena.graph.Node graphNode)
           
 com.hp.hpl.jena.graph.Graph getDefaultGraph()
          Get the default graph as a Jena Graph
 com.hp.hpl.jena.graph.Graph getGraph(com.hp.hpl.jena.graph.Node graphNode)
          Get the graph named by graphNode : returns null on no graph NB Whether a dataset contains a graph if there are no triples is not defined - see the specifc implementation.
 Iterator<com.hp.hpl.jena.graph.Node> listGraphNodes()
          Iterate over all names of named graphs
 void removeGraph(com.hp.hpl.jena.graph.Node graphName)
          Remove all data associated with the named graph
 void setDefaultGraph(com.hp.hpl.jena.graph.Graph g)
          Set the default graph.
 long size()
          Get the size (number of named graphs) - may be -1 for unknown
 
Methods inherited from class com.hp.hpl.jena.sparql.core.DatasetGraphCollection
add, delete
 
Methods inherited from class com.hp.hpl.jena.sparql.core.DatasetGraphBaseFind
find, findNG
 
Methods inherited from class com.hp.hpl.jena.sparql.core.DatasetGraphBase
add, contains, contains, delete, deleteAny, find, find, getContext, getLock, isEmpty, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DatasetGraphMap

public DatasetGraphMap(com.hp.hpl.jena.graph.Graph defaultGraph)

DatasetGraphMap

public DatasetGraphMap(DatasetGraph dsg)
Create a new DatasetGraph that initially shares the graphs of the givem DatasetGraph. Adding/removing graphs will only affect this object, not the argument DatasetGraph but changed to shared graphs are seenby both objects.

Method Detail

containsGraph

public boolean containsGraph(com.hp.hpl.jena.graph.Node graphNode)
Specified by:
containsGraph in interface DatasetGraph
Overrides:
containsGraph in class DatasetGraphBase

getDefaultGraph

public com.hp.hpl.jena.graph.Graph getDefaultGraph()
Description copied from interface: DatasetGraph
Get the default graph as a Jena Graph

Specified by:
getDefaultGraph in interface DatasetGraph
Specified by:
getDefaultGraph in class DatasetGraphBase

getGraph

public com.hp.hpl.jena.graph.Graph getGraph(com.hp.hpl.jena.graph.Node graphNode)
Description copied from interface: DatasetGraph
Get the graph named by graphNode : returns null on no graph NB Whether a dataset contains a graph if there are no triples is not defined - see the specifc implementation. Some datasets are "open" - they have all graphs even if no triples,

Specified by:
getGraph in interface DatasetGraph
Specified by:
getGraph in class DatasetGraphBase

addGraph

public void addGraph(com.hp.hpl.jena.graph.Node graphName,
                     com.hp.hpl.jena.graph.Graph graph)
Description copied from interface: DatasetGraph
Add the given graph to the dataset. Replaces any existing data for the named graph; to add data, get the graph and add triples to it, or add quads to the dataset. Do not assume that the same Java object is returned by DatasetGraph.getGraph(com.hp.hpl.jena.graph.Node)

Specified by:
addGraph in interface DatasetGraph
Overrides:
addGraph in class DatasetGraphBase

removeGraph

public void removeGraph(com.hp.hpl.jena.graph.Node graphName)
Description copied from interface: DatasetGraph
Remove all data associated with the named graph

Specified by:
removeGraph in interface DatasetGraph
Overrides:
removeGraph in class DatasetGraphBase

setDefaultGraph

public void setDefaultGraph(com.hp.hpl.jena.graph.Graph g)
Description copied from interface: DatasetGraph
Set the default graph. Set the active graph if it was null. This replaces the contents default graph, not merge data into it. Do not assume that the same object is returned by DatasetGraph.getDefaultGraph()

Specified by:
setDefaultGraph in interface DatasetGraph
Overrides:
setDefaultGraph in class DatasetGraphBase

listGraphNodes

public Iterator<com.hp.hpl.jena.graph.Node> listGraphNodes()
Description copied from interface: DatasetGraph
Iterate over all names of named graphs

Specified by:
listGraphNodes in interface DatasetGraph
Specified by:
listGraphNodes in class DatasetGraphCollection

size

public long size()
Description copied from interface: DatasetGraph
Get the size (number of named graphs) - may be -1 for unknown

Specified by:
size in interface DatasetGraph
Overrides:
size in class DatasetGraphBase

close

public void close()
Description copied from interface: DatasetGraph
Close the dataset

Specified by:
close in interface DatasetGraph
Specified by:
close in interface Closeable
Overrides:
close in class DatasetGraphBase


Licenced under the Apache License, Version 2.0