public class DatasetGraphWithRecord extends DatasetGraphWithLock
DatasetGraph
implementation with two key affordances. First, this class keeps a record of operations
conducted against it. This enables the implementation of DatasetGraphTrackActive.abort()
, by reversing that record and running it
backwards. Second, this class has "copy-on-add" semantics for addGraph(Node, Graph)
. This means that the
transactional semantics of a given Graph
are discarded on add and replaced with those of this class, so that
transactional semantics are uniform and therefore useful.
This class supports MRSW locking. It can only be used with an underlying DatasetGraph implementation that provides
MRSW or weaker locking. If the provided locking is weaker, then this class will only be able to support that level of
locking. Because there is only one record of operations in use in this class at any time, using this class with an
underlying implementation that supports stronger-than-MRSW semantics will have unpredictable results.Constructor and Description |
---|
DatasetGraphWithRecord(DatasetGraph dsg) |
DatasetGraphWithRecord(DatasetGraph dsg,
ReversibleOperationRecord<QuadOperation<?,?>> record) |
Modifier and Type | Method and Description |
---|---|
void |
add(Node g,
Node s,
Node p,
Node o)
Add a quad
|
void |
add(Quad quad)
Add a quad
|
void |
addGraph(Node graphName,
Graph graph)
Add the given graph to the dataset.
|
void |
clear()
Remove everything - remove all named graphs, clear the default graph
|
void |
close()
Close the dataset
|
void |
delete(Node g,
Node s,
Node p,
Node o)
Delete a quad
|
void |
delete(Quad quad)
Delete a quad
|
void |
deleteAny(Node g,
Node s,
Node p,
Node o)
Delete any quads matching the pattern
|
void |
removeGraph(Node graphName)
Remove all data associated with the named graph
|
getContext, isInTransaction, sync, toString
abort, begin, commit, contains, contains, containsGraph, end, find, find, find, findNG, getDefaultGraph, getGraph, getLock, isEmpty, listGraphNodes, setDefaultGraph, size
public DatasetGraphWithRecord(DatasetGraph dsg)
dsg
- the DatasetGraph that will back this onepublic DatasetGraphWithRecord(DatasetGraph dsg, ReversibleOperationRecord<QuadOperation<?,?>> record)
dsg
- the DatasetGraph that will back this onerecord
- the operation record to use with this DatasetGraphpublic void add(Quad quad)
DatasetGraph
add
in interface DatasetGraph
add
in class DatasetGraphTrackActive
public void delete(Quad quad)
DatasetGraph
delete
in interface DatasetGraph
delete
in class DatasetGraphTrackActive
public void addGraph(Node graphName, Graph graph)
DatasetGraph
DatasetGraph.getGraph(org.apache.jena.graph.Node)
addGraph
in interface DatasetGraph
addGraph
in class DatasetGraphTrackActive
public void removeGraph(Node graphName)
DatasetGraph
removeGraph
in interface DatasetGraph
removeGraph
in class DatasetGraphTrackActive
public void add(Node g, Node s, Node p, Node o)
DatasetGraph
add
in interface DatasetGraph
add
in class DatasetGraphTrackActive
public void delete(Node g, Node s, Node p, Node o)
DatasetGraph
delete
in interface DatasetGraph
delete
in class DatasetGraphTrackActive
public void deleteAny(Node g, Node s, Node p, Node o)
DatasetGraph
deleteAny
in interface DatasetGraph
deleteAny
in class DatasetGraphTrackActive
public void clear()
DatasetGraph
clear
in interface DatasetGraph
clear
in class DatasetGraphTrackActive
public void close()
DatasetGraph
close
in interface org.apache.jena.atlas.lib.Closeable
close
in interface DatasetGraph
close
in class DatasetGraphTrackActive
Licenced under the Apache License, Version 2.0