Package com.apicatalog.rdf.primitive.set
Class OrderedQuadDataset
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.HashSet<E>
-
- java.util.LinkedHashSet<RdfQuad>
-
- com.apicatalog.rdf.primitive.set.OrderedQuadDataset
-
- All Implemented Interfaces:
RdfDataset,RdfQuadSet,java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<RdfQuad>,java.util.Collection<RdfQuad>,java.util.Set<RdfQuad>
public final class OrderedQuadDataset extends java.util.LinkedHashSet<RdfQuad> implements RdfDataset, RdfQuadSet
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) RdfGraphdefaultGraph(package private) java.util.Map<RdfResource,RdfGraph>graphsnamed graphs indexprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description OrderedQuadDataset()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(RdfQuad nquad)AddsRdfQuadto the RDF graph.booleancontains(RdfQuad quad)Checks if the set contains the specifiedRdfQuad.RdfGraphdefaultGraph()Returns the default graph of the dataset.java.util.Set<RdfResource>graphNames()Returns the set of graph names for all named graphs in the dataset.java.util.Iterator<RdfQuad>iterator()java.util.Optional<RdfGraph>namedGraph(RdfResource graphName)Returns the named graph corresponding to the provided graph name.booleanremove(RdfQuad quad)RemovesRdfQuadfrom the RDF graph.java.util.stream.Stream<RdfQuad>stream()Returns aStreamof the RDF quads in this set.-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.apicatalog.rdf.model.RdfDataset
defaultGraph, namedGraph
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
defaultGraph
final RdfGraph defaultGraph
-
graphs
final java.util.Map<RdfResource,RdfGraph> graphs
named graphs index
-
-
Method Detail
-
defaultGraph
public RdfGraph defaultGraph()
Description copied from interface:RdfDatasetReturns the default graph of the dataset.The default graph is the unnamed graph in the dataset. It contains RDF triples that are not part of any named graph.
- Specified by:
defaultGraphin interfaceRdfDataset- Returns:
- the
RdfGraphrepresenting the default graph; nevernull
-
add
public boolean add(RdfQuad nquad)
Description copied from interface:RdfQuadSetAddsRdfQuadto the RDF graph.This operation is unsupported by default and will throw an
UnsupportedOperationException. Implementations that support modification of the set should override this method.- Specified by:
addin interfacejava.util.Collection<RdfQuad>- Specified by:
addin interfaceRdfQuadSet- Specified by:
addin interfacejava.util.Set<RdfQuad>- Overrides:
addin classjava.util.HashSet<RdfQuad>- Parameters:
nquad- theRdfQuadto add- Returns:
trueif the quad was successfully added (implementation dependent)
-
graphNames
public java.util.Set<RdfResource> graphNames()
Description copied from interface:RdfDatasetReturns the set of graph names for all named graphs in the dataset.Each name is represented as a
RdfResource, which can be an IRI or a blank node identifier.- Specified by:
graphNamesin interfaceRdfDataset- Returns:
- an immutable
SetofRdfResourcegraph names; empty if no named graphs are present.
-
namedGraph
public java.util.Optional<RdfGraph> namedGraph(RdfResource graphName)
Description copied from interface:RdfDatasetReturns the named graph corresponding to the provided graph name.If the dataset does not contain a named graph with the specified name, an empty
Optionalis returned.- Specified by:
namedGraphin interfaceRdfDataset- Parameters:
graphName- theRdfResourceidentifying the named graph- Returns:
- an
Optionalcontaining theRdfGraphif present; otherwise,Optional.empty()
-
contains
public boolean contains(RdfQuad quad)
Description copied from interface:RdfQuadSetChecks if the set contains the specifiedRdfQuad.- Specified by:
containsin interfaceRdfQuadSet- Parameters:
quad- theRdfQuadto check- Returns:
trueif the set contains the specified quad,falseotherwise
-
stream
public java.util.stream.Stream<RdfQuad> stream()
Description copied from interface:RdfQuadSetReturns aStreamof the RDF quads in this set.The stream can be used for operations such as filtering or mapping over the quads.
- Specified by:
streamin interfacejava.util.Collection<RdfQuad>- Specified by:
streamin interfaceRdfQuadSet- Returns:
- a stream of
RdfQuadobjects in the set
-
iterator
public java.util.Iterator<RdfQuad> iterator()
-
remove
public boolean remove(RdfQuad quad)
Description copied from interface:RdfQuadSetRemovesRdfQuadfrom the RDF graph.This operation is unsupported by default and will throw an
UnsupportedOperationException. Implementations that support removal of quads should override this method.- Specified by:
removein interfaceRdfQuadSet- Parameters:
quad- theRdfQuadto remove- Returns:
trueif the quad was successfully removed (implementation dependent)
-
-