Interface GraphLike<T extends TripleLike>

Type Parameters:
T - A TripleLike type used by the graph methods, typically Triple or Quad
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 contains TripleLike statements.

Extended by Graph (for Triple) and Dataset (for Quad).

Unlike Graph and Dataset, this interface can support generalised TripleLike or QuadLike statements, but does not imply semantics like size() or the requirement of mapping RDFTerm instances from different implementations.

As TripleLike do not have a specific Object.equals(Object) semantics, the behaviour of methods like contains(TripleLike) and remove(TripleLike) is undefined for arguments that are not object identical to previously added or returned TripleLike statements.

Since:
0.3.0-incubating
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T statement)
    Add a statement.
    void
    Remove all statements.
    boolean
    contains(T statement)
    Check if statement is contained.
    Iterate over contained statements.
    void
    remove(T statement)
    Add a statement.
    long
    Number of statements.
    Stream<? extends T>
    Return a Stream of contained statements.
  • Method Details

    • 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 - The TripleLike 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

      Stream<? extends T> stream()
      Return a Stream of contained statements.
      Returns:
      A Stream of TripleLike statements.
    • iterate

      Iterate over contained statements.
      Returns:
      An Iterable of TripleLike statements.
      Throws:
      IllegalStateException - if the Iterable has been reused
      ConcurrentModificationException - if a concurrency conflict occurs while the Iterator is active.