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.
| 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 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 |
generateIfNotEmpty | Attribute | If true, the value is generated even if a value is 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 |
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
- Analyze
generateIfEmptyandgenerateIfNotEmptyflags for a particular attribute. - Compare the attribute state (exists or not) in the current request with the provided flags.
- Trigger the generation based on the flags and attribute state. If the generation
is triggered, analyze the
generatedValueUniqueForCrosswalkflag. If it is false, generate regardless of the stored object. When it'strue, try to find the attribute in the saved object.- If the found attribute belongs to the current crosswalk, the stored value of an attribute is reused.
- 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
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
{
"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
- All immediate parents of the auto-generated attribute are found in current request.
- The auto-generated attribute is generated in each parent.
- If the
generatedValueUniqueForCrosswalkistrue, 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.
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
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
| 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
| 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
| 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
| Value was Sent | Value by Crosswalk Exists | Reaction |
|---|---|---|
| Does not matter | Does not matter | Nothing is generated. |
generatedValueUniqueForCrosswalk= False:,generateIfEmpty = True, and generateIfNotEmpty= True
| 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
| 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
| 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
| 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.
| Value was Sent | Reaction |
|---|---|
| No | Generate a new crosswalk value. |
| Yes | Reuse the crosswalk value that was saved. |
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":""
}
]
},
...
]