org.topbraid.core.graph
Class CachingGraph

java.lang.Object
  extended by org.topbraid.core.graph.DelegatingGraph
      extended by org.topbraid.core.graph.CachingGraph
All Implemented Interfaces:
com.hp.hpl.jena.graph.Graph, com.hp.hpl.jena.graph.GraphAdd, BatchOperationGraph

public class CachingGraph
extends DelegatingGraph

A DelegatingGraph with additional caching services optimized for typical query patterns in TopBraid Composer. The performance is best if the graph is initialized by calling generic predicate queries such as (null, rdfs:subClassOf, null).

Author:
Holger Knublauch

Field Summary
static java.lang.String CACHED_PROPERTIES
           
static java.lang.String DEFAULT_CACHED_PROPERTIES
           
 
Fields inherited from interface com.hp.hpl.jena.graph.Graph
emptyGraph
 
Constructor Summary
CachingGraph(com.hp.hpl.jena.graph.Graph delegate)
           
 
Method Summary
 void add(java.util.Collection<com.hp.hpl.jena.graph.Triple> triples)
          Adds multiple Triples at the same time.
 void add(com.hp.hpl.jena.graph.Triple t)
           
 void clearCache()
          Completely clears any existing caches.
 boolean contains(com.hp.hpl.jena.graph.Node s, com.hp.hpl.jena.graph.Node p, com.hp.hpl.jena.graph.Node o)
           
 boolean contains(com.hp.hpl.jena.graph.Triple m)
           
 void delete(java.util.Collection<com.hp.hpl.jena.graph.Triple> triples)
          Deletes multiple Triples at the same time.
 void delete(com.hp.hpl.jena.graph.Triple t)
           
 com.hp.hpl.jena.util.iterator.ExtendedIterator find(com.hp.hpl.jena.graph.Node s, com.hp.hpl.jena.graph.Node p, com.hp.hpl.jena.graph.Node o)
           
 com.hp.hpl.jena.util.iterator.ExtendedIterator find(com.hp.hpl.jena.graph.TripleMatch m)
           
static java.util.List<com.hp.hpl.jena.graph.Node> getCachedPropertyNodes(com.hp.hpl.jena.graph.Graph graph)
           
protected  com.hp.hpl.jena.mem.faster.GraphMemFaster getPredicateGraph(com.hp.hpl.jena.graph.Node predicate)
           
 void rebuildCache(org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  void tripleAdded(com.hp.hpl.jena.graph.Triple t)
           
protected  void tripleDeleted(com.hp.hpl.jena.graph.Triple t)
           
 
Methods inherited from class org.topbraid.core.graph.DelegatingGraph
close, dependsOn, getBulkUpdateHandler, getCapabilities, getDelegate, getEventManager, getPrefixMapping, getReifier, getStatisticsHandler, getTerminalDelegate, getTransactionHandler, isClosed, isEmpty, isIsomorphicWith, notifyAdd, notifyDelete, queryHandler, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CACHED_PROPERTIES

public static final java.lang.String DEFAULT_CACHED_PROPERTIES
See Also:
Constant Field Values

CACHED_PROPERTIES

public static final java.lang.String CACHED_PROPERTIES
See Also:
Constant Field Values
Constructor Detail

CachingGraph

public CachingGraph(com.hp.hpl.jena.graph.Graph delegate)
Method Detail

add

public void add(com.hp.hpl.jena.graph.Triple t)
         throws com.hp.hpl.jena.shared.AddDeniedException
Specified by:
add in interface com.hp.hpl.jena.graph.GraphAdd
Overrides:
add in class DelegatingGraph
Throws:
com.hp.hpl.jena.shared.AddDeniedException

add

public void add(java.util.Collection<com.hp.hpl.jena.graph.Triple> triples)
Description copied from interface: BatchOperationGraph
Adds multiple Triples at the same time.

Specified by:
add in interface BatchOperationGraph
Overrides:
add in class DelegatingGraph
Parameters:
triples - the Triples to add

contains

public boolean contains(com.hp.hpl.jena.graph.Triple m)
Specified by:
contains in interface com.hp.hpl.jena.graph.Graph
Overrides:
contains in class DelegatingGraph

contains

public boolean contains(com.hp.hpl.jena.graph.Node s,
                        com.hp.hpl.jena.graph.Node p,
                        com.hp.hpl.jena.graph.Node o)
Specified by:
contains in interface com.hp.hpl.jena.graph.Graph
Overrides:
contains in class DelegatingGraph

clearCache

public final void clearCache()
Completely clears any existing caches.


delete

public void delete(com.hp.hpl.jena.graph.Triple t)
            throws com.hp.hpl.jena.shared.DeleteDeniedException
Specified by:
delete in interface com.hp.hpl.jena.graph.Graph
Overrides:
delete in class DelegatingGraph
Throws:
com.hp.hpl.jena.shared.DeleteDeniedException

delete

public void delete(java.util.Collection<com.hp.hpl.jena.graph.Triple> triples)
Description copied from interface: BatchOperationGraph
Deletes multiple Triples at the same time.

Specified by:
delete in interface BatchOperationGraph
Overrides:
delete in class DelegatingGraph
Parameters:
triples - the Triples to delete

find

public com.hp.hpl.jena.util.iterator.ExtendedIterator find(com.hp.hpl.jena.graph.Node s,
                                                           com.hp.hpl.jena.graph.Node p,
                                                           com.hp.hpl.jena.graph.Node o)
Specified by:
find in interface com.hp.hpl.jena.graph.Graph
Overrides:
find in class DelegatingGraph

find

public final com.hp.hpl.jena.util.iterator.ExtendedIterator find(com.hp.hpl.jena.graph.TripleMatch m)
Specified by:
find in interface com.hp.hpl.jena.graph.Graph
Overrides:
find in class DelegatingGraph

getCachedPropertyNodes

public static java.util.List<com.hp.hpl.jena.graph.Node> getCachedPropertyNodes(com.hp.hpl.jena.graph.Graph graph)

getPredicateGraph

protected final com.hp.hpl.jena.mem.faster.GraphMemFaster getPredicateGraph(com.hp.hpl.jena.graph.Node predicate)

rebuildCache

public void rebuildCache(org.eclipse.core.runtime.IProgressMonitor monitor)

tripleAdded

protected final void tripleAdded(com.hp.hpl.jena.graph.Triple t)

tripleDeleted

protected final void tripleDeleted(com.hp.hpl.jena.graph.Triple t)