public abstract class GraphBase extends Object implements GraphWithPerform
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.
Modifier and Type | Field and Description |
---|---|
static int |
TOSTRING_TRIPLE_BASE
toString will not cut off up to this number of triples.
|
static int |
TOSTRING_TRIPLE_LIMIT
toString will not output more than this number of triples.
|
emptyGraph
Constructor and Description |
---|
GraphBase()
Initialise this graph as one with reification style Minimal.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Triple t)
Add a triple, and notify the event manager.
|
void |
clear()
Remove all the statements from this graph.
|
void |
close()
Close this graph.
|
boolean |
contains(Node s,
Node p,
Node o)
Answer
true if this graph contains (s, p, o) ;
this canonical implementation cannot be over-ridden. |
boolean |
contains(Triple t)
Answer
true iff t is in the graph as revealed by
find(t) being non-empty. |
void |
delete(Triple t)
Delete a triple, and notify the event manager.
|
boolean |
dependsOn(Graph other)
Default implementation answers
true iff this graph is the
same graph as the argument graph. |
ExtendedIterator<Triple> |
find(Node s,
Node p,
Node o)
Returns an iterator over Triples matching a pattern.
|
ExtendedIterator<Triple> |
find(Triple m)
Returns an iterator over all the Triples that match the triple pattern.
|
ExtendedIterator<Triple> |
forTestingOnly_graphBaseFind(Triple t) |
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).
|
GraphEventManager |
getEventManager()
Answer the event manager for this graph; allocate a new one if required.
|
PrefixMapping |
getPrefixMapping()
Answer the PrefixMapping object for this graph, the same one each time.
|
GraphStatisticsHandler |
getStatisticsHandler()
Deprecated.
|
TransactionHandler |
getTransactionHandler()
Answer a transaction handler bound to this graph.
|
boolean |
isClosed()
Answer true iff .close() has been called on this Graph.
|
boolean |
isEmpty()
Answer true iff this graph contains no triples (hidden reification quads do
not count).
|
boolean |
isIsomorphicWith(Graph g)
Answer true iff this graph is isomorphic to
g according to
the algorithm (indeed, method) in GraphMatcher . |
void |
notifyAdd(Triple t)
Tell the event manager that the triple
t has been added to the graph. |
void |
notifyDelete(Triple t)
Tell the event manager that the triple
t has been deleted from the
graph. |
void |
performAdd(Triple t)
Add a triple to the triple store.
|
void |
performDelete(Triple t)
Remove a triple from the triple store.
|
void |
remove(Node s,
Node p,
Node o)
Remove all triples that match by find(s, p, o)
|
int |
size()
Answer the size of this graph (ie the number of exposed triples).
|
String |
toString()
Answer a human-consumable representation of this graph.
|
static String |
toString(String prefix,
Graph that)
Answer a human-consumable representation of
that . |
public static final int TOSTRING_TRIPLE_BASE
public static final int TOSTRING_TRIPLE_LIMIT
public GraphBase()
public void close()
public boolean isClosed()
Graph
public boolean dependsOn(Graph other)
true
iff this graph is the
same graph as the argument graph.@Deprecated public GraphStatisticsHandler getStatisticsHandler()
Graph
getStatisticsHandler
in interface Graph
public GraphEventManager getEventManager()
getEventManager
in interface Graph
public void notifyAdd(Triple t)
t
has been added to the graph.public void notifyDelete(Triple t)
t
has been deleted from the
graph.public TransactionHandler getTransactionHandler()
getTransactionHandler
in interface Graph
public Capabilities getCapabilities()
getCapabilities
in interface Graph
public PrefixMapping getPrefixMapping()
getPrefixMapping
in interface Graph
public void add(Triple t)
public void performAdd(Triple t)
performAdd
in interface GraphWithPerform
public final void delete(Triple t)
public void performDelete(Triple t)
performDelete
in interface GraphWithPerform
public void clear()
public final ExtendedIterator<Triple> find(Triple m)
Graph
public ExtendedIterator<Triple> forTestingOnly_graphBaseFind(Triple t)
public final ExtendedIterator<Triple> find(Node s, Node p, Node o)
Graph
public final boolean contains(Triple t)
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 graphBaseContains
for efficiency.public final boolean contains(Node s, Node p, Node o)
true
if this graph contains (s, p, o)
;
this canonical implementation cannot be over-ridden.public final int size()
public boolean isEmpty()
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.public boolean isIsomorphicWith(Graph g)
g
according to
the algorithm (indeed, method) in GraphMatcher
.isIsomorphicWith
in interface Graph
g
- Compare against this.public String toString()
public static String toString(String prefix, Graph that)
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).Licenced under the Apache License, Version 2.0