| java.lang.Object com.hp.hpl.jena.graph.impl.GraphBase
All known Subclasses: com.hp.hpl.jena.graph.compose.CompositionBase, com.hp.hpl.jena.mem.GraphMemBase, com.hp.hpl.jena.db.GraphRDB, com.hp.hpl.jena.reasoner.BaseInfGraph,
GraphBase | abstract public class GraphBase implements GraphWithPerform(Code) | | GraphBase is an implementation of Graph that provides some convenient
base functionality for Graph implementations.
Subtypes of GraphBase must provide performAdd(Triple), performDelete(Triple),
graphBaseFind(TripleMatch,TripleAction), and graphBaseSize(). GraphBase
provides default implementations of the other methods, including the other finds
(on top of that one), a simple-minded prepare, and contains. GraphBase also
handles the event-listening and registration interfaces.
When a GraphBase is closed, future operations on it may throw an exception.
author: kers |
Constructor Summary | |
public | GraphBase() Initialise this graph as one with reification style Minimal. | public | GraphBase(ReificationStyle style) Initialise this graph with the given reification style (which will be supplied to
the reifier when it is created). |
Method Summary | |
public void | add(Triple t) Add a triple, and notify the event manager. | protected void | checkOpen() Utility method: throw a ClosedException if this graph has been closed. | public void | close() Close this graph. | protected Reifier | constructReifier() Answer a reifier appropriate to this graph. | final public boolean | contains(Triple t) Answer true iff t is in the graph as revealed by
find(t) being non-empty. | final public boolean | contains(Node s, Node p, Node o) Answer true if this graph contains (s, p, o) ;
this canonical implementation cannot be over-ridden. | final protected boolean | containsByFind(Triple t) Utility method: answer true iff we can find at least one instantiation of
the triple in this graph using find(TripleMatch). | protected GraphStatisticsHandler | createStatisticsHandler() | final public void | delete(Triple t) Delete a triple, and notify the event manager. | public boolean | dependsOn(Graph other) Default implementation answers true iff this graph is the
same graph as the argument graph. | final public ExtendedIterator | find(TripleMatch m) Answer an (extended) iterator over all the triples in this Graph matching
m . | final public ExtendedIterator | find(Node s, Node p, Node o) | public ExtendedIterator | forTestingOnly_graphBaseFind(TripleMatch tm) | public BulkUpdateHandler | getBulkUpdateHandler() Answer a BulkUpdateHandler bound to this graph. | public 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). | public GraphEventManager | getEventManager() Answer the event manager for this graph; allocate a new one if required. | public PrefixMapping | getPrefixMapping() Answer the PrefixMapping object for this graph, the same one each time. | public Reifier | getReifier() Answer this graph's reifier. | public GraphStatisticsHandler | getStatisticsHandler() | public TransactionHandler | getTransactionHandler() Answer a transaction handler bound to this graph. | protected boolean | graphBaseContains(Triple t) Answer true if the graph contains any triple matching t . | abstract protected ExtendedIterator | graphBaseFind(TripleMatch m) Answer an iterator over all the triples held in this graph's non-reified triple store
that match m . | protected ExtendedIterator | graphBaseFind(Node s, Node p, Node o) | protected int | graphBaseSize() Answer the number of triples in this graph. | public boolean | isClosed() | public boolean | isEmpty() Answer true iff this graph contains no triples (hidden reification quads do
not count). | public boolean | isIsomorphicWith(Graph g) Answer true iff this graph is isomorphic to g according to
the algorithm (indeed, method) in GraphMatcher . | public void | notifyAdd(Triple t) Tell the event manager that the triple t has been added to the graph. | public void | notifyDelete(Triple t) Tell the event manager that the triple t has been deleted from the
graph. | public void | performAdd(Triple t) Add a triple to the triple store. | public void | performDelete(Triple t) Remove a triple from the triple store. | public QueryHandler | queryHandler() Answer a QueryHandler bound to this graph. | protected boolean | reifierContains(Triple t) Answer true if the reifier contains a quad matching t . | protected int | reifierSize() Answer the number of visible reification quads. | protected ExtendedIterator | reifierTriples(TripleMatch m) Answer an iterator over all the triples exposed in this graph's reifier that
match m . | final public int | size() Answer the size of this graph (ie the number of exposed triples). | public String | toString() Answer a human-consumable representation of this graph. | public static String | toString(String prefix, Graph that) Answer a human-consumable representation of that . |
bulkHandler | protected BulkUpdateHandler bulkHandler(Code) | | The allocated BulkUpdateHandler, or null if no handler has been allocated yet.
|
capabilities | protected Capabilities capabilities(Code) | | The allocated Capabilities object, or null if unallocated.
|
closed | protected boolean closed(Code) | | Whether or not this graph has been closed - used to report ClosedExceptions
when an operation is attempted on a closed graph.
|
gem | protected GraphEventManager gem(Code) | | The event manager that this Graph uses to, well, manage events; allocated on
demand.
|
queryHandler | protected QueryHandler queryHandler(Code) | | The query handler for this graph, or null if queryHandler() has not been
called yet.
|
reifier | protected Reifier reifier(Code) | | The cache variable for the allocated Reifier.
|
style | final protected ReificationStyle style(Code) | | The reification style of this graph, used when the reifier is created (and
nowhere else, as it happens, which is good).
|
GraphBase | public GraphBase()(Code) | | Initialise this graph as one with reification style Minimal.
|
GraphBase | public GraphBase(ReificationStyle style)(Code) | | Initialise this graph with the given reification style (which will be supplied to
the reifier when it is created).
|
add | public void add(Triple t)(Code) | | 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.
|
checkOpen | protected void checkOpen()(Code) | | Utility method: throw a ClosedException if this graph has been closed.
|
close | public void close()(Code) | | Close this graph. Subgraphs may extend to discard resources.
|
constructReifier | protected Reifier constructReifier()(Code) | | Answer a reifier appropriate to this graph. Subclasses override if
they need non-SimpleReifiers.
|
contains | final public boolean contains(Triple t)(Code) | | 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.
|
contains | final public boolean contains(Node s, Node p, Node o)(Code) | | Answer true if this graph contains (s, p, o) ;
this canonical implementation cannot be over-ridden.
|
containsByFind | final protected boolean containsByFind(Triple t)(Code) | | Utility method: answer true iff we can find at least one instantiation of
the triple in this graph using find(TripleMatch).
Parameters: t - Triple that is the pattern to match true iff find(t) returns at least one result |
delete | final public void delete(Triple t)(Code) | | 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.
|
dependsOn | public boolean dependsOn(Graph other)(Code) | | Default implementation answers true iff this graph is the
same graph as the argument graph.
|
find | final public ExtendedIterator find(TripleMatch m)(Code) | | 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).
|
getBulkUpdateHandler | public BulkUpdateHandler getBulkUpdateHandler()(Code) | | 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.
|
getCapabilities | public Capabilities getCapabilities()(Code) | | 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).
|
getEventManager | public GraphEventManager getEventManager()(Code) | | 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.
|
getPrefixMapping | public PrefixMapping getPrefixMapping()(Code) | | Answer the PrefixMapping object for this graph, the same one each time.
Subclasses are unlikely to want to modify this.
|
getReifier | public Reifier getReifier()(Code) | | 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.
|
getTransactionHandler | public TransactionHandler getTransactionHandler()(Code) | | Answer a transaction handler bound to this graph. The default is
SimpleTransactionHandler, which handles no transactions.
|
graphBaseContains | protected boolean graphBaseContains(Triple t)(Code) | | Answer true if the graph contains any triple matching t .
The default implementation uses find and checks to see
if the iterator is non-empty.
|
graphBaseFind | abstract protected ExtendedIterator graphBaseFind(TripleMatch m)(Code) | | Answer an iterator over all the triples held in this graph's non-reified triple store
that match m . Subclasses must override; it is the core
implementation for find(TripleMatch) .
|
graphBaseSize | protected int graphBaseSize()(Code) | | Answer the number of triples in this graph. Default implementation counts its
way through the results of a findAll. Subclasses must override if they want
size() to be efficient.
|
isClosed | public boolean isClosed()(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | 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.
|
isIsomorphicWith | public boolean isIsomorphicWith(Graph g)(Code) | | Answer true iff this graph is isomorphic to g according to
the algorithm (indeed, method) in GraphMatcher .
|
notifyAdd | public void notifyAdd(Triple t)(Code) | | Tell the event manager that the triple t has been added to the graph.
|
notifyDelete | public void notifyDelete(Triple t)(Code) | | Tell the event manager that the triple t has been deleted from the
graph.
|
performAdd | public void performAdd(Triple t)(Code) | | 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.
|
performDelete | public void performDelete(Triple t)(Code) | | 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.
|
queryHandler | public QueryHandler queryHandler()(Code) | | 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.
|
reifierContains | protected boolean reifierContains(Triple t)(Code) | | Answer true if the reifier contains a quad matching t . The
default implementation uses the reifier's findExposed method.
Subclasses probably don't need to override (if they're interested, they
probably have specialised reifiers).
|
reifierSize | protected int reifierSize()(Code) | | Answer the number of visible reification quads. Subclasses will not normally
need to override this, since it just invokes the reifier's size() method, and
they can implement their own reifier.
|
reifierTriples | protected ExtendedIterator reifierTriples(TripleMatch m)(Code) | | Answer an iterator over all the triples exposed in this graph's reifier that
match m . The default implementation delegates this to
the reifier; subclasses probably don't need to override this.
|
size | final public int size()(Code) | | 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).
|
toString | public String toString()(Code) | | Answer a human-consumable representation of this graph. Not advised for
big graphs, as it generates a big string: intended for debugging purposes.
|
toString | public static String toString(String prefix, Graph that)(Code) | | Answer a human-consumable representation of that . The
string prefix will appear near the beginning of the string. Nodes
may be prefix-compressed using that 's prefix-mapping. This
default implementation will display all the triples exposed by the graph (ie
including reification triples if it is Standard).
|
|
|