Accelerate the Value of Data

Overriding a Nested Attribute

When a nested attribute with a value has two crosswalks, it may happen that after a crosswalk is updated it can have two values instead of one.

This is an acceptable behavior and can occur during both full and partial overrides.

For example, you have an entity of SomeEntityType with one value of a SomeNestedAttribute attribute, that has two crosswalks:

Examples

{
  "uri": "entities/00005KL",
  "type": "configuration/entityTypes/SomeEntityType",
  "attributes": {
    "SomeNestedAttribute": [
      {
        "value": {
          "SomeSubNestedAttribute001": [
            {
              "uri": "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute001/2",
              "type": "configuration/entityTypes/SomeEntityType/attributes/SomeNestedAttribute/attributes/SomeSubNestedAttribute001",
              "value": "SomeSubNestedAttribute001Value"
            }
          ],
          "SomeSubNestedAttribute002": [
            {
              "uri": "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute002/3",
              "type": "configuration/entityTypes/SomeEntityType/attributes/SomeNestedAttribute/attributes/SomeSubNestedAttribute002",
              "value": "SomeSubNestedAttribute002Value"
            }
          ],
          "SomeSubNestedAttribute003": [
            {
              "uri": "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute003/4",
              "type": "configuration/entityTypes/SomeEntityType/attributes/SomeNestedAttribute/attributes/SomeSubNestedAttribute003",
              "value": "SomeSubNestedAttribute003Value"
            }
          ]
        },
        "uri": "entities/00005KL/attributes/SomeNestedAttribute/1"
      }
    ]
  },
  "crosswalks": [
    {
      "uri": "entities/00005KL/crosswalks/4",
      "type": "configuration/sources/SRC_SYS_001",
      "value": "someEntity001",
      "attributes": [
        "entities/00005KL/attributes/SomeNestedAttribute/1",
        "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute001/2",
        "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute002/3",
        "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute003/4"
      ]
    },
    {
      "uri": "entities/00005KL/crosswalks/5",
      "type": "configuration/sources/SRC_SYS_002",
      "value": "someEntity002",
      "attributes": [
        "entities/00005KL/attributes/SomeNestedAttribute/1",
        "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute001/2",
        "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute002/3",
        "entities/00005KL/attributes/SomeNestedAttribute/1/SomeSubNestedAttribute003/4"
      ]
    }
  ]
}

Send a request to change the value of SomeSubNestedAttribute003 nested sub-attribute for the crosswalk of an SRC_SYS_001 type:


  {
  "type": "configuration/entityTypes/SomeEntityType",
  "attributes": {
    "SomeNestedAttribute": [
      {
        "value": {
          "SomeSubNestedAttribute001": [
            {
              "value": "SomeSubNestedAttribute001Value"
            }
          ],
          "SomeSubNestedAttribute002": [
            {
              "value": "SomeSubNestedAttribute002Value"
            }
          ],
          "SomeSubNestedAttribute003": [
            {
              "value": "NewSomeSubNestedAttribute003Value"
            }
          ]
        }
      }
    ]
  },
  "crosswalks": [
    {
      "type": "configuration/sources/SRC_SYS_001",
      "value": "someEntity001"
    }
  ]
}
With a simple business configuration (without the usage of matchFieldURIs and keyAttributeURIs sections), we will have two values for SomeNestedAttribute:
  1. During the full override, the system finds an existing entity and takes a slice of this entity for the incoming crosswalk. It removes all the attributes from this slice, and inserts incoming attributes into the entity.

    In the example, the system finds an existing entity entities/00005KL, takes a slice of this entity for the incoming crosswalk of an SRC_SYS_001 type. It removes the existing value of a SomeNestedAttribute attribute from the slice, and inserts a new incoming nested attribute into the existing entity. As a result, the entity will have two crosswalks and two values of SomeNestedAttribute attribute. The first attribute belongs to the crosswalk of an SRC_SYS_001 type whereas, the other belongs to the crosswalk of an SRC_SYS_002 type.

  2. During the partial override, the system does not remove any existing nested attribute. It finds an existing entity, takes a slice of this entity for the incoming crosswalk. It uses keyAttributeURIs to find an existing value that must be updated. In case it is not able to find such a value, it inserts a new one.

    In the example mentioned above, the system finds an existing entity entities/00005KL and takes a slice of this entity for the incoming crosswalk of an SRC_SYS_001 type. As the keyAttributeURIs is not set in the configuration, the system is not able to find a value of the nested attribute that must be updated. So, it inserts a new value of SomeNestedAttribute. As a result, the entity will have two crosswalks and two values of a SomeNestedAttribute attribute. The first value is an existing unmodified value which belongs to both existing crosswalks of SRC_SYS_001 and SRC_SYS_002 types. The second one is the new incoming value, which belongs only to the crosswalk of an SRC_SYS_001 type.

By changing the business configuration you can have one value of a nested attribute after the update:
  1. For the full override, you must specify matchFieldURIs in a configuration, such that it does not contain a modified attribute (SomeSubNestedAttribute003).

    For example, you can specify SomeSubNestedAttribute001 and SomeSubNestedAttribute002 inside the matchFieldURIs section. After the update, two values are collapsed into one as they have the same values for SomeSubNestedAttribute001 and SomeSubNestedAttribute002 attributes.

  2. For the partial override, you have to specify keyAttributeURIs in a configuration, such that it does not contain a modified attribute (SomeSubNestedAttribute003).

    For example, you can specify SomeSubNestedAttribute001 inside the keyAttributeURIs section. During the update, the platform finds the existing nested attribute value in the specified SomeSubNestedAttribute001 and updates it.