com.franz.agjena
Class AllegroGraphGraphMaker

java.lang.Object
  extended by BaseGraphMaker
      extended by com.franz.agjena.AllegroGraphGraphMaker

public class AllegroGraphGraphMaker
extends BaseGraphMaker

A factory for providing instances of named graphs backed by an AllegroGraph quad store. Names can be "arbitrary" character sequences.

AllegroGraphGraphMaker represents a minimal reification style, since reification doesn't make sense anymore.

In order to benefit from the native capabilities of the AllegroGraph server an application must use the constructors and factory methods in the AllegroGraph classes that correspond to the general constructors and methods in Jena.


Constructor Summary
AllegroGraphGraphMaker(AllegroGraph agStore)
          Constructor
 
Method Summary
 void close()
          Close the factory - no more requests need be honoured, and any clean-up can be done.
 Graph createGraph(java.lang.String name, boolean strict)
          Create a new graph associated with the given name.
 Graph getDefaultGraph()
          Return the default graph for this maker.
 Graph getGraph()
          Answer the default graph for this maker.
 java.util.List<java.lang.String> getGraphURIs()
          Retrieve the URIs of all graphs in the store, i.e., of all resources in context position.
static AllegroGraphGraphMaker getInstance()
          Return the default maker, already initialized with an AllegroGraph store.
 Node getMakerClass()
          Answer the Class node for this GraphMaker's description.
 boolean hasGraph(java.lang.String name)
          return true iff the factory has a graph with the given name
 ExtendedIterator listGraphs()
          Answer an [extended] iterator where each element is the name of a graph in the maker, and the complete sequence exhausts the set of names.
 Graph openGraph()
           
 Graph openGraph(java.lang.String name, boolean strict)
          Find an existing graph that this factory knows about under the given name.
 void removeGraph(java.lang.String name)
          Remove the association between the name and the graph.
 void setDefaultIsGraphOfAllGraphs(boolean setting)
          Sets the default graph to represent either the Graph-of-all-graphs, or just the triples asserted when no graph is specified.
static void setDefaultMaker(AllegroGraph agStore)
          Convenience method for testing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AllegroGraphGraphMaker

public AllegroGraphGraphMaker(AllegroGraph agStore)
Constructor

Method Detail

setDefaultMaker

public static void setDefaultMaker(AllegroGraph agStore)
Convenience method for testing. Create a factory instance of AllegroGraphGraphMaker that saves the value of 'agStore'. Calling 'getInstance' returns this instance. This avoids having to pass 'agStore' down the stack to whever a call to the AllegroGraphGraphMaker constructor might be needed.


getInstance

public static AllegroGraphGraphMaker getInstance()
Return the default maker, already initialized with an AllegroGraph store.


setDefaultIsGraphOfAllGraphs

public void setDefaultIsGraphOfAllGraphs(boolean setting)
Sets the default graph to represent either the Graph-of-all-graphs, or just the triples asserted when no graph is specified. This exists because of a major oversight by the SPARQL committee, which omitted a practical means for querying across the set of all graphs.


createGraph

public Graph createGraph(java.lang.String name,
                         boolean strict)
Create a new graph associated with the given name. If there is no such association, create one and return it. If one exists but strict is false, return the associated graph. Otherwise throw an AlreadyExistsException.

Parameters:
name - the name to give to the new graph
strict - true to cause existing bindings to throw an exception
Throws:
AlreadyExistsException - if that name is already bound.

openGraph

public Graph openGraph(java.lang.String name,
                       boolean strict)
Find an existing graph that this factory knows about under the given name. If such a graph exists, return it. Otherwise, if strict is false, create a new graph, associate it with the name, and return it. Otherwise throw a DoesNotExistException.

Parameters:
name - the name of the graph to find and return
strict - false to create a new one if one doesn't already exist
Throws:
DoesNotExistException - if there's no such named graph

removeGraph

public void removeGraph(java.lang.String name)
Remove the association between the name and the graph. create will now be able to create a graph with that name, and open will no longer be able to find it. Throws an exception if there's no such graph. The graph itself is not touched.

Parameters:
name - the name to disassociate
Throws:
DoesNotExistException - if the name is unbound

hasGraph

public boolean hasGraph(java.lang.String name)
return true iff the factory has a graph with the given name

Parameters:
name - the name of the graph to look for
Returns:
true iff there's a graph with that name

getMakerClass

public Node getMakerClass()
Answer the Class node for this GraphMaker's description.

Returns:
a URI node which is some RDFS subclass of MakerSpec

close

public void close()
Close the factory - no more requests need be honoured, and any clean-up can be done.


getGraphURIs

public java.util.List<java.lang.String> getGraphURIs()
Retrieve the URIs of all graphs in the store, i.e., of all resources in context position.


listGraphs

public ExtendedIterator listGraphs()
Answer an [extended] iterator where each element is the name of a graph in the maker, and the complete sequence exhausts the set of names. No particular order is expected from the list.

Returns:
an extended iterator over the names of graphs known to this Maker.

getGraph

public Graph getGraph()
Answer the default graph for this maker. If we haven't already made it, make it now. Overrides the logic in 'BaseGraphMaker' which returns a default graph with an anonymous name (what a dumb idea!).


openGraph

public Graph openGraph()

getDefaultGraph

public Graph getDefaultGraph()
Return the default graph for this maker. Same as 'getGraph', but 'getGraph' applied to a model has a completely different meaning; confusing for users. This call avoids the confusion.