Package org.apache.jena.sparql.core
Class DatasetGraphBase
- java.lang.Object
-
- org.apache.jena.sparql.core.DatasetGraphBase
-
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Closeable,DatasetGraph,Transactional
- Direct Known Subclasses:
DatasetGraphBaseFind,DatasetGraphQuads
public abstract class DatasetGraphBase extends java.lang.Object implements DatasetGraph
DatasetGraph framework : readonly dataset need only provide find(g,s,p,o), getGraph() and getDefaultGraph() although it may wish to override other operations and do better.
Implementations include:
DatasetGraphBasethat adds an implementation of find based on default / named graphs.DatasetGraphInMemoryprovides full transactions for an in-memoryDatasetGraph.DatasetGraphTriplesQuadsthat adds mutating quad operations.DatasetGraphMapprovides for operations working over a collection of in-memory graphs.DatasetGraphMapLinkprovides for operations working over a collection of graphs provided by the application.DatasetGraphCollectionthat provides for operations working over a collection of graphs.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional
Transactional.Promote
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(Node g, Node s, Node p, Node o)Add a quadvoidadd(Quad quad)Add a quadabstract voidaddGraph(Node graphName, Graph graph)Add the given graph to the dataset.voidclear()Remove everything - remove all named graphs, clear the default graphvoidclose()Close the datasetbooleancontains(Node g, Node s, Node p, Node o)Test whether the dataset (including default graph) contains a quad - may include wildcards, Node.ANY or nullbooleancontains(Quad quad)Test whether the dataset contains a quad (including default graph)- may include wildcards, Node.ANY or nullbooleancontainsGraph(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.voiddelete(Node g, Node s, Node p, Node o)Delete a quadvoiddelete(Quad quad)Delete a quadvoiddeleteAny(Node g, Node s, Node p, Node o)Delete any quads matching the patternstatic voiddeleteAny(DatasetGraph dsg, Node g, Node s, Node p, Node o)java.util.Iterator<Quad>find()Iterate over all quads in the dataset graphjava.util.Iterator<Quad>find(Quad quad)Find matching quads in the dataset - may include wildcards, Node.ANY or nullContextgetContext()Get the context associated with this object - may be nullabstract GraphgetDefaultGraph()Get the default graph as a Jena Graphabstract GraphgetGraph(Node graphNode)Get the graph named by graphNode : returns null when there is no such graph.LockgetLock()Return a lock for the dataset to help with concurrency controlGraphgetUnionGraph()Return aGraphthat is the union of all named graphs in this dataset.booleanisEmpty()Test whether the dataset is emptyabstract voidremoveGraph(Node graphName)Remove all data associated with the named graph.voidsetDefaultGraph(Graph g)Set the default graph.longsize()Get the size (number of named graphs) - may be -1 for unknownjava.lang.StringtoString()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.jena.sparql.core.DatasetGraph
addAll, find, findNG, listGraphNodes, prefixes, supportsTransactionAbort, supportsTransactions
-
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
-
containsGraph
public boolean containsGraph(Node graphNode)
Description copied from interface:DatasetGraphDoes 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.- Specified by:
containsGraphin interfaceDatasetGraph- Returns:
- boolean
-
getDefaultGraph
public abstract Graph getDefaultGraph()
Description copied from interface:DatasetGraphGet the default graph as a Jena Graph- Specified by:
getDefaultGraphin interfaceDatasetGraph
-
getUnionGraph
public Graph getUnionGraph()
Description copied from interface:DatasetGraphReturn aGraphthat 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).- Specified by:
getUnionGraphin interfaceDatasetGraph
-
getGraph
public abstract Graph getGraph(Node graphNode)
Description copied from interface:DatasetGraphGet 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.- Specified by:
getGraphin interfaceDatasetGraph
-
addGraph
public abstract void addGraph(Node graphName, Graph graph)
Description copied from interface:DatasetGraphAdd 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 byDatasetGraph.getGraph(org.apache.jena.graph.Node)- Specified by:
addGraphin interfaceDatasetGraph
-
removeGraph
public abstract void removeGraph(Node graphName)
Description copied from interface:DatasetGraphRemove all data associated with the named graph. This will include prefixes associated with the graph.- Specified by:
removeGraphin interfaceDatasetGraph
-
setDefaultGraph
public void setDefaultGraph(Graph g)
Description copied from interface:DatasetGraphSet 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 byDatasetGraph.getDefaultGraph()- Specified by:
setDefaultGraphin interfaceDatasetGraph
-
add
public void add(Quad quad)
Description copied from interface:DatasetGraphAdd a quad- Specified by:
addin interfaceDatasetGraph
-
delete
public void delete(Quad quad)
Description copied from interface:DatasetGraphDelete a quad- Specified by:
deletein interfaceDatasetGraph
-
add
public void add(Node g, Node s, Node p, Node o)
Description copied from interface:DatasetGraphAdd a quad- Specified by:
addin interfaceDatasetGraph
-
delete
public void delete(Node g, Node s, Node p, Node o)
Description copied from interface:DatasetGraphDelete a quad- Specified by:
deletein interfaceDatasetGraph
-
deleteAny
public void deleteAny(Node g, Node s, Node p, Node o)
Description copied from interface:DatasetGraphDelete any quads matching the pattern- Specified by:
deleteAnyin interfaceDatasetGraph
-
deleteAny
public static void deleteAny(DatasetGraph dsg, Node g, Node s, Node p, Node o)
-
find
public java.util.Iterator<Quad> find()
Description copied from interface:DatasetGraphIterate over all quads in the dataset graph- Specified by:
findin interfaceDatasetGraph
-
find
public java.util.Iterator<Quad> find(Quad quad)
Description copied from interface:DatasetGraphFind matching quads in the dataset - may include wildcards, Node.ANY or null- Specified by:
findin interfaceDatasetGraph- See Also:
Graph.find(Triple)
-
contains
public boolean contains(Quad quad)
Description copied from interface:DatasetGraphTest whether the dataset contains a quad (including default graph)- may include wildcards, Node.ANY or null- Specified by:
containsin interfaceDatasetGraph
-
contains
public boolean contains(Node g, Node s, Node p, Node o)
Description copied from interface:DatasetGraphTest whether the dataset (including default graph) contains a quad - may include wildcards, Node.ANY or null- Specified by:
containsin interfaceDatasetGraph
-
clear
public void clear()
Description copied from interface:DatasetGraphRemove everything - remove all named graphs, clear the default graph- Specified by:
clearin interfaceDatasetGraph
-
isEmpty
public boolean isEmpty()
Description copied from interface:DatasetGraphTest whether the dataset is empty- Specified by:
isEmptyin interfaceDatasetGraph
-
size
public long size()
Description copied from interface:DatasetGraphGet the size (number of named graphs) - may be -1 for unknown- Specified by:
sizein interfaceDatasetGraph
-
getLock
public Lock getLock()
Description copied from interface:DatasetGraphReturn a lock for the dataset to help with concurrency control- Specified by:
getLockin interfaceDatasetGraph- See Also:
Lock
-
getContext
public Context getContext()
Description copied from interface:DatasetGraphGet the context associated with this object - may be null- Specified by:
getContextin interfaceDatasetGraph
-
close
public void close()
Description copied from interface:DatasetGraphClose the dataset- Specified by:
closein interfaceorg.apache.jena.atlas.lib.Closeable- Specified by:
closein interfaceDatasetGraph
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-