Unify and manage your data

Autogenerated IDs for simple and nested attributes

Learn how to configure autogenerated IDs for simple and nested attributes.

Unique IDs for attributes can be generated automatically to simplify data creation and ensure consistency. Autogenerated IDs support both simple and nested attributes. Use predefined generators and patterns to create IDs during request processing. This section explains how auto-generated IDs work for simple and nested attributes.

The following table describes how the Universal Unique Identifier (UUID) and sequential IDs are generated using the following properties:
Table 1. Properties
OptionApplies ToDescriptionDefault Value
autoGeneratedAttribute/SourceIf true, the value of the attribute/crosswalk is auto-generated. Use this to enable the feature.False
generateIfEmptyAttributeIf true, the value is generated only if a value is not sent in the request.
Note: You must send an empty string to generate a value. A null value is not considered an empty string and will not generate a value.
False
generateIfNotEmptyAttributeIf true, the value is generated even if a value is sent in the request.true
generatedValueUniqueForCrosswalkAttributeIf 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
generatorAttribute/sourceThe generator name.None
autoGenerationPatternSimple attribute/sourceTemplate for generating. The {value} is substituted by the generated value from the generator.None
autoGenerationNestedPatternNested attributeUsed to specify auto-generated patterns for simple sub-attributes.None
uniqueGeneratedValuePerEntityPerRequestEntityIf 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.

Attributes can be auto-generated for entities, relationships, and references, but the configuration depends on where the attributes originate. To auto-generate attributes from a relationship, the corresponding attributes must be marked as auto-generated in the relation type configuration, just as with simple or nested entity attributes. For attributes that come from a referenced entity or a referenced relationship, auto-generation must be configured directly in the referenced entity or relationship itself.

Reltio supports auto-generating IDs for reference attributes at creation time by assigning a generator in the reference attribute configuration; however, once generated, these reference IDs cannot be modified. Additionally, if a value of null is explicitly provided for an auto-generated field, it is treated as not empty. To ensure that a value is still auto-generated when null is specified, the generateIfNotEmpty flag must be set to true.

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 the 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.

Deeply Nested 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.
Note: If the object has more than one crosswalk with dataProvider as true, only one value is generated for the auto-generated attribute. This value belongs to all the dataProvider crosswalks.

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 SentValue by Crosswalk ExistsReaction
YesYesReuse existing value.
NoGenerate new value and save it instead of the value that was sent.
NoYesReuse existing value.
NoGenerate new value.
generatedValueUniqueForCrosswalk= True:,generateIfEmpty = True, and generateIfNotEmpty= False
Table 3. Behavior
Value was SentValue by Crosswalk ExistsReaction
YesDoesn't matterNothing is generated - the value from the request is saved in the object.
NoYesReuse existing value.
NoGenerate new value
generatedValueUniqueForCrosswalk= True:,generateIfEmpty = False, and generateIfNotEmpty= True
Table 4. Behavior
Value was SentValue by Crosswalk ExistsReaction
YesYesReuse existing value.
NoGenerate new value and save it instead of the value that was sent.
NoDoesn't matterNothing is generated.
generatedValueUniqueForCrosswalk= True:,generateIfEmpty = False, and generateIfNotEmpty= False
Table 5. Behavior
Value was SentValue by Crosswalk ExistsReaction
Does not matterDoes not matterNothing is generated.
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = True, and generateIfNotEmpty= True
Table 6. Behavior
Value was SentValue by Crosswalk ExistsReaction
YesDoes not matterGenerate new value and save it instead of the value that was sent.
NoGenerate a new value
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = True, and generateIfNotEmpty= False
Table 7. Behavior
Value was SentValue by Crosswalk ExistsReaction
YesDoes not matterNothing is generated.
NoGenerate a new value
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = False, and generateIfNotEmpty= True
Table 8. Behavior
Value was SentValue by Crosswalk ExistsReaction
YesDoes not matterGenerate new value and save it instead of the value that was sent.
NoNothing is generated.
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = False, and generateIfNotEmpty= False
Table 9. Behavior
Value was SentValue by Crosswalk ExistsReaction
Does not matter Does not matterNothing is generated.

For Crosswalks

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

Table 10. Behavior
Value was SentReaction
NoGenerate a new crosswalk value.
YesReuse 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":""
                  }
               ]
            },
        
...
]