Revision References¶
Node
and Link
elements may be referenced by other elements. Specifically, Nodes are referenced by Links and
Networks, while Links are referenced by Networks. Element updates or deletions have different effects, depending on
how those elements were referenced by other entities.
A specific element revision may be referenced:
{
"id": 1,
"revision": 10
}
Or the latest revision of an element may be referenced:
{
"id": 1
}
API Examples¶
Initial data¶
For the following examples, assume these two nodes exist:
{
"id": 1,
"revision": 10,
"properties": {
"_schema": "LossSet_1.0",
"cedant": "Company X",
"region": "Eastern US",
"internal_reference": "ABC123"
}
}
{
"id": 2,
"revision": 20,
"properties": {
"_schema": "LossSet_1.0",
"cedant": "Company Y",
"region": "Western US",
"internal_reference": "XYZ321",
}
}
We also assume Node 2 has been updated once, such that a second revision with the same ID exists:
{
"id": 2,
"revision": 21,
"properties": {
"_schema": "LossSet_1.0",
"cedant": "Updated company",
"region": "Updated region",
"internal_reference": "Updated reference",
}
}
Link creation¶
A link is created that references explicit revisions of Nodes 1 and 2.
Request¶
CreateLink(
source={
"id": 1,
"revision": 10
},
destination={
"id": 2,
"revision": 20
}
)
Response¶
{ "id": 3, "revision": 30 }
Link retrieval¶
When the link is retrieved, the same source/destination revisions it was created with are returned.
Request¶
ReadLink(
reference={
"id": 3,
"revision": 30
}
)
Response¶
{ "id": 3, "revision": 30, "source": { "id": 1, "revision": 10 }, "destination": { "id": 2, "revision": 20 } }
Link creation (latest reference)¶
When a link is created with no explicit node revisions, it implies that the link refers to the newest revisions of those nodes, whereever and whenever it is used.
Request¶
CreateLink(
source={
"id": 1
},
destination={
"id": 2
}
)
Response¶
{ "id": 4, "revision": 40 }
Link retrieval (latest reference)¶
When the link is retrieved, its contents are the latest revisions of the nodes it references.
Request¶
ReadLink(
reference={
"id": 4,
"revision": 40
}
)
Response¶
{ "id": 4, "revision": 40, "source": { "id": 1, "revision": 10 }, "destination": { "id": 2, "revision": 21 } }
Link retrieval (following update)¶
If one of the nodes is further updated, the link using no explicit revision reference will continue to refer to the latest node revisions.
UpdateNode(
"id": 2,
"properties": {
"_schema": "LossSet_1.0",
"cedant": "Another update",
"region": "Another update",
"internal_reference": "Another update"
}
)
{"id": 2, "revision": 22}
Request¶
ReadLink(
reference={
"id": 4,
"revision": 40
}
)
Response¶
{ "id": 4, "revision": 40, "source": { "id": 1, "revision": 10 }, "destination": { "id": 2, "revision": 22 } }