Class DatasetImpl
- All Implemented Interfaces:
AutoCloseable, Dataset, GraphLike<Quad>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Add a quad to the dataset, possibly mapping any of the components to those supported by this dataset.voidAdd a quad to the dataset, possibly mapping any of the components of the Quad to those supported by this dataset.voidclear()Clear the dataset, removing all quads.voidclose()Close the dataset, relinquishing any underlying resources.booleancontains(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Check if dataset contains a pattern of quads.booleanCheck if dataset contains quad.getGraph()Get the default graph of this dataset.getGraph(BlankNodeOrIRI graphName) Get a named graph in this dataset.Get the graph names in this Dataset.internallyMap(T object) voidremove(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Remove a concrete pattern of quads from the default graph of the dataset.voidRemove a concrete quad from the dataset.longsize()Number of quads contained by the dataset.stream()Get all quads contained by the dataset.stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Get all quads contained by the dataset matched with the pattern.toString()
-
Field Details
-
TO_STRING_MAX
private static final int TO_STRING_MAX- See Also:
-
quads
-
factory
-
-
Constructor Details
-
DatasetImpl
DatasetImpl(SimpleRDF simpleRDF)
-
-
Method Details
-
add
Description copied from interface:DatasetAdd a quad to the dataset, possibly mapping any of the components to those supported by this dataset. -
add
Description copied from interface:DatasetAdd a quad to the dataset, possibly mapping any of the components of the Quad to those supported by this dataset. -
internallyMap
-
clear
-
contains
public boolean contains(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Description copied from interface:DatasetCheck if dataset contains a pattern of quads.- Specified by:
containsin interfaceDataset- Parameters:
graphName- The graph the quad belongs to, wrapped as anOptional(nullis a wildcard,Optional.empty()is the default graph)subject- The quad subject (nullis a wildcard)predicate- The quad predicate (nullis a wildcard)object- The quad object (nullis a wildcard)- Returns:
- True if the dataset contains any quads that match the given pattern.
-
contains
-
stream
Description copied from interface:DatasetGet all quads contained by the dataset.
The iteration does not contain any duplicate quads, as determined by the
Quad.equals(Object)method for eachQuad.The behaviour of the
Streamis not specified ifDataset.add(Quad),Dataset.remove(Quad)orDataset.clear()are called on theDatasetbefore it terminates.Implementations may throw
ConcurrentModificationExceptionfrom Stream methods if they detect a conflict while the Stream is active. -
stream
public Stream<Quad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Description copied from interface:DatasetGet all quads contained by the dataset matched with the pattern.The iteration does not contain any duplicate quads, as determined by the
Quad.equals(Object)method for eachQuad.The behaviour of the
Streamis not specified ifDataset.add(Quad),Dataset.remove(Quad)orDataset.clear()are called on theDatasetbefore it terminates.Implementations may throw
ConcurrentModificationExceptionfrom Stream methods if they detect a conflict while the Stream is active.- Specified by:
streamin interfaceDataset- Parameters:
graphName- The graph the quad belongs to, wrapped as anOptional(nullis a wildcard,Optional.empty()is the default graph)subject- The quad subject (nullis a wildcard)predicate- The quad predicate (nullis a wildcard)object- The quad object (nullis a wildcard)- Returns:
- A
Streamover the matched quads.
-
getQuads
-
remove
public void remove(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Description copied from interface:DatasetRemove a concrete pattern of quads from the default graph of the dataset.- Specified by:
removein interfaceDataset- Parameters:
graphName- The graph the quad belongs to, wrapped as anOptional(nullis a wildcard,Optional.empty()is the default graph)subject- The quad subject (nullis a wildcard)predicate- The quad predicate (nullis a wildcard)object- The quad object (nullis a wildcard)
-
remove
-
size
public long size()Description copied from interface:DatasetNumber of quads contained by the dataset.The count of a set does not include duplicates, consistent with the
Quad.equals(Object)equals method for eachQuad. -
toString
-
close
public void close()Description copied from interface:DatasetClose the dataset, relinquishing any underlying resources.For example, this would close any open file and network streams and free database locks held by the dataset implementation.
The behaviour of the other dataset methods are undefined after closing the dataset.
Implementations might not need
Dataset.close(), hence the default implementation does nothing.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDataset
-
getGraph
Description copied from interface:DatasetGet the default graph of this dataset.The
Triples of the default graph are equivalent to theQuads in this Dataset which has theQuad.getGraphName()set toOptional.empty().It is unspecified if modifications to the returned Graph are reflected in this Dataset.
The returned graph MAY be empty.
-
getGraph
Description copied from interface:DatasetGet a named graph in this dataset.The
Triples of the named graph are equivalent to the the Quads of this Dataset which has theQuad.getGraphName()equal to the providedgraphName, or equal toOptional.empty()if the providedgraphNameisnull.It is unspecified if modifications to the returned Graph are reflected in this Dataset.
It is unspecified if requesting an unknown or empty graph will return
Optional.empty()or create a new emptyGraph.- Specified by:
getGraphin interfaceDataset- Parameters:
graphName- The name of the graph, ornullfor the default graph.- Returns:
- The named Graph, or
Optional.empty()if the dataset do not contain the named graph. - See Also:
-
getGraphNames
Description copied from interface:DatasetGet the graph names in this Dataset.The set of returned graph names is equivalent to the set of unique
Quad.getGraphName()of all theDataset.stream()of this dataset (excluding the default graph).The returned
StreamSHOULD NOT contain duplicate graph names.The graph names can be used with
Dataset.getGraph(BlankNodeOrIRI)to retrieve the correspondingGraph, however callers should be aware of any concurrent modifications to the Dataset may cause such calls to returnOptional.empty().Note that a Dataset always contains a default graph which is not named, and thus is not represented in the returned Stream. The default graph is accessible via
Dataset.getGraph()or by usingOptional.empty()in the Quad access methods).- Specified by:
getGraphNamesin interfaceDataset- Returns:
- A
Streamof the graph names of this Dataset.
-