org.eclipse.rdf4j.model.impl

## Class SimpleTriple

- java.lang.Object
- - org.eclipse.rdf4j.model.impl.SimpleTriple

- All Implemented Interfaces:
    Serializable, Resource, Triple, Value

      public class SimpleTriple
      extends Object
      implements Triple

  A simple default implementation of the `Triple` interface.
  Author:
    Pavel Mihaylov
  See Also:
    `SimpleValueFactory`, Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SimpleTriple(Resource subject, IRI predicate, Value object)` Creates a new Triple with the supplied subject, predicate and object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `Value` | `getObject()` Gets the object of this triple.
    `IRI` | `getPredicate()` Gets the predicate of this triple.
    `Resource` | `getSubject()` Gets the subject of this triple.
    `int` | `hashCode()`
    `String` | `stringValue()` Returns the String-value of a `Value` object.
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleTriple

          protected SimpleTriple(Resource subject,
                                 IRI predicate,
                                 Value object)

      Creates a new Triple with the supplied subject, predicate and object.

      Note that creating SimpleStatement objects directly via this constructor is not the recommended approach. Instead, use an instance of `ValueFactory` to create new Triple objects.

      Parameters:
        `subject` - The triple's subject, must not be `null`.
        `predicate` - The triple's predicate, must not be `null`.
        `object` - The triple's object, must not be `null`.
      See Also:
        `SimpleValueFactory#createTriple(Resource, IRI, Value)`

  - ### Method Detail

    - #### getSubject

          public Resource getSubject()

      Description copied from interface: `Triple`
      Gets the subject of this triple.
      Specified by:
        `getSubject` in interface `Triple`
      Returns:
        The triple's subject.

    - #### getPredicate

          public IRI getPredicate()

      Description copied from interface: `Triple`
      Gets the predicate of this triple.
      Specified by:
        `getPredicate` in interface `Triple`
      Returns:
        The triple's predicate.

    - #### getObject

          public Value getObject()

      Description copied from interface: `Triple`
      Gets the object of this triple.
      Specified by:
        `getObject` in interface `Triple`
      Returns:
        The triple's object.

    - #### stringValue

          public String stringValue()

      Description copied from interface: `Value`
      Returns the String-value of a `Value` object. This returns either a `Literal`'s label, a `IRI`'s URI or a `BNode`'s ID.
      Specified by:
        `stringValue` in interface `Value`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

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