Class JsonLdDatasetImpl
- All Implemented Interfaces:
AutoCloseable
,Dataset
,GraphLike<Quad>
,JsonLdDataset
,JsonLdGraphLike<Quad>
-
Field Summary
Fields inherited from class org.apache.commons.rdf.jsonldjava.AbstractJsonLdGraphLike
bnodePrefix, factory, rdfDataSet
-
Constructor Summary
ConstructorsConstructorDescriptionJsonLdDatasetImpl
(com.github.jsonldjava.core.RDFDataset rdfDataSet) JsonLdDatasetImpl
(com.github.jsonldjava.core.RDFDataset rdfDataset, String bnodePrefix) JsonLdDatasetImpl
(String bnodePrefix) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(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.(package private) Quad
asTripleOrQuad
(com.github.jsonldjava.core.RDFDataset.Quad jsonldQuad) boolean
contains
(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Check if dataset contains a pattern of quads.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.void
remove
(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Remove a concrete pattern of quads from the default graph of the dataset.void
Add a statement.long
size()
Number of statements.stream
(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Get all quads contained by the dataset matched with the pattern.Methods inherited from class org.apache.commons.rdf.jsonldjava.AbstractJsonLdGraphLike
add, clear, close, contains, filteredGraphs, getRdfDataSet, graphNameAsJsonLdString, quadFilter, stream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.commons.rdf.api.Dataset
add, clear, close, contains, iterate, iterate, stream
Methods inherited from interface org.apache.commons.rdf.jsonldjava.JsonLdGraphLike
getRdfDataSet
-
Constructor Details
-
Method Details
-
add
Description copied from interface:Dataset
Add a quad to the dataset, possibly mapping any of the components to those supported by this dataset.- Specified by:
add
in interfaceDataset
- Overrides:
add
in classAbstractJsonLdGraphLike<Quad>
- Parameters:
graphName
- The graph the quad belongs to, ornull
for the default graphsubject
- The quad subjectpredicate
- The quad predicateobject
- The quad object
-
contains
public boolean contains(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Description copied from interface:Dataset
Check if dataset contains a pattern of quads.- Specified by:
contains
in interfaceDataset
- Overrides:
contains
in classAbstractJsonLdGraphLike<Quad>
- Parameters:
graphName
- The graph the quad belongs to, wrapped as anOptional
(null
is a wildcard,Optional.empty()
is the default graph)subject
- The quad subject (null
is a wildcard)predicate
- The quad predicate (null
is a wildcard)object
- The quad object (null
is a wildcard)- Returns:
- True if the dataset contains any quads that match the given pattern.
-
getGraph
Description copied from interface:Dataset
Get the default graph of this dataset.The
Triple
s of the default graph are equivalent to theQuad
s 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:Dataset
Get a named graph in this dataset.The
Triple
s 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 providedgraphName
isnull
.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:
getGraph
in interfaceDataset
- Parameters:
graphName
- The name of the graph, ornull
for 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:Dataset
Get 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
Stream
SHOULD 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:
getGraphNames
in interfaceDataset
- Returns:
- A
Stream
of the graph names of this Dataset.
-
remove
public void remove(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Description copied from interface:Dataset
Remove a concrete pattern of quads from the default graph of the dataset.- Specified by:
remove
in interfaceDataset
- Overrides:
remove
in classAbstractJsonLdGraphLike<Quad>
- Parameters:
graphName
- The graph the quad belongs to, wrapped as anOptional
(null
is a wildcard,Optional.empty()
is the default graph)subject
- The quad subject (null
is a wildcard)predicate
- The quad predicate (null
is a wildcard)object
- The quad object (null
is a wildcard)
-
remove
Description copied from interface:GraphLike
Add a statement. -
stream
public Stream<? extends Quad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) Description copied from interface:Dataset
Get 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
Stream
is not specified ifDataset.add(Quad)
,Dataset.remove(Quad)
orDataset.clear()
are called on theDataset
before it terminates.Implementations may throw
ConcurrentModificationException
from Stream methods if they detect a conflict while the Stream is active.- Specified by:
stream
in interfaceDataset
- Parameters:
graphName
- The graph the quad belongs to, wrapped as anOptional
(null
is a wildcard,Optional.empty()
is the default graph)subject
- The quad subject (null
is a wildcard)predicate
- The quad predicate (null
is a wildcard)object
- The quad object (null
is a wildcard)- Returns:
- A
Stream
over the matched quads.
-
size
public long size()Description copied from interface:GraphLike
Number of statements. -
asTripleOrQuad
Description copied from class:AbstractJsonLdGraphLike
- Specified by:
asTripleOrQuad
in classAbstractJsonLdGraphLike<Quad>
- Parameters:
jsonldQuad
- jsonld quad to convert- Returns:
- converted
TripleLike
- See Also:
-