Package org.apache.commons.rdf.api
Interface GraphLike<T extends TripleLike>
-
- Type Parameters:
T
- ATripleLike
type used by the graph methods, typicallyTriple
orQuad
- All Known Subinterfaces:
Dataset
,Graph
,JsonLdDataset
,JsonLdGraph
,JsonLdGraphLike<T>
,JsonLdUnionGraph
,RDF4JDataset
,RDF4JGraph
,RDF4JGraphLike<T>
- All Known Implementing Classes:
AbstractJsonLdGraphLike
,AbstractRepositoryGraphLike
,DatasetGraphView
,DatasetImpl
,GraphImpl
,JsonLdDatasetImpl
,JsonLdGraphImpl
,JsonLdUnionGraphImpl
,ModelGraphImpl
,RepositoryDatasetImpl
,RepositoryGraphImpl
public interface GraphLike<T extends TripleLike>
A "graph-like" interface that containsTripleLike
statements.Extended by
Graph
(forTriple
) andDataset
(forQuad
).Unlike
Graph
andDataset
, this interface can support generalisedTripleLike
orQuadLike
statements, but does not imply semantics likesize()
or the requirement of mappingRDFTerm
instances from different implementations.As
TripleLike
do not have a specificObject.equals(Object)
semantics, the behaviour of methods likecontains(TripleLike)
andremove(TripleLike)
is undefined for arguments that are not object identical to previously added or returnedTripleLike
statements.- Since:
- 0.3.0-incubating
- See Also:
Graph
,Dataset
,TripleLike
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(T statement)
Add a statement.void
clear()
Remove all statements.boolean
contains(T statement)
Check if statement is contained.java.lang.Iterable<T>
iterate()
Iterate over contained statements.void
remove(T statement)
Add a statement.long
size()
Number of statements.java.util.stream.Stream<? extends T>
stream()
Return a Stream of contained statements.
-
-
-
Method Detail
-
add
void add(T statement)
Add a statement.- Parameters:
statement
- The TripleLike statement to add
-
contains
boolean contains(T statement)
Check if statement is contained.- Parameters:
statement
- TheTripleLike
statement to check- Returns:
- True if the statement is contained
-
remove
void remove(T statement)
Add a statement.- Parameters:
statement
- The TripleLike statement to add
-
clear
void clear()
Remove all statements.
-
size
long size()
Number of statements.- Returns:
- Number of statements
-
stream
java.util.stream.Stream<? extends T> stream()
Return a Stream of contained statements.- Returns:
- A
Stream
ofTripleLike
statements.
-
iterate
java.lang.Iterable<T> iterate() throws java.util.ConcurrentModificationException, java.lang.IllegalStateException
Iterate over contained statements.- Returns:
- An
Iterable
ofTripleLike
statements. - Throws:
java.lang.IllegalStateException
- if theIterable
has been reusedjava.util.ConcurrentModificationException
- if a concurrency conflict occurs while the Iterator is active.
-
-