...
If a parent and its child are updated, then both of them should be reported as 2 separate update operations. This is because when comparing data nodes that have been updated, it is not possible to maintain the parent-child relation of the 2 data nodes as explained above.
Expand |
---|
title | Example Source and Target Data |
---|
|
action "update",xpath/parentsourceData["leaf-2 data",
"child": {
"child-1 data": " |
|
oldchild-1 data",
"child-2 data": "child-2 data"
|
|
}],"targetData": {dataupdated}
]"leaf-2": "leaf-2 updated data",
|
|
},actionupdate"xpath/parent/child","sourceData":[{ |
Expand |
---|
|
Code Block |
---|
[
{
"dataaction": "old dataupdate",
}
]"xpath": "/parent",
"targetDatasourceData": [
{
"dataleaf-2": "updatedleaf-2 data"
}
],
}
] |
|
Scenario 2: Parent is updated, child is added or removed
In a scenario where parent node is updated and its child node either added or removed, then in such a scenario each node must be reported separately and grouped based on their respective operation. For example, if a parent is updated and 2 child nodes are either added. Then the delta report should have 2 entries, first an update entry containing details of the updated parent node and the second a create entry containing both the child nodes, grouped together.
Expand |
---|
|
Code Block |
---|
[
{
"action": "update",
"xpath": "/parent""targetData": [
{
"leaf-2": "leaf-2 updated data"
}
]
},
{
"action": "update",
"xpath": "/parent/child",
"sourceData": [
{
"child-1 data": "child-1 data"
}
],
"sourceDatatargetData": [
{
"child-1 data": "oldchild-1 updated data"
}
],
"targetData": [
{
"data": "updated data"
}
]
},
{
"action": "create",
"xpath": "/parent/child",
"targetData": [
{
"data": "child data",}
] |
|
Scenario 2: Parent is updated, child is added or removed
In a scenario where parent node is updated and its child node either added or removed, then in such a scenario each node must be reported separately and grouped based on their respective operation. For example, if a parent is updated and 2 child nodes are either added. Then the delta report should have 2 entries, first an update entry containing details of the updated parent node and the second a create entry containing both the child nodes, grouped together.
Expand |
---|
title | Example Source and Target Data |
---|
|
Source Data | Target Data |
---|
Code Block |
---|
[
{
"parent": {
|
|
grandchild[
{"leaf-2": "leaf-2 data"
}
}
] |
| |
"data":"grandchilddata" }
]
"leaf-2": "leaf-2 updated data",
|
|
}]}
] |
Scenario 3: Parent is updated, child 1 is added or removed, child 2 is updated (Siblings scenario) 
If the parent and one of its children are updated while another child is added or removed then in such a case, the parent and updated child will be reported individually as two update operations while the added/removed child would be reported as a separate create/remove operation.
Expand |
---|
|
Code Block | [
{
"action": "update",
"xpath": "/parent",
"sourceData": [
{
"data": "old data"
}
]"child-1 data": "child-1 data",
"grand-child": [
{
"data": "grandchild data"
}
]
}
}
}
] |
|
|
Expand |
---|
|
Code Block |
---|
[
{
"action": "update",
"xpath": "/parent",
"targetDatasourceData": [
{
"dataleaf-2": "updatedleaf-2 data"
}
],
}, "targetData": [
{ {
"action": "update", "xpathleaf-2": "/parent/childleaf-2 updated data",
"sourceData": [}
]
{ },
{
"dataaction": "old datacreate",
}
]"xpath": "/parent/child",
"targetData": [
{
"child-1 data": "updatedchild-1 data",
}"grand-child": [
] }, {
"action": "update", "xpathdata": "/parent/child-3",grandchild data"
"sourceData": [ }
{ "data": "old data"]
}
],
"targetData": [
{
"data": "updated data"
}
]
},
{
"action": "create",
"xpath": "/parent/child-1",}
] |
|
Scenario 3: Parent is updated, child 1 is added or removed, child 2 is updated (Siblings scenario) 
If the parent and one of its children are updated while another child is added or removed then in such a case, the parent and updated child will be reported individually as two update operations while the added/removed child would be reported as a separate create/remove operation.
Expand |
---|
title | Example Source and Target Data |
---|
|
Expand |
---|
title | ExampletargetData[
datachild grandchild[
"grandchild
}]}
] |
---|
Scenario 4: Parent is updated, child remains unchanged, grandchild is updated
This is another scenario which justifies the proposal that every update operation should be reported separately, because if a parent and its grandchild are updated while the child node is unchanged, then maintaining the parent-child-grandchild relation and the original JSON/XML structure in the delta report becomes impossible because the delta report will not contain any information about the child node as it was not updated. Hence making the grouping operation impossible in such a scenario.
"leaf-1": "leaf-1 data",
"leaf-2": "leaf-2 updated data",
"child-1": {
"child-1 data": "child-1 data"
},
"child-2": {
"child-2 data": "child-2 data updated"
}
}
}
] |
|
|
Expand |
---|
|
Code Block |
---|
[
{
"action": "update",
"xpath": "/parent",
"sourceData": [
{
"leaf-2": "leaf-2 data"
}
],
"targetData": [
{
"leaf-2": "leaf-2 updated data"
}
]
},
{
"action": "update",
"xpath": "/parent/child-2",
"sourceData": [
{
"child-2 data": "child-2 data"
}
],
"targetData": [
{
"child-2 data": "child-2 data updated"
}
]
},
{
"action": "create",
"xpath": "/parent/child-1",
"targetData": [
{
"child-1": {
"child-1 data": "child-1 data"
}
}
]
}
] |
|
Scenario 4: Parent is updated, child remains unchanged, grandchild is updated
This is another scenario which justifies the proposal that every update operation should be reported separately, because if a parent and its grandchild are updated while the child node is unchanged, then maintaining the parent-child-grandchild relation and the original JSON/XML structure in the delta report becomes impossible because the delta report will not contain any information about the child node as it was not updated. Hence making the grouping operation impossible in such a scenario.
Expand |
---|
title | Example Source and Target Data |
---|
|
Source Data | Target Data |
---|
Code Block |
---|
[
{
"parent": {
"leaf-1": "leaf-1 data",
"leaf-2": "leaf-2 data",
"child": {
"child-1 data": "child-1 data",
"grand-child": [
{
"data": "grandchild data"
}
]
}
}
}
] |
| Code Block |
---|
[
{
"parent": {
"leaf-1": "leaf-1 data",
"leaf-2": "leaf-2 updated data",
"child": {
"child-1 data": "child-1 data",
"grand-child": [
{
"data": "grandchild data updated"
}
]
}
}
}
] |
|
|
Expand |
---|
|
Code Block |
---|
[
{
"action": "update",
"xpath": "/parent",
"sourceData": [
{
"dataleaf-2": "oldleaf-2 data"
}
],
"targetData": [
{
"dataleaf-2": "leaf-2 updated data"
}
]
},
{
"action": "update",
"xpath": "/parent/grandchild",
"sourceData": [
{
"data": "oldgrandchild data"
}
],
"targetData": [
{
"data": "updatedgrandchild data updated"
}
]
}
] |
|