Package org.apache.jena.sparql.core
Interface DatasetGraph
-
- All Superinterfaces:
org.apache.jena.atlas.lib.Closeable
,Transactional
- All Known Subinterfaces:
DatasetGraphWrapperView
- All Known Implementing Classes:
DatasetGraphBase
,DatasetGraphBaseFind
,DatasetGraphCollection
,DatasetGraphFilteredView
,DatasetGraphInMemory
,DatasetGraphMap
,DatasetGraphMapLink
,DatasetGraphMonitor
,DatasetGraphNull
,DatasetGraphOne
,DatasetGraphQuads
,DatasetGraphRDFS
,DatasetGraphReadOnly
,DatasetGraphSink
,DatasetGraphTriplesQuads
,DatasetGraphViewGraphs
,DatasetGraphWrapper
,DatasetGraphZero
,DifferenceDatasetGraph
,DyadicDatasetGraph
,DynamicDatasets.DynamicDatasetGraph
,IntersectionDatasetGraph
,UnionDatasetGraph
public interface DatasetGraph extends Transactional, org.apache.jena.atlas.lib.Closeable
DatasetGraph: The graph representation of an RDF Dataset. SeeDataset
for the Model level of an RDF dataset.Whether a dataset contains a graph if there are no triples is not defined; see the specific implementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional
Transactional.Promote
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
add(Node g, Node s, Node p, Node o)
Add a quadvoid
add(Quad quad)
Add a quaddefault void
addAll(DatasetGraph src)
Add thesrc
DatasetGraph to this one.void
addGraph(Node graphName, Graph graph)
Add the given graph to the dataset.void
clear()
Remove everything - remove all named graphs, clear the default graphvoid
close()
Close the datasetboolean
contains(Node g, Node s, Node p, Node o)
Test whether the dataset (including default graph) contains a quad - may include wildcards, Node.ANY or nullboolean
contains(Quad quad)
Test whether the dataset contains a quad (including default graph)- may include wildcards, Node.ANY or nullboolean
containsGraph(Node graphNode)
Does the DatasetGraph contain a specific named graph? Whether a dataset contains a graph if there are no triples is not defined - see the specific implementation.void
delete(Node g, Node s, Node p, Node o)
Delete a quadvoid
delete(Quad quad)
Delete a quadvoid
deleteAny(Node g, Node s, Node p, Node o)
Delete any quads matching the patterndefault java.util.Iterator<Quad>
find()
Iterate over all quads in the dataset graphjava.util.Iterator<Quad>
find(Node g, Node s, Node p, Node o)
Find matching quads in the dataset (including default graph) - may include wildcards, Node.ANY or nulljava.util.Iterator<Quad>
find(Quad quad)
Find matching quads in the dataset - may include wildcards, Node.ANY or nulljava.util.Iterator<Quad>
findNG(Node g, Node s, Node p, Node o)
Find matching quads in the dataset in named graphs only - may include wildcards, Node.ANY or nullContext
getContext()
Get the context associated with this object - may be nullGraph
getDefaultGraph()
Get the default graph as a Jena GraphGraph
getGraph(Node graphNode)
Get the graph named by graphNode : returns null when there is no such graph.Lock
getLock()
Return a lock for the dataset to help with concurrency controlGraph
getUnionGraph()
Return aGraph
that is the union of all named graphs in this dataset.boolean
isEmpty()
Test whether the dataset is emptyjava.util.Iterator<Node>
listGraphNodes()
Iterate over all names of named graphsPrefixMap
prefixes()
Prefixes for this DatasetGraphvoid
removeGraph(Node graphName)
Remove all data associated with the named graph.void
setDefaultGraph(Graph g)
Set the default graph.long
size()
Get the size (number of named graphs) - may be -1 for unknowndefault java.util.stream.Stream<Quad>
stream()
Returns aStream
ofQuads
in this dataset.default java.util.stream.Stream<Quad>
stream(Node g, Node s, Node p, Node o)
Returns aStream
ofQuads
matching a pattern.default boolean
supportsTransactionAbort()
Declare whetherTransactional.abort()
is supported.boolean
supportsTransactions()
ADatasetGraph
supports transactions if it providesTransactional.begin()
/Transactional.commit()
/Transactional.end()
.-
Methods inherited from interface org.apache.jena.sparql.core.Transactional
abort, begin, begin, begin, calc, calculate, calculateRead, calculateWrite, commit, end, exec, execute, executeRead, executeWrite, isInTransaction, promote, promote, transactionMode, transactionType
-
-
-
-
Method Detail
-
getDefaultGraph
Graph getDefaultGraph()
Get the default graph as a Jena Graph
-
getGraph
Graph getGraph(Node graphNode)
Get the graph named by graphNode : returns null when there is no such graph. NB Whether a dataset contains a graph if there are no triples is not defined - see the specific implementation. Some datasets are "open" - they have all graphs even if no triples.
-
getUnionGraph
Graph getUnionGraph()
Return aGraph
that is the union of all named graphs in this dataset. This union graph is read-only (its prefix mapping in the current JVM may be changed but that may not persist).
-
containsGraph
boolean containsGraph(Node graphNode)
Does the DatasetGraph contain a specific named graph? Whether a dataset contains a graph if there are no triples is not defined - see the specific implementation. Some datasets are "open" - they have all graphs even if no triples and this returns true always.- Parameters:
graphNode
-- Returns:
- boolean
-
setDefaultGraph
void setDefaultGraph(Graph g)
Set the default graph. Set the active graph if it was null. This replaces the contents default graph, not merge data into it. Do not assume that the same object is returned bygetDefaultGraph()
-
addGraph
void addGraph(Node graphName, Graph graph)
Add the given graph to the dataset. Replaces any existing data for the named graph; to add data, get the graph and add triples to it, or add quads to the dataset. Do not assume that the same Java object is returned bygetGraph(org.apache.jena.graph.Node)
-
removeGraph
void removeGraph(Node graphName)
Remove all data associated with the named graph. This will include prefixes associated with the graph.
-
listGraphNodes
java.util.Iterator<Node> listGraphNodes()
Iterate over all names of named graphs
-
add
void add(Quad quad)
Add a quad
-
delete
void delete(Quad quad)
Delete a quad
-
addAll
default void addAll(DatasetGraph src)
Add thesrc
DatasetGraph to this one.
-
find
default java.util.Iterator<Quad> find()
Iterate over all quads in the dataset graph
-
find
java.util.Iterator<Quad> find(Quad quad)
Find matching quads in the dataset - may include wildcards, Node.ANY or null- See Also:
Graph.find(Triple)
-
find
java.util.Iterator<Quad> find(Node g, Node s, Node p, Node o)
Find matching quads in the dataset (including default graph) - may include wildcards, Node.ANY or null- See Also:
Graph.find(Node,Node,Node)
-
findNG
java.util.Iterator<Quad> findNG(Node g, Node s, Node p, Node o)
Find matching quads in the dataset in named graphs only - may include wildcards, Node.ANY or null- See Also:
Graph.find(Node,Node,Node)
-
stream
default java.util.stream.Stream<Quad> stream(Node g, Node s, Node p, Node o)
Returns aStream
ofQuads
matching a pattern.- Returns:
- a stream of quads in this dataset matching the pattern.
-
stream
default java.util.stream.Stream<Quad> stream()
Returns aStream
ofQuads
in this dataset.- Returns:
- a stream of quads in this dataset.
-
contains
boolean contains(Node g, Node s, Node p, Node o)
Test whether the dataset (including default graph) contains a quad - may include wildcards, Node.ANY or null
-
contains
boolean contains(Quad quad)
Test whether the dataset contains a quad (including default graph)- may include wildcards, Node.ANY or null
-
clear
void clear()
Remove everything - remove all named graphs, clear the default graph
-
isEmpty
boolean isEmpty()
Test whether the dataset is empty
-
getLock
Lock getLock()
Return a lock for the dataset to help with concurrency control- See Also:
Lock
-
getContext
Context getContext()
Get the context associated with this object - may be null
-
size
long size()
Get the size (number of named graphs) - may be -1 for unknown
-
close
void close()
Close the dataset- Specified by:
close
in interfaceorg.apache.jena.atlas.lib.Closeable
-
prefixes
PrefixMap prefixes()
Prefixes for this DatasetGraph
-
supportsTransactions
boolean supportsTransactions()
ADatasetGraph
supports transactions if it providesTransactional.begin()
/Transactional.commit()
/Transactional.end()
. The core storageDatasetGraph
s provide fully serialized transactions. ADatasetGraph
that provides functionality across independent systems can not provide such strong guarantees. For example, it may use MRSW locking and some isolation control. Specifically, it would not necessarily provideTransactional.abort()
.See
supportsTransactionAbort()
forTransactional.abort()
. In addition, check details of a specific implementation.
-
supportsTransactionAbort
default boolean supportsTransactionAbort()
Declare whetherTransactional.abort()
is supported. This goes along with clearing up after exceptions inside application transaction code.
-
-