org.openanzo.model.replica
Class ReplicaGraph

java.lang.Object
  extended by org.openanzo.model.proxy.ProxyGraph
      extended by org.openanzo.model.proxy.NamedGraphProxy
          extended by org.openanzo.model.replica.ReplicaGraph
All Implemented Interfaces:
INamedGraph, IProxyGraph

public class ReplicaGraph
extends NamedGraphProxy

The purpose of this class is to provide a graph wrapper that caches all queries into the base graph until the reset() method is called. An example is when two clients of a graph want to work "disconnected" from the parent graph (i.e. an editor that displays a form with values and does not want those to keep changing as the underlying graph changes).

Author:
Elias Torres (eliast@us.ibm.com )

Constructor Summary
ReplicaGraph(INamedGraph base)
          Create new ReplicaGraph wrapper around a base graph
 
Method Summary
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> find(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj)
          Return an iterator of all statements that match the pattern of subj,prop,obj
 INamedGraph getParentGraph()
          Get the graph to which this proxy is proxing information.
 ReplicaEventManager getReplicaEventManager()
          Get the replicaEvent manager for the graph
 void reset()
          This method will empty the cache and the matches history.
 
Methods inherited from class org.openanzo.model.proxy.NamedGraphProxy
getNamedGraphUri, getTransactionManager, isClosed, isMetadataGraph, setNamedGraphUri, toString
 
Methods inherited from class org.openanzo.model.proxy.ProxyGraph
add, add, add, clear, close, contains, contains, delete, delete, delete, getEventManager, getStatements, isEmpty, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReplicaGraph

public ReplicaGraph(INamedGraph base)
Create new ReplicaGraph wrapper around a base graph

Parameters:
base - graph to wrap
Method Detail

getParentGraph

public INamedGraph getParentGraph()
Description copied from interface: IProxyGraph
Get the graph to which this proxy is proxing information.

Specified by:
getParentGraph in interface IProxyGraph
Overrides:
getParentGraph in class NamedGraphProxy
Returns:
parent graph to which this proxy is proxing information

find

public info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> find(org.openrdf.model.Resource subj,
                                                                                            org.openrdf.model.URI prop,
                                                                                            org.openrdf.model.Value obj)
Description copied from interface: INamedGraph
Return an iterator of all statements that match the pattern of subj,prop,obj

Specified by:
find in interface INamedGraph
Overrides:
find in class ProxyGraph
Parameters:
subj - Subject resource to match, or wildcard if null
prop - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
Returns:
an iterator of all statements that match the pattern of subj,prop,obj

reset

public void reset()
This method will empty the cache and the matches history. Any new find requests will go straight through the parent and cache those new results.


getReplicaEventManager

public ReplicaEventManager getReplicaEventManager()
Get the replicaEvent manager for the graph

Returns:
the replicaEvent manager for the graph


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.