Class DatasetGraphView
- All Implemented Interfaces:
AutoCloseable, Graph, GraphLike<Triple>
Graph view on a Dataset.
This view is backed by a Dataset, and can be constructed in two ways:
DatasetGraphView(Dataset)- Expose a union graph view of the Dataset, where all the
Quads of the Dataset is represented as aTriple. Adding triples will add them to the default graph, while removing triples will remove from all graphs. DatasetGraphView(Dataset, BlankNodeOrIRI)- Expose a particular graph of the Dataset, either named by an
IRI, aBlankNode, ornullfor the default graph.
Changes in the Graph are reflected directly in the Dataset and vice versa. This class is thread-safe is the underlying Dataset is thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Datasetprivate final BlankNodeOrIRIprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionDatasetGraphView(Dataset dataset) DatasetGraphView(Dataset dataset, BlankNodeOrIRI namedGraph) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Adds a triple to the graph, possibly mapping any of the components to those supported by this Graph.voidAdds a triple to the graph, possibly mapping any of the components of the Triple to those supported by this Graph.voidclear()Clears the graph, removing all triples.voidclose()Closes the graph, relinquishing any underlying resources.booleancontains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Checks if graph contains a pattern of triples.booleanChecks if graph contains triple.voidremove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Removes a concrete pattern of triples from the graph.voidRemoves a concrete triple from the graph.longsize()Number of triples contained by the graph.stream()Gets all triples contained by the graph.stream(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Gets all triples contained by the graph matched with the pattern.private Optional<BlankNodeOrIRI> Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Graph
getTriples, getTriples, iterate, iterate
-
Field Details
-
unionGraph
private final boolean unionGraph -
namedGraph
-
dataset
-
-
Constructor Details
-
DatasetGraphView
-
DatasetGraphView
-
-
Method Details
-
close
Description copied from interface:GraphCloses the graph, relinquishing any underlying resources.For example, this would close any open file and network streams and free database locks held by the Graph implementation.
The behaviour of the other Graph methods are undefined after closing the graph.
Implementations might not need
Graph.close(), hence the default implementation does nothing.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceGraph- Throws:
Exception
-
add
Description copied from interface:GraphAdds a triple to the graph, possibly mapping any of the components of the Triple to those supported by this Graph. -
add
Description copied from interface:GraphAdds a triple to the graph, possibly mapping any of the components to those supported by this Graph. -
contains
Description copied from interface:GraphChecks if graph contains triple. -
unionOrNamedGraph
-
contains
Description copied from interface:GraphChecks if graph contains a pattern of triples. -
remove
-
remove
Description copied from interface:GraphRemoves a concrete pattern of triples from the graph. -
clear
-
size
public long size()Description copied from interface:GraphNumber of triples contained by the graph.The count of a set does not include duplicates, consistent with the
Triple.equals(Object)equals method for eachTriple. -
stream
Description copied from interface:GraphGets all triples contained by the graph.
The iteration does not contain any duplicate triples, as determined by the
Triple.equals(Object)method for eachTriple.The behaviour of the
Streamis not specified ifGraph.add(Triple),Graph.remove(Triple)orGraph.clear()are called on theGraphbefore it terminates.Implementations may throw
ConcurrentModificationExceptionfrom Stream methods if they detect a conflict while the Stream is active. -
stream
Description copied from interface:GraphGets all triples contained by the graph matched with the pattern.The iteration does not contain any duplicate triples, as determined by the
Triple.equals(Object)method for eachTriple.The behaviour of the
Streamis not specified ifGraph.add(Triple),Graph.remove(Triple)orGraph.clear()are called on theGraphbefore it terminates.Implementations may throw
ConcurrentModificationExceptionfrom Stream methods if they detect a conflict while the Stream is active.
-