Class GraphDataset
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<RdfResource,RdfGraph>
-
- com.apicatalog.rdf.primitive.set.GraphDataset
-
- All Implemented Interfaces:
RdfDataset,java.io.Serializable,java.lang.Cloneable,java.util.Map<RdfResource,RdfGraph>
public final class GraphDataset extends java.util.HashMap<RdfResource,RdfGraph> implements RdfDataset
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) RdfGraphdefaultGraphprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description GraphDataset()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RdfGraphdefaultGraph()Returns the default graph of the dataset.GraphDatasetdefaultGraph(RdfGraph graph)Replaces the default graph in the dataset with the specified graph.java.util.Set<RdfResource>graphNames()Returns the set of graph names for all named graphs in the dataset.java.util.Optional<RdfGraph>namedGraph(RdfResource graphName)Returns the named graph corresponding to the provided graph name.GraphDatasetnamedGraph(RdfResource graphName, RdfGraph graph)Adds or replaces a named graph in the dataset.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
defaultGraph
RdfGraph defaultGraph
-
-
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
-
defaultGraph
public GraphDataset defaultGraph(RdfGraph graph)
Description copied from interface:RdfDatasetReplaces the default graph in the dataset with the specified graph.By default, this operation is unsupported and throws an
UnsupportedOperationException. Implementations that support modification of the dataset should override this method.- Specified by:
defaultGraphin interfaceRdfDataset- Parameters:
graph- theRdfGraphto be set as the new default graph- Returns:
- the updated
RdfDatasetinstance
-
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()
-
namedGraph
public GraphDataset namedGraph(RdfResource graphName, RdfGraph graph)
Description copied from interface:RdfDatasetAdds or replaces a named graph in the dataset.Associates the specified
RdfGraphwith the givenRdfResourcegraph name. If a graph with the same name already exists, it will be replaced.By default, this operation is unsupported and throws an
UnsupportedOperationException. Implementations that support modification of the dataset should override this method.- Specified by:
namedGraphin interfaceRdfDataset- Parameters:
graphName- theRdfResourceidentifying the named graphgraph- theRdfGraphto associate with the specified name- Returns:
- the updated
RdfDatasetinstance
-
-