Interface RdfGraph
-
- All Known Implementing Classes:
OrderedTripleSet,TripleSet
public interface RdfGraphRepresents an RDF graph, a collection of RDF triples.An RDF graph is a set of triples, where each triple consists of a subject, predicate, and object, forming a statement of knowledge in the RDF format.
This interface defines the basic operations on an RDF graph, including checking for the presence of a triple, adding and removing triples (although these operations are unsupported by default), and streaming over the graph's triples.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanadd(RdfTriple triple)Adds a triple to the RDF graph.booleancontains(RdfTriple triple)Checks if the RDF graph contains the specified triple.default booleanremove(RdfTriple triple)Removes a triple from the RDF graph.java.util.stream.Stream<RdfTriple>stream()Returns a stream of all the triples in the RDF graph.
-
-
-
Method Detail
-
contains
boolean contains(RdfTriple triple)
Checks if the RDF graph contains the specified triple.This method allows you to verify whether a specific RDF triple is present in the graph.
- Parameters:
triple- theRdfTripleto check for- Returns:
trueif the graph contains the specified triple;falseotherwise
-
stream
java.util.stream.Stream<RdfTriple> stream()
Returns a stream of all the triples in the RDF graph.This method provides a convenient way to iterate over all the triples in the graph. It can be used with Java Streams API to process the triples in a functional manner.
- Returns:
- a
StreamofRdfTriples representing the RDF graph
-
add
default boolean add(RdfTriple triple)
Adds a triple to the RDF graph.This operation is unsupported by default and will throw an
UnsupportedOperationException. Implementations that support modification of the graph should override this method.- Parameters:
triple- theRdfTripleto add- Returns:
trueif the triple was successfully added (implementation dependent)- Throws:
java.lang.UnsupportedOperationException- if modification of the graph is not supported
-
remove
default boolean remove(RdfTriple triple)
Removes a triple from the RDF graph.This operation is unsupported by default and will throw an
UnsupportedOperationException. Implementations that support removal of triples should override this method.- Parameters:
triple- theRdfTripleto remove- Returns:
trueif the triple was successfully removed (implementation dependent)- Throws:
java.lang.UnsupportedOperationException- if removal of the triple is not supported
-
-