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_LIMIT
Fields inherited from interface org.apache.jena.graph.Graph
emptyGraph
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Remove all the statements from this graph.copy()
Creates a copy of this graph.void
destroy()
Subclasses over-ride this method to release any resources they no longer need once fully closed.returns this Graph's capabilitiesboolean
graphBaseContains
(Triple tripleMatch) Answer true if the graph contains any triple matchingt
.graphBaseFind
(Triple tripleMatch) Returns anExtendedIterator
of all triples in the graph matching the given triple match.int
Answer the number of triples in this graph.void
performAdd
(Triple t) Add a triple to the graph without notifying.void
Remove a triple from the triple store.stream()
Returns aStream
of all triples in the graph.Returns aStream
of Triples matching a pattern.Methods inherited from class org.apache.jena.mem.GraphMemBase
close, openAgain
Methods 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, toString
-
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:
performAdd
in interfaceGraphWithPerform
- Overrides:
performAdd
in 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:
performDelete
in interfaceGraphWithPerform
- Overrides:
performDelete
in classGraphBase
- Parameters:
t
- triple to delete
-
stream
Returns aStream
of all triples in the graph. Note:BaseStream.parallel()
is supported. -
stream
Returns aStream
of Triples matching a pattern. Note:BaseStream.parallel()
is supported. -
graphBaseFind
Returns anExtendedIterator
of all triples in the graph matching the given triple match. -
graphBaseContains
Answer true if the graph contains any triple matchingt
. The default implementation usesfind
and 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. -
getCapabilities
Description copied from interface:Graph
returns this Graph's capabilities- Specified by:
getCapabilities
in interfaceGraph
- Overrides:
getCapabilities
in classGraphBase
-
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:
copy
in interfaceorg.apache.jena.atlas.lib.Copyable<GraphMem2>
- Returns:
- independent copy of the current graph
-