org.eclipse.rdf4j.model.util

## Class Statements

- java.lang.Object
- - org.eclipse.rdf4j.model.util.Statements

-     public class Statements
      extends Object

  Utility methods for `Statement` objects.
  Author:
    Jeen Broekstra

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Statements()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `consume(ValueFactory vf, Resource subject, IRI predicate, Value object, java.util.function.Consumer<Statement> consumer, Resource... contexts)` Creates one or more `Statement` objects with the given subject, predicate and object, one for each given context, and sends each created statement to the supplied `Consumer`.
    `static <C extends Collection<Statement>> C` | `create(ValueFactory vf, Resource subject, IRI predicate, Value object, C collection, Resource... contexts)` Creates one or more `Statement` objects with the given subject, predicate and object, one for each given context.
    `static boolean` | `isSameTriple(Statement st1, Statement st2)` Checks if the two statements represent the same triple (that is, they have equal subject, predicate, and object).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Statements

          public Statements()

  - ### Method Detail

    - #### consume

          public static void consume(ValueFactory vf,
                                     Resource subject,
                                     IRI predicate,
                                     Value object,
                                     java.util.function.Consumer<Statement> consumer,
                                     Resource... contexts)

      Creates one or more `Statement` objects with the given subject, predicate and object, one for each given context, and sends each created statement to the supplied `Consumer`. If no context is supplied, only a single statement (without any assigned context) is created.
      Parameters:
        `vf` - the `ValueFactory` to use for creating statements.
        `subject` - the subject of each statement. May not be null.
        `predicate` - the predicate of each statement. May not be null.
        `object` - the object of each statement. May not be null.
        `consumer` - the `Consumer` function for the produced statements.
        `contexts` - the context(s) for which to produce statements. This argument is an optional vararg: leave it out completely to produce a single statement without context.

    - #### create

          public static <C extends Collection<Statement>> C create(ValueFactory vf,
                                                                   Resource subject,
                                                                   IRI predicate,
                                                                   Value object,
                                                                   C collection,
                                                                   Resource... contexts)

      Creates one or more `Statement` objects with the given subject, predicate and object, one for each given context. If no context is supplied, only a single statement (without any assigned context) is created.
      Parameters:
        `vf` - the `ValueFactory` to use for creating statements.
        `subject` - the subject of each statement. May not be null.
        `predicate` - the predicate of each statement. May not be null.
        `object` - the object of each statement. May not be null.
        `collection` - the collection of Statements to which the newly created Statements will be added. May not be null.
        `contexts` - the context(s) for which to produce statements. This argument is an optional vararg: leave it out completely to produce a single statement without context.
      Returns:
        the input collection of Statements, with the newly created Statements added.

    - #### isSameTriple

          public static boolean isSameTriple(Statement st1,
                                             Statement st2)

      Checks if the two statements represent the same triple (that is, they have equal subject, predicate, and object). Context information is disregarded.
      Parameters:
        `st1` - the first statement to compare. May not be null.
        `st2` - the second statement to compare. May not be null.
      Returns:
        `true` iff the subject, predicate and object of `st1` and `st2` are equal, `false` otherwise.
      Since:
        2.0
      See Also:
        `Statement.equals(Object)`

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.