Class JsonLdGraphImpl
- java.lang.Object
-
- org.apache.commons.rdf.jsonldjava.AbstractJsonLdGraphLike<Triple>
-
- org.apache.commons.rdf.jsonldjava.JsonLdGraphImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,Graph
,GraphLike<Triple>
,JsonLdGraph
,JsonLdGraphLike<Triple>
class JsonLdGraphImpl extends AbstractJsonLdGraphLike<Triple> implements JsonLdGraph
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Optional<BlankNodeOrIRI>
graphName
-
Fields inherited from class org.apache.commons.rdf.jsonldjava.AbstractJsonLdGraphLike
bnodePrefix, factory, rdfDataSet
-
-
Constructor Summary
Constructors Constructor Description JsonLdGraphImpl(com.github.jsonldjava.core.RDFDataset rdfDataSet)
JsonLdGraphImpl(com.github.jsonldjava.core.RDFDataset rdfDataSet, java.util.Optional<BlankNodeOrIRI> graphName, java.lang.String bnodePrefix)
JsonLdGraphImpl(java.lang.String bnodePrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Adds a triple to the graph, possibly mapping any of the components to those supported by this Graph.void
add(Triple t)
Add a statement.(package private) JsonLdTriple
asTripleOrQuad(com.github.jsonldjava.core.RDFDataset.Quad jsonldQuad)
void
clear()
Remove all statements.boolean
contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Checks if graph contains a pattern of triples.boolean
contains(Triple t)
Check if statement is contained.void
remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Removes a concrete pattern of triples from the graph.void
remove(Triple t)
Add a statement.long
size()
Number of statements.java.util.stream.Stream<JsonLdTriple>
stream(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Gets all triples contained by the graph matched with the pattern.-
Methods inherited from class org.apache.commons.rdf.jsonldjava.AbstractJsonLdGraphLike
add, close, contains, filteredGraphs, getRdfDataSet, graphNameAsJsonLdString, quadFilter, remove, 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.Graph
close, getTriples, getTriples, iterate, iterate, stream
-
Methods inherited from interface org.apache.commons.rdf.jsonldjava.JsonLdGraphLike
getRdfDataSet
-
-
-
-
Field Detail
-
graphName
private final java.util.Optional<BlankNodeOrIRI> graphName
-
-
Constructor Detail
-
JsonLdGraphImpl
JsonLdGraphImpl(com.github.jsonldjava.core.RDFDataset rdfDataSet)
-
JsonLdGraphImpl
JsonLdGraphImpl(com.github.jsonldjava.core.RDFDataset rdfDataSet, java.util.Optional<BlankNodeOrIRI> graphName, java.lang.String bnodePrefix)
-
JsonLdGraphImpl
JsonLdGraphImpl(java.lang.String bnodePrefix)
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:GraphLike
Remove all statements.
-
add
public void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Description copied from interface:Graph
Adds a triple to the graph, possibly mapping any of the components to those supported by this Graph.
-
contains
public boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Description copied from interface:Graph
Checks if graph contains a pattern of triples.
-
contains
public boolean contains(Triple t)
Description copied from interface:GraphLike
Check if statement is contained.- Specified by:
contains
in interfaceGraph
- Specified by:
contains
in interfaceGraphLike<Triple>
- Overrides:
contains
in classAbstractJsonLdGraphLike<Triple>
- Parameters:
t
- TheTripleLike
statement to check- Returns:
- True if the statement is contained
-
remove
public void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Description copied from interface:Graph
Removes a concrete pattern of triples from the graph.
-
size
public long size()
Description copied from interface:GraphLike
Number of statements.
-
stream
public java.util.stream.Stream<JsonLdTriple> stream(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Description copied from interface:Graph
Gets 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
Stream
is not specified ifGraph.add(Triple)
,Graph.remove(Triple)
orGraph.clear()
are called on theGraph
before it terminates.Implementations may throw
ConcurrentModificationException
from Stream methods if they detect a conflict while the Stream is active.
-
asTripleOrQuad
JsonLdTriple asTripleOrQuad(com.github.jsonldjava.core.RDFDataset.Quad jsonldQuad)
Description copied from class:AbstractJsonLdGraphLike
- Specified by:
asTripleOrQuad
in classAbstractJsonLdGraphLike<Triple>
- Parameters:
jsonldQuad
- jsonld quad to convert- Returns:
- converted
TripleLike
- See Also:
JsonLdRDF.asTriple(Quad)
,JsonLdRDF.asQuad(Quad)
-
-