com.hp.hpl.jena.graph.compose
Class Polyadic

java.lang.Object
  extended by com.hp.hpl.jena.graph.impl.GraphBase
      extended by com.hp.hpl.jena.graph.compose.CompositionBase
          extended by com.hp.hpl.jena.graph.compose.Polyadic
All Implemented Interfaces:
Graph, GraphAdd, com.hp.hpl.jena.graph.impl.GraphWithPerform
Direct Known Subclasses:
MultiUnion

public abstract class Polyadic
extends CompositionBase

A base class for composition graphs that are composed from zero or more sub-graphs (thus providing a basis for polyadic composition operators). A distinguished graph is the designated graph for additions to the union. By default, this is the first sub-graph of the composition, however any of the graphs in the composition can be nominated to be the distinguished graph.

Version:
CVS $Id: Polyadic.java,v 1.2 2009/08/08 11:25:31 andy_seaborne Exp $
Author:
Ian Dickinson, HP Labs (email)

Field Summary
 
Fields inherited from class com.hp.hpl.jena.graph.impl.GraphBase
TOSTRING_TRIPLE_BASE, TOSTRING_TRIPLE_LIMIT
 
Fields inherited from interface com.hp.hpl.jena.graph.Graph
emptyGraph
 
Constructor Summary
Polyadic()
           Construct a composition of exactly no sub graphs.
Polyadic(Graph[] graphs)
           Construct a composition of all of the given graphs
Polyadic(java.util.Iterator<Graph> graphs)
           Construct a composition of all of the given graphs.
 
Method Summary
 void addGraph(Graph graph)
           Add the given graph to this composition.
 void close()
           Close the graph by closing all of the sub-graphs.
 boolean dependsOn(Graph graph)
           Answer true if this graph contains the given graph as a sub-component.
 Graph getBaseGraph()
           Answer the distinguished graph for the composition, which will be the graph that receives triple adds and deletes.
 BulkUpdateHandler getBulkUpdateHandler()
          returns this Graph's bulk-update handler
 Capabilities getCapabilities()
          returns this Graph's capabilities
 PrefixMapping getPrefixMapping()
          returns this Graph's prefix mapping.
 Graph getRequiredBaseGraph()
           Answer the distinguished graph for the composition, which will be the graph that receives triple adds and deletes.
 java.util.List<Graph> getSubGraphs()
           Answer a list of the graphs other than the updateable (base) graph
 TransactionHandler getTransactionHandler()
          returns this Graph's transaction handler
 void removeGraph(Graph graph)
           Remove the given graph from this composition.
 void setBaseGraph(Graph graph)
           Set the designated updateable graph for this composition.
 
Methods inherited from class com.hp.hpl.jena.graph.compose.CompositionBase
butNot, ifIn, ifIn, recording, reject, rejecting, rejecting
 
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase
add, contains, contains, delete, find, find, forTestingOnly_graphBaseFind, getEventManager, getReifier, getStatisticsHandler, isClosed, isEmpty, isIsomorphicWith, notifyAdd, notifyDelete, performAdd, performDelete, queryHandler, size, toString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Polyadic

public Polyadic()

Construct a composition of exactly no sub graphs.


Polyadic

public Polyadic(Graph[] graphs)

Construct a composition of all of the given graphs

Parameters:
graphs - An array of the sub-graphs of this composition

Polyadic

public Polyadic(java.util.Iterator<Graph> graphs)

Construct a composition of all of the given graphs.

Parameters:
graphs - An iterator of the sub-graphs of this composition. If graphs is a closable iterator, it will be automatically closed.
Method Detail

getPrefixMapping

public PrefixMapping getPrefixMapping()
Description copied from interface: Graph
returns this Graph's prefix mapping. Each call on a given Graph gets the same PrefixMapping object, which is the one used by the Graph.

Specified by:
getPrefixMapping in interface Graph
Overrides:
getPrefixMapping in class com.hp.hpl.jena.graph.impl.GraphBase

close

public void close()

Close the graph by closing all of the sub-graphs.

Specified by:
close in interface Graph
Overrides:
close in class com.hp.hpl.jena.graph.impl.GraphBase
See Also:
Graph.close()

dependsOn

public boolean dependsOn(Graph graph)

Answer true if this graph contains the given graph as a sub-component.

Specified by:
dependsOn in interface Graph
Overrides:
dependsOn in class com.hp.hpl.jena.graph.impl.GraphBase
Parameters:
graph - A graph to test
Returns:
True if the graph is this graph, or is a sub-graph of this one.
See Also:
Graph.dependsOn(Graph)

addGraph

public void addGraph(Graph graph)

Add the given graph to this composition.

Parameters:
graph - A sub-graph to add to this composition

removeGraph

public void removeGraph(Graph graph)

Remove the given graph from this composition. If the removed graph is the designated updateable graph, the updatable graph goes back to the default for this composition.

Parameters:
graph - A sub-graph to remove from this composition

getBaseGraph

public Graph getBaseGraph()

Answer the distinguished graph for the composition, which will be the graph that receives triple adds and deletes. If no base graph is defined, return null.

Returns:
The distinguished updateable graph, or null if there are no graphs in this composition

getRequiredBaseGraph

public Graph getRequiredBaseGraph()

Answer the distinguished graph for the composition, which will be the graph that receives triple adds and deletes. If no base graph is defined, throw a JenaException.

Returns:
The distinguished updateable graph, or null if there are no graphs in this composition

setBaseGraph

public void setBaseGraph(Graph graph)

Set the designated updateable graph for this composition.

Parameters:
graph - One of the graphs currently in this composition to be the designated graph to receive udpates
Throws:
java.lang.IllegalArgumentException - if graph is not one of the members of the composition

getSubGraphs

public java.util.List<Graph> getSubGraphs()

Answer a list of the graphs other than the updateable (base) graph

Returns:
A list of all of the sub-graphs, excluding the base graph.

getBulkUpdateHandler

public BulkUpdateHandler getBulkUpdateHandler()
Description copied from interface: Graph
returns this Graph's bulk-update handler

Specified by:
getBulkUpdateHandler in interface Graph
Overrides:
getBulkUpdateHandler in class com.hp.hpl.jena.graph.impl.GraphBase

getTransactionHandler

public TransactionHandler getTransactionHandler()
Description copied from interface: Graph
returns this Graph's transaction handler

Specified by:
getTransactionHandler in interface Graph
Overrides:
getTransactionHandler in class com.hp.hpl.jena.graph.impl.GraphBase

getCapabilities

public Capabilities getCapabilities()
Description copied from interface: Graph
returns this Graph's capabilities

Specified by:
getCapabilities in interface Graph
Overrides:
getCapabilities in class com.hp.hpl.jena.graph.impl.GraphBase


Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP