de.fuberlin.wiwiss.ng4j.sparql
Class ARQNamedGraphSet

java.lang.Object
  extended by de.fuberlin.wiwiss.ng4j.impl.NamedGraphSetIO
      extended by de.fuberlin.wiwiss.ng4j.impl.NamedGraphSetBase
          extended by de.fuberlin.wiwiss.ng4j.sparql.ARQNamedGraphSet
All Implemented Interfaces:
NamedGraphSet

public class ARQNamedGraphSet
extends NamedGraphSetBase

Wraps an ARQ DataSource into the NamedGraphSet interface.

Note: The DataSource's default graph is not visible through the NamedGraphSet interface. Only the named graphs are exposed.

The asJenaGraph(Node) and asJenaModel(String) methods are not implemented.

Useful to read and write TriX and TriG from DataSources.

Author:
Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
ARQNamedGraphSet(com.hp.hpl.jena.query.DataSource source)
           
 
Method Summary
 void addGraph(NamedGraph graph)
          Adds a NamedGraph to the set.
 Graph asJenaGraph(Node defaultGraphForAdding)
          Returns the union graph of the NamedGraphSet.
 NamedGraphModel asJenaModel(String defaultGraphForAdding)
          Returns a Jena Model view on the NamedGraphSet, equivalent to the union graph of all graphs in the graph set.
 void clear()
          Deletes all NamedGraphs from the set.
 void close()
          Closes the NamedGraphSet and frees up resources held.
 boolean containsGraph(Node graphName)
          Tells wether the NamedGraphSet contains a NamedGraph.
 boolean containsGraph(String graphNameURI)
          Tells wether the NamedGraphSet contains a NamedGraph.
 long countGraphs()
          Returns the number of NamedGraphs in the set.
 NamedGraph createGraph(Node graphName)
          Creates a new NamedGraph and adds it to the set.
 NamedGraph createGraph(String graphNameURI)
          Creates a new NamedGraph and adds it to the set.
 NamedGraph getGraph(Node graphName)
          Returns the NamedGraph with a specific name from the GraphSet.
 NamedGraph getGraph(String graphNameURI)
          Returns the NamedGraph with a specific name from the GraphSet.
 boolean isEmpty()
          Tells wether the set contains any NamedGraphs.
 Iterator listGraphs()
          Returns an iterator over all NamedGraphs in the set.
 void removeGraph(Node graphName)
          Removes a NamedGraph from the set.
 void removeGraph(String graphNameURI)
          Removes the NamedGraph with a specific name.
 
Methods inherited from class de.fuberlin.wiwiss.ng4j.impl.NamedGraphSetBase
addQuad, containsQuad, countQuads, findQuads, findQuads, removeQuad
 
Methods inherited from class de.fuberlin.wiwiss.ng4j.impl.NamedGraphSetIO
read, read, read, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.fuberlin.wiwiss.ng4j.NamedGraphSet
read, read, read, write, write
 

Constructor Detail

ARQNamedGraphSet

public ARQNamedGraphSet(com.hp.hpl.jena.query.DataSource source)
Method Detail

getGraph

public NamedGraph getGraph(String graphNameURI)
Description copied from interface: NamedGraphSet
Returns the NamedGraph with a specific name from the GraphSet. Changes to the graph will be reflected in the set.

Parameters:
graphNameURI - The name of the NamedGraph to be returned
Returns:
The graph with that name, or null if no graph with that name is contained in the set

getGraph

public NamedGraph getGraph(Node graphName)
Description copied from interface: NamedGraphSet
Returns the NamedGraph with a specific name from the GraphSet. Changes to the graph will be reflected in the set.

Parameters:
graphName - The name of the NamedGraph to be returned
Returns:
The graph with that name, or null if no graph with that name is contained in the set

addGraph

public void addGraph(NamedGraph graph)
Description copied from interface: NamedGraphSet
Adds a NamedGraph to the set. Will replace a NamedGraph with the same name that is already in the set.

Parameters:
graph - The NamedGraph to be added

removeGraph

public void removeGraph(Node graphName)
Description copied from interface: NamedGraphSet
Removes a NamedGraph from the set. Nothing happens if no graph with that name is contained in the set. Node.ANY will remove all graphs from the set.

Parameters:
graphName - The name of the NamedGraph to be removed

removeGraph

public void removeGraph(String graphNameURI)
Description copied from interface: NamedGraphSet
Removes the NamedGraph with a specific name. Nothing happens if no graph with that name is contained in the set. Node.ANY will remove all graphs from the set.

Parameters:
graphNameURI - The name of the NamedGraph to be removed

containsGraph

public boolean containsGraph(Node graphName)
Description copied from interface: NamedGraphSet
Tells wether the NamedGraphSet contains a NamedGraph.

Parameters:
graphName - The name of a NamedGraph
Returns:
True if the set contains a graph with that name, false otherwise.

containsGraph

public boolean containsGraph(String graphNameURI)
Description copied from interface: NamedGraphSet
Tells wether the NamedGraphSet contains a NamedGraph.

Parameters:
graphNameURI - The name of a NamedGraph
Returns:
True if the set contains a graph with that name, false otherwise.

createGraph

public NamedGraph createGraph(Node graphName)
Description copied from interface: NamedGraphSet
Creates a new NamedGraph and adds it to the set. An existing graph with the same name will be replaced.

Parameters:
graphName - The name of the NamedGraph to be created; must be an URI node
Returns:
The newly created NamedGraph instance

createGraph

public NamedGraph createGraph(String graphNameURI)
Description copied from interface: NamedGraphSet
Creates a new NamedGraph and adds it to the set. An existing graph with the same name will be replaced.

Parameters:
graphNameURI - The name of the NamedGraph to be created; must be an URI
Returns:
The newly created NamedGraph instance

countGraphs

public long countGraphs()
Description copied from interface: NamedGraphSet
Returns the number of NamedGraphs in the set. Empty graphs are counted.

Returns:
The number of NamedGraphs in the set.

listGraphs

public Iterator listGraphs()
Description copied from interface: NamedGraphSet
Returns an iterator over all NamedGraphs in the set.

Returns:
An iterator over all NamedGraphs in the set

asJenaGraph

public Graph asJenaGraph(Node defaultGraphForAdding)
Description copied from interface: NamedGraphSet
Returns the union graph of the NamedGraphSet. The graph is backed by the NamedGraphSet: Subsequent changes to one are reflected in the other.

Add operations to the union graph are all written to the default graph specified as the argument.

Delete operations remove the triple from all NamedGraphs.

Parameters:
defaultGraphForAdding - The name of the default graph used for adding triples; must be an URI
Returns:
A Graph view on the NamedGraphSet

asJenaModel

public NamedGraphModel asJenaModel(String defaultGraphForAdding)
Description copied from interface: NamedGraphSet
Returns a Jena Model view on the NamedGraphSet, equivalent to the union graph of all graphs in the graph set.

Add operations on the returned model are all written to the default graph.

Read and write operations one the returned model have the behaviour of NamedGraphSet.read(String, String) and NamedGraphSet.write(OutputStream, String, String).

All Statements returned by the NamedGraphModel can be casted to NamedGraphStatement to access information about the graphs they are contained in.

Parameters:
defaultGraphForAdding - The name of the default graph used for adding triples; must be an URI
Returns:
A Model view on the NamedGraphSet

clear

public void clear()
Description copied from interface: NamedGraphSet
Deletes all NamedGraphs from the set.


close

public void close()
Description copied from interface: NamedGraphSet
Closes the NamedGraphSet and frees up resources held. Any subsequent calls to methods of the object have undefined results.


isEmpty

public boolean isEmpty()
Description copied from interface: NamedGraphSet
Tells wether the set contains any NamedGraphs.

Returns:
True if the set contains any NamedGraphs, false otherwise