Auto-generated IDs for Simple and Nested Attributes

Reltio allows you to configure reference attributes for auto-generated IDs.

To make attributes from a relation auto-generated, attributes from the appropriate relation type must be defined as auto-generated in the same way, as for simple and nested attributes of the entity. To make attributes from referenced entity auto-generated, attributes must be marked as auto-generated directly in the referenced type configuration.

Auto-generated IDs

Unique IDs for attributes can be generated automatically. The feature is available for simple and nested attributes. This section describes auto-generated IDs for simple and nested attributes.

Note: Changes to auto-generated IDs for reference attributes are not supported.

The following table describes how the Universal Unique Identifier (UUID) and sequential IDs are generated using the following properties:

Table 1. Properties
Option Applies To Description Default Value
autoGenerated Attribute/Source If true, the value of the attribute/crosswalk is auto-generated. Use this to enable the feature. False
generateIfEmpty Attribute If true, the value is generated if it was not sent in the request. False
generateIfNotEmpty Attribute If true, the value is generated if it was sent in the request. true
generatedValueUniqueForCrosswalk Attribute If true and the object is already stored, the existing value by same crosswalk in the request is reused instead of generating a new one. False
generator Attribute/source The generator name. None
autoGenerationPattern Simple attribute/source Template for generating. The {value} is substituted by the generated value from the generator. None
autoGenerationNestedPattern Nested attribute Used to specify auto-generated patterns for simple sub-attributes. None
uniqueGeneratedValuePerEntityPerRequest Entity If in the entity more than one auto-generated attribute/crosswalk are defined with the same generator and this property is set to true, only one value is generated for all those attributes per request. False
Note: To generate an ID for any attribute, its parent attribute must exist. If an attribute is at the first level of an entity/relation, it is always enabled for generation.

Simplified Algorithm of Generating Attributes

  1. Analyze generateIfEmpty and generateIfNotEmpty flags for a particular attribute.
  2. Compare the attribute state (exists or not) in the current request with the provided flags.
  3. Trigger the generation based on the flags and attribute state. If the generation is triggered, analyze the generatedValueUniqueForCrosswalk flag. If it is false, generate regardless of the stored object. When it's true, try to find the attribute in the saved object.
    1. If the found attribute belongs to the current crosswalk, the stored value of an attribute is reused.
    2. If attribute is not found or does not belong to the current crosswalk, a new value is generated.

Simple Attribute

For generating a simple attribute, the autoGenerationPattern property is required. If this property does not contain a {value}, it's considered as auto-generated with a fixed pattern (no generator is used for generating the value). The data type of a simple attribute must be consistent with the autoGenerationPattern property. For example, if the data type is Int, then autoGenerationPattern=idx_{value} is invalid because it produces a value that cannot be converted to Int.

Nested Attribute

For generating a nested attribute, the autoGenerationNestedPattern property is required.
"autoGenerationNestedPattern":{ 
                                "Type":"AUTO",
                                "ID":"{value}"
                               }

It generates the entire nested attribute with the sub-attributes, Type and ID.

Deepnested Attribute Structure Generation

You can generate a tree hierarchy attribute structure as follows:
{
  "attributes": [
    {
      "uri": "configuration/entityTypes/Object/attributes/Nested1",
      "name": "Nested1",
      "type": "Nested",
      "autoGenerated": true,
      "generateIfEmpty": true,
      "generateIfNotEmpty": true,
      "generator": "Seq_generator",
      "autoGenerationNestedPattern": {
        "ID1": "id1_{value}"
      },
      "attributes": [
        {
          "uri": "configuration/entityTypes/Object/attributes/Nested1/attributes/ID1",
          "name": "ID1",
          "type": "String"
        },
        {
          "uri": "configuration/entityTypes/Object/attributes/Nested1/attributes/Nested2",
          "name": "Nested2",
          "type": "Nested",
          "autoGenerated": true,
          "generateIfEmpty": true,
          "generateIfNotEmpty": true,
          "generator": "Seq_generator",
          "autoGenerationNestedPattern": {
            "ID2": "id2_{value}"
          },
          "attributes": [
            {
              "uri": "configuration/entityTypes/Object/attributes/Nested1/attributes/Nested2/attributes/ID2",
              "name": "ID2",
              "type": "String"
            }
          ]
        }
      ]
    }
  ]
}

Attribute at a Deeper Level of a Nest

If the simple or nested attribute is auto-generated and located inside some nested attribute, then:
  • All immediate parents of the auto-generated attribute are found in current request.
  • The auto-generated attribute is generated in each parent.
  • If the generatedValueUniqueForCrosswalk is true, it tries to find the parent in the stored object and reuse the value of its sub attribute only if the parent is at the current level.

ID Generation Behavior for Attributes and Crosswalks

For Attributes

Note: If the object is sent with more than one crosswalk for which dataProvider=true, only one value is generated for the auto-generated attribute and this value belongs to all dataProvider crosswalks.

The behavior of the ID generation for attributes is as follows:

generatedValueUniqueForCrosswalk= True:,generateIfEmpty = True, and generateIfNotEmpty= True
Table 2. Behavior
Value was Sent Value by Crosswalk Exists Reaction
Yes Yes Reuse existing value.
No Generate new value and save it instead of the value that was sent.
No Yes Reuse existing value.
No Generate new value.
generatedValueUniqueForCrosswalk= True:,generateIfEmpty = True, and generateIfNotEmpty= False
Table 3. Behavior
Value was Sent Value by Crosswalk Exists Reaction
Yes Doesn't matter Nothing is generated - the value from the request is saved in the object.
No Yes Reuse existing value.
No Generate new value
generatedValueUniqueForCrosswalk= True:,generateIfEmpty = False, and generateIfNotEmpty= True
Table 4. Behavior
Value was Sent Value by Crosswalk Exists Reaction
Yes Yes Reuse existing value.
No Generate new value and save it instead of the value that was sent.
No Doesn't matter Nothing is generated.
generatedValueUniqueForCrosswalk= True:,generateIfEmpty = False, and generateIfNotEmpty= False
Table 5. Behavior
Value was Sent Value by Crosswalk Exists Reaction
Does not matter Does not matter Nothing is generated.
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = True, and generateIfNotEmpty= True
Table 6. Behavior
Value was Sent Value by Crosswalk Exists Reaction
Yes Does not matter Generate new value and save it instead of the value that was sent.
No   Generate a new value
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = True, and generateIfNotEmpty= False
Table 7. Behavior
Value was Sent Value by Crosswalk Exists Reaction
Yes Does not matter Nothing is generated.
No   Generate a new value
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = False, and generateIfNotEmpty= True
Table 8. Behavior
Value was Sent Value by Crosswalk Exists Reaction
Yes Does not matter Generate new value and save it instead of the value that was sent.
No   Nothing is generated.
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = False, and generateIfNotEmpty= False
Table 9. Behavior
Value was Sent Value by Crosswalk Exists Reaction
Does not matter Does not matter Nothing is generated.

For Crosswalks

For crosswalks, the behavior depends on whether the value was sent or not.

Table 10. Behavior
Value was Sent Reaction
No Generate a new crosswalk value.
Yes Reuse the crosswalk value that was saved.
Note: If the send object does not exist, the value of the auto-generated crosswalk is generated. If the send object already exists, the value of the auto-generated crosswalk with the same source type is reused.

Creation of Auto-generated Simple Attributes

"attributes":[ 
            { 
               "uri":"configuration/entityTypes/Object/attributes/AutoGeneratedSimple",
               "name":"AutoGeneratedSimple",
               "label":"Auto-generated Simple",
               "type":"String",
               "autoGenerated":true,
               "generateIfEmpty":true,
               "generatedValueUniqueForCrosswalk":true,
               "generator":"UUID4_generator",
               "autoGenerationPattern":"Simple_{value}"
            },
...
]

Creation of Auto-generated Nested Attributes

"attributes":[ 
            { 
               "uri":"configuration/entityTypes/Object/attributes/AutoGeneratedNested",
               "name":"AutoGeneratedNested",
               "label":"Auto-generated Nested",
               "type":"Nested",
               "autoGenerated":true,
               "generateIfEmpty":true,
               "generatedValueUniqueForCrosswalk":true,
               "generator":"UUID4_generator",
               "autoGenerationNestedPattern":{ 
                  "Type":"AUTO",
                  "ID":"{value}"
               },
               "attributes":[ 
                  { 
                     "uri":"configuration/entityTypes/Object/attributes/AutoGeneratedForcedNested/attributes/Type",
                     "name":"Type",
                     "label":"Type",
                     "type":"String",
                     "description":""
                  },
                  { 
                     "uri":"configuration/entityTypes/Object/attributes/AutoGeneratedForcedNested/attributes/ID",
                     "name":"ID",
                     "label":"ID",
                     "type":"String",
                     "description":""
                  }
               ]
            },
        
...
]