com.hp.hpl.jena.sparql.graph
Class GraphBase2

java.lang.Object
  extended by com.hp.hpl.jena.sparql.graph.GraphBase2
All Implemented Interfaces:
com.hp.hpl.jena.graph.Graph, com.hp.hpl.jena.graph.GraphAdd, com.hp.hpl.jena.graph.impl.GraphWithPerform
Direct Known Subclasses:
GraphMemSimple2

public abstract class GraphBase2
extends Object
implements com.hp.hpl.jena.graph.impl.GraphWithPerform


Field Summary
 
Fields inherited from interface com.hp.hpl.jena.graph.Graph
emptyGraph
 
Constructor Summary
GraphBase2()
          Initialise this graph
 
Method Summary
 void add(com.hp.hpl.jena.graph.Triple t)
          Add a triple, and notify the event manager.
 void close()
          Close this graph.
 boolean contains(com.hp.hpl.jena.graph.Node s, com.hp.hpl.jena.graph.Node p, com.hp.hpl.jena.graph.Node o)
          Answer true if this graph contains (s, p, o); this canonical implementation cannot be over-ridden.
 boolean contains(com.hp.hpl.jena.graph.Triple t)
          Answer true iff t is in the graph as revealed by find(t) being non-empty.
 void delete(com.hp.hpl.jena.graph.Triple t)
          Delete a triple, and notify the event manager.
 boolean dependsOn(com.hp.hpl.jena.graph.Graph other)
          Default implementation answers true iff this graph is the same graph as the argument graph.
 com.hp.hpl.jena.util.iterator.ExtendedIterator<com.hp.hpl.jena.graph.Triple> 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<com.hp.hpl.jena.graph.Triple> find(com.hp.hpl.jena.graph.TripleMatch m)
          Answer an (extended) iterator over all the triples in this Graph matching m.
 com.hp.hpl.jena.util.iterator.ExtendedIterator<com.hp.hpl.jena.graph.Triple> forTestingOnly_graphBaseFind(com.hp.hpl.jena.graph.TripleMatch tm)
           
 com.hp.hpl.jena.graph.BulkUpdateHandler getBulkUpdateHandler()
          Answer a BulkUpdateHandler bound to this graph.
 com.hp.hpl.jena.graph.Capabilities getCapabilities()
          Answer the capabilities of this graph; the default is an AllCapabilities object (the same one each time, not that it matters - Capabilities should be immutable).
 com.hp.hpl.jena.graph.GraphEventManager getEventManager()
          Answer the event manager for this graph; allocate a new one if required.
 com.hp.hpl.jena.shared.PrefixMapping getPrefixMapping()
          Answer the PrefixMapping object for this graph, the same one each time.
 com.hp.hpl.jena.graph.Reifier getReifier()
          Answer this graph's reifier.
 com.hp.hpl.jena.graph.GraphStatisticsHandler getStatisticsHandler()
           
 com.hp.hpl.jena.graph.TransactionHandler getTransactionHandler()
          Answer a transaction handler bound to this graph.
 boolean isClosed()
           
 boolean isEmpty()
          Answer true iff this graph contains no triples (hidden reification quads do not count).
 boolean isIsomorphicWith(com.hp.hpl.jena.graph.Graph g)
          Answer true iff this graph is isomorphic to g according to the algorithm (indeed, method) in GraphMatcher.
 void notifyAdd(com.hp.hpl.jena.graph.Triple t)
          Tell the event manager that the triple t has been added to the graph.
 void notifyDelete(com.hp.hpl.jena.graph.Triple t)
          Tell the event manager that the triple t has been deleted from the graph.
 void performAdd(com.hp.hpl.jena.graph.Triple t)
          Add a triple to the triple store.
 void performDelete(com.hp.hpl.jena.graph.Triple t)
          Remove a triple from the triple store.
abstract  com.hp.hpl.jena.graph.query.QueryHandler queryHandler()
          Answer a QueryHandler bound to this graph.
 int size()
          Answer the size of this graph (ie the number of exposed triples).
 String toString()
          Answer a human-consumable representation of this graph.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphBase2

public GraphBase2()
Initialise this graph

Method Detail

close

public void close()
Close this graph. Subgraphs may extend to discard resources.

Specified by:
close in interface com.hp.hpl.jena.graph.Graph

isClosed

public boolean isClosed()
Specified by:
isClosed in interface com.hp.hpl.jena.graph.Graph

dependsOn

public boolean dependsOn(com.hp.hpl.jena.graph.Graph other)
Default implementation answers true iff this graph is the same graph as the argument graph.

Specified by:
dependsOn in interface com.hp.hpl.jena.graph.Graph

queryHandler

public abstract com.hp.hpl.jena.graph.query.QueryHandler queryHandler()
Answer a QueryHandler bound to this graph. The default implementation returns the same SimpleQueryHandler each time it is called; sub-classes may override if they need specialised query handlers.

Specified by:
queryHandler in interface com.hp.hpl.jena.graph.Graph

getStatisticsHandler

public com.hp.hpl.jena.graph.GraphStatisticsHandler getStatisticsHandler()
Specified by:
getStatisticsHandler in interface com.hp.hpl.jena.graph.Graph

getEventManager

public com.hp.hpl.jena.graph.GraphEventManager getEventManager()
Answer the event manager for this graph; allocate a new one if required. Subclasses may override if they have a more specialised event handler. The default is a SimpleEventManager.

Specified by:
getEventManager in interface com.hp.hpl.jena.graph.Graph

notifyAdd

public void notifyAdd(com.hp.hpl.jena.graph.Triple t)
Tell the event manager that the triple t has been added to the graph.


notifyDelete

public void notifyDelete(com.hp.hpl.jena.graph.Triple t)
Tell the event manager that the triple t has been deleted from the graph.


getTransactionHandler

public com.hp.hpl.jena.graph.TransactionHandler getTransactionHandler()
Answer a transaction handler bound to this graph. The default is SimpleTransactionHandler, which handles no transactions.

Specified by:
getTransactionHandler in interface com.hp.hpl.jena.graph.Graph

getBulkUpdateHandler

public com.hp.hpl.jena.graph.BulkUpdateHandler getBulkUpdateHandler()
Answer a BulkUpdateHandler bound to this graph. The default is a SimpleBulkUpdateHandler, which does bulk update by repeated simple (add/delete) updates; the same handler is returned on each call. Subclasses may override if they have specialised implementations.

Specified by:
getBulkUpdateHandler in interface com.hp.hpl.jena.graph.Graph

getCapabilities

public com.hp.hpl.jena.graph.Capabilities getCapabilities()
Answer the capabilities of this graph; the default is an AllCapabilities object (the same one each time, not that it matters - Capabilities should be immutable).

Specified by:
getCapabilities in interface com.hp.hpl.jena.graph.Graph

getPrefixMapping

public com.hp.hpl.jena.shared.PrefixMapping getPrefixMapping()
Answer the PrefixMapping object for this graph, the same one each time. Subclasses are unlikely to want to modify this.

Specified by:
getPrefixMapping in interface com.hp.hpl.jena.graph.Graph

add

public void add(com.hp.hpl.jena.graph.Triple t)
Add a triple, and notify the event manager. Subclasses should not need to override this - we might make it final. The triple is added using performAdd, and notification done by notifyAdd.

Specified by:
add in interface com.hp.hpl.jena.graph.GraphAdd

performAdd

public void performAdd(com.hp.hpl.jena.graph.Triple t)
Add a triple to the triple store. The default implementation throws an AddDeniedException; subclasses must override if they want to be able to add triples.

Specified by:
performAdd in interface com.hp.hpl.jena.graph.impl.GraphWithPerform

delete

public final void delete(com.hp.hpl.jena.graph.Triple t)
Delete a triple, and notify the event manager. Subclasses should not need to override this - we might make it final. The triple is added using performDelete, and notification done by notifyDelete.

Specified by:
delete in interface com.hp.hpl.jena.graph.Graph

performDelete

public void performDelete(com.hp.hpl.jena.graph.Triple t)
Remove a triple from the triple store. The default implementation throws a DeleteDeniedException; subclasses must override if they want to be able to remove triples.

Specified by:
performDelete in interface com.hp.hpl.jena.graph.impl.GraphWithPerform

find

public final com.hp.hpl.jena.util.iterator.ExtendedIterator<com.hp.hpl.jena.graph.Triple> find(com.hp.hpl.jena.graph.TripleMatch m)
Answer an (extended) iterator over all the triples in this Graph matching m. Subclasses cannot over-ride this, because it implements the appending of reification quadlets; instead they must implement graphBaseFind(TripleMatch).

Specified by:
find in interface com.hp.hpl.jena.graph.Graph

forTestingOnly_graphBaseFind

public com.hp.hpl.jena.util.iterator.ExtendedIterator<com.hp.hpl.jena.graph.Triple> forTestingOnly_graphBaseFind(com.hp.hpl.jena.graph.TripleMatch tm)

find

public final com.hp.hpl.jena.util.iterator.ExtendedIterator<com.hp.hpl.jena.graph.Triple> 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

contains

public final boolean contains(com.hp.hpl.jena.graph.Triple t)
Answer true iff t is in the graph as revealed by find(t) being non-empty. t may contain ANY wildcards. Sub-classes may over-ride reifierContains and graphBaseContains for efficiency.

Specified by:
contains in interface com.hp.hpl.jena.graph.Graph

contains

public final boolean contains(com.hp.hpl.jena.graph.Node s,
                              com.hp.hpl.jena.graph.Node p,
                              com.hp.hpl.jena.graph.Node o)
Answer true if this graph contains (s, p, o); this canonical implementation cannot be over-ridden.

Specified by:
contains in interface com.hp.hpl.jena.graph.Graph

getReifier

public com.hp.hpl.jena.graph.Reifier getReifier()
Answer this graph's reifier. The reifier may be lazily constructed, and it must be the same reifier on each call. The default implementation is a SimpleReifier. Generally DO NOT override this method: override constructReifier instead.

Specified by:
getReifier in interface com.hp.hpl.jena.graph.Graph

size

public final int size()
Answer the size of this graph (ie the number of exposed triples). Defined as the size of the triple store plus the size of the reification store. Subclasses must override graphBaseSize() to reimplement (and reifierSize if they have some special reason for redefined that).

Specified by:
size in interface com.hp.hpl.jena.graph.Graph

isEmpty

public boolean isEmpty()
Answer true iff this graph contains no triples (hidden reification quads do not count). The default implementation is size() == 0, which is fine if size is reasonable efficient. Subclasses may override if necessary. This method may become final and defined in terms of other methods.

Specified by:
isEmpty in interface com.hp.hpl.jena.graph.Graph

isIsomorphicWith

public boolean isIsomorphicWith(com.hp.hpl.jena.graph.Graph g)
Answer true iff this graph is isomorphic to g according to the algorithm (indeed, method) in GraphMatcher.

Specified by:
isIsomorphicWith in interface com.hp.hpl.jena.graph.Graph

toString

public String toString()
Answer a human-consumable representation of this graph. Not advised for big graphs, as it generates a big string: intended for debugging purposes.

Overrides:
toString in class Object


Licenced under the Apache License, Version 2.0