Package org.eclipse.rdf4j.spring.dao.support

## Class RelationMapBuilder

- java.lang.Object
- - org.eclipse.rdf4j.spring.dao.support.RelationMapBuilder

-     public class RelationMapBuilder
      extends Object

  Since:
    4.0.0
  Author:
    Florian Kleedorfer

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static Variable` | `_relObject` |
    `static Variable` | `_relSubject` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RelationMapBuilder​(RDF4JTemplate rdf4JTemplate, RdfPredicate predicate)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Map<IRI,​Set<IRI>>` | `buildOneToMany()` | Builds a One-to-Many Map using the configuration of this builder.
    `Map<IRI,​IRI>` | `buildOneToOne()` | Builds a One-to-One Map using the configuration of this builder.
    `RelationMapBuilder` | `constraints​(GraphPattern... constraints)` | Constrains the result iff the `GraphPattern` contains the variables `_relSubject` and/or `_relObject`, which are the variables in the triple with the `RdfPredicate` specified in the constructor.
    `RelationMapBuilder` | `relationIsOptional()` | Indicates that the existence of the triple is not required, allowing to use the constraints to select certain subjects and to answer the mapping to an empty Set in the `buildOneToMany()` case and `NOTHING` in the `buildOneToOne()` case.
    `RelationMapBuilder` | `useRelationObjectAsKey()` | Indicates that the builder should use the triple's object for the key in the resulting `Map` instead of the subject (the default).
    `RelationMapBuilder` | `withBinding​(String key, Boolean value)` |
    `RelationMapBuilder` | `withBinding​(String key, Double value)` |
    `RelationMapBuilder` | `withBinding​(String key, Float value)` |
    `RelationMapBuilder` | `withBinding​(String key, Integer value)` |
    `RelationMapBuilder` | `withBinding​(String key, String value)` |
    `RelationMapBuilder` | `withBinding​(String key, IRI value)` |
    `RelationMapBuilder` | `withBinding​(String key, Value value)` |
    `RelationMapBuilder` | `withBinding​(Variable key, Boolean value)` |
    `RelationMapBuilder` | `withBinding​(Variable key, Double value)` |
    `RelationMapBuilder` | `withBinding​(Variable key, Float value)` |
    `RelationMapBuilder` | `withBinding​(Variable key, Integer value)` |
    `RelationMapBuilder` | `withBinding​(Variable key, String value)` |
    `RelationMapBuilder` | `withBinding​(Variable key, IRI value)` |
    `RelationMapBuilder` | `withBinding​(Variable key, Value value)` |
    `RelationMapBuilder` | `withBindingMaybe​(String key, Boolean value)` |
    `RelationMapBuilder` | `withBindingMaybe​(String key, Double value)` |
    `RelationMapBuilder` | `withBindingMaybe​(String key, Float value)` |
    `RelationMapBuilder` | `withBindingMaybe​(String key, Integer value)` |
    `RelationMapBuilder` | `withBindingMaybe​(String key, String value)` |
    `RelationMapBuilder` | `withBindingMaybe​(String key, IRI value)` |
    `RelationMapBuilder` | `withBindingMaybe​(String key, Value value)` |
    `RelationMapBuilder` | `withBindingMaybe​(Variable key, Boolean value)` |
    `RelationMapBuilder` | `withBindingMaybe​(Variable var, Double value)` |
    `RelationMapBuilder` | `withBindingMaybe​(Variable key, Float value)` |
    `RelationMapBuilder` | `withBindingMaybe​(Variable key, Integer value)` |
    `RelationMapBuilder` | `withBindingMaybe​(Variable key, String value)` |
    `RelationMapBuilder` | `withBindingMaybe​(Variable key, IRI value)` |
    `RelationMapBuilder` | `withBindingMaybe​(Variable key, Value value)` |

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

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

- - ### Field Detail

    - #### _relSubject

          public static final Variable _relSubject

    - #### _relObject

          public static final Variable _relObject

  - ### Constructor Detail

    - #### RelationMapBuilder

          public RelationMapBuilder​(RDF4JTemplate rdf4JTemplate,
                                    RdfPredicate predicate)

  - ### Method Detail

    - #### constraints

          public RelationMapBuilder constraints​(GraphPattern... constraints)

      Constrains the result iff the `GraphPattern` contains the variables `_relSubject` and/or `_relObject`, which are the variables in the triple with the `RdfPredicate` specified in the constructor.

    - #### relationIsOptional

          public RelationMapBuilder relationIsOptional()

      Indicates that the existence of the triple is not required, allowing to use the constraints to select certain subjects and to answer the mapping to an empty Set in the `buildOneToMany()` case and `NOTHING` in the `buildOneToOne()` case.
      Returns:
        the builder

    - #### useRelationObjectAsKey

          public RelationMapBuilder useRelationObjectAsKey()

      Indicates that the builder should use the triple's object for the key in the resulting `Map` instead of the subject (the default).

    - #### buildOneToOne

          public Map<IRI,​IRI> buildOneToOne()

      Builds a One-to-One Map using the configuration of this builder. Throws an Exception if more than one values are found for a given key. If `isRelationOptional` is `true` and no triple is found for the key, `NOTHING` is set as the value.

    - #### buildOneToMany

          public Map<IRI,​Set<IRI>> buildOneToMany()

      Builds a One-to-Many Map using the configuration of this builder.

    - #### withBinding

          public RelationMapBuilder withBinding​(Variable key,
                                                Value value)

    - #### withBinding

          public RelationMapBuilder withBinding​(String key,
                                                Value value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(Variable key,
                                                     Value value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(String key,
                                                     Value value)

    - #### withBinding

          public RelationMapBuilder withBinding​(Variable key,
                                                IRI value)

    - #### withBinding

          public RelationMapBuilder withBinding​(String key,
                                                IRI value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(Variable key,
                                                     IRI value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(Variable key,
                                                     String value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(String key,
                                                     IRI value)

    - #### withBinding

          public RelationMapBuilder withBinding​(Variable key,
                                                String value)

    - #### withBinding

          public RelationMapBuilder withBinding​(String key,
                                                String value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(String key,
                                                     String value)

    - #### withBinding

          public RelationMapBuilder withBinding​(Variable key,
                                                Integer value)

    - #### withBinding

          public RelationMapBuilder withBinding​(String key,
                                                Integer value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(Variable key,
                                                     Integer value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(String key,
                                                     Integer value)

    - #### withBinding

          public RelationMapBuilder withBinding​(Variable key,
                                                Boolean value)

    - #### withBinding

          public RelationMapBuilder withBinding​(String key,
                                                Boolean value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(Variable key,
                                                     Boolean value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(String key,
                                                     Boolean value)

    - #### withBinding

          public RelationMapBuilder withBinding​(Variable key,
                                                Float value)

    - #### withBinding

          public RelationMapBuilder withBinding​(String key,
                                                Float value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(Variable key,
                                                     Float value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(String key,
                                                     Float value)

    - #### withBinding

          public RelationMapBuilder withBinding​(Variable key,
                                                Double value)

    - #### withBinding

          public RelationMapBuilder withBinding​(String key,
                                                Double value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(Variable var,
                                                     Double value)

    - #### withBindingMaybe

          public RelationMapBuilder withBindingMaybe​(String key,
                                                     Double value)