java.lang.Object
org.apache.jena.graph.impl.GraphBase
org.apache.jena.mem.GraphMemBase
org.apache.jena.mem2.GraphMem2
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Copyable<GraphMem2>,Graph,GraphWithPerform
- Direct Known Subclasses:
GraphMem2Fast,GraphMem2Legacy,GraphMem2Roaring
public class GraphMem2
extends GraphMemBase
implements GraphWithPerform, org.apache.jena.atlas.lib.Copyable<GraphMem2>
A graph that stores triples in memory. This class is not thread-safe.
All triples are stored in a
TripleStore.
Implementation must always comply to term-equality semantics. The characteristics of the implementations always have handlesLiteralTyping() == false.
-
Field Summary
Fields inherited from class org.apache.jena.graph.impl.GraphBase
TOSTRING_TRIPLE_BASE, TOSTRING_TRIPLE_LIMITFields inherited from interface org.apache.jena.graph.Graph
emptyGraph -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all the statements from this graph.copy()Creates a copy of this graph.voiddestroy()Subclasses over-ride this method to release any resources they no longer need once fully closed.booleangraphBaseContains(Triple tripleMatch) Answer true if the graph contains any triple matchingt.graphBaseFind(Triple tripleMatch) Returns anExtendedIteratorof all triples in the graph matching the given triple match.intAnswer the number of triples in this graph.voidperformAdd(Triple t) Add a triple to the graph without notifying.voidRemove a triple from the triple store.stream()Returns aStreamof all triples in the graph.Returns aStreamof Triples matching a pattern.Methods inherited from class org.apache.jena.mem.GraphMemBase
close, openAgainMethods inherited from class org.apache.jena.graph.impl.GraphBase
add, contains, contains, delete, dependsOn, find, find, forTestingOnly_graphBaseFind, getEventManager, getPrefixMapping, getTransactionHandler, isClosed, isEmpty, isIsomorphicWith, notifyAdd, notifyDelete, remove, size, toString, toStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.jena.graph.Graph
add, add, close, contains, contains, delete, delete, dependsOn, find, find, find, getCapabilities, getEventManager, getPrefixMapping, getTransactionHandler, isClosed, isEmpty, isIsomorphicWith, remove, size, sizeLong
-
Method Details
-
destroy
public void destroy()Subclasses over-ride this method to release any resources they no longer need once fully closed. -
clear
public void clear()Remove all the statements from this graph. -
performAdd
Add a triple to the graph without notifying. The default implementation throws an AddDeniedException; subclasses must override if they want to be able to add triples.- Specified by:
performAddin interfaceGraphWithPerform- Overrides:
performAddin classGraphBase- Parameters:
t- triple to add
-
performDelete
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:
performDeletein interfaceGraphWithPerform- Overrides:
performDeletein classGraphBase- Parameters:
t- triple to delete
-
stream
Returns aStreamof all triples in the graph. Note:BaseStream.parallel()is supported. -
stream
Returns aStreamof Triples matching a pattern. Note:BaseStream.parallel()is supported. -
graphBaseFind
Returns anExtendedIteratorof all triples in the graph matching the given triple match. -
graphBaseContains
Answer true if the graph contains any triple matchingt. The default implementation usesfindand checks to see if the iterator is non-empty.- Parameters:
tripleMatch- triple match pattern, which may be contained
-
graphBaseSize
public int graphBaseSize()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. -
copy
Creates a copy of this graph. Since the triples and nodes are immutable, the copy contains the same triples and nodes as this graph. Modifications to the copy will not affect this graph.- Specified by:
copyin interfaceorg.apache.jena.atlas.lib.Copyable<GraphMem2>- Returns:
- independent copy of the current graph
-