In our application we have a document graph consisting of a 1-to-n relationship. The relationship regarding the role order for example looks like this:
source_role_id source_docref source_role_order target_role_id target_docref target_role_order
-------------- ---------------------------------------------- -------------------------------------------------------------------------------- -------------- ------------------------------------------------ --------------------------------------------------------------------------------
90495 Buffet-DM/cd1727c6-9fd3-46f8-9e23-ebb4a90ac9d7 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss 90496 Category-DM/8225f1c0-3bee-471c-87f9-887edc3e6d44 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
90497 Buffet-DM/cd1727c6-9fd3-46f8-9e23-ebb4a90ac9d7 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst 90498 Category-DM/a280096e-3a3f-4e75-a5ed-6714375ee7ae ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst
90499 Buffet-DM/cd1727c6-9fd3-46f8-9e23-ebb4a90ac9d7 sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssu 90500 Category-DM/710a4095-faca-4087-b497-b6d9fadd8c08 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst
A business operation in our application creates a copy of this document graph. The relationship data of a copy looks like this:
source_role_id source_docref source_role_order target_role_id target_docref target_role_order
-------------- ---------------------------------------------- -------------------------------------------------------------------------------- -------------- ------------------------------------------------ --------------------------------------------------------------------------------
90513 Buffet-DM/63ca149f-e664-4b81-8922-ded91db66b92 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss 90514 Category-DM/d06a12c8-da2c-4b58-9a84-ef23b4126c3a ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
90515 Buffet-DM/63ca149f-e664-4b81-8922-ded91db66b92 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst 90516 Category-DM/afa4cc2e-4261-49d1-aa0e-75e8b2362800 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst
90517 Buffet-DM/63ca149f-e664-4b81-8922-ded91db66b92 sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssu 90518 Category-DM/2368b8f4-ab16-449d-83d0-8c088b7f083a ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst
We use the following code to create the relationships:
var entities = List.of(
new RelationshipRoleSpec(sourceRole, copiedSourceDocRef),
new RelationshipRoleSpec(targetRole, copiedTargetDocument.getMetadata().getDocRef())
);
var linkDescriptor = new LinkDescriptor(relationshipModelName, entities, LinkPosition.BOTTOM);
relationshipLinkService.create(linkDescriptor);
consecutively within one transaction where copiedTargetDocument.getMetadata().getDocRef() yields
Category-DM/d06a12c8-da2c-4b58-9a84-ef23b4126c3aCategory-DM/afa4cc2e-4261-49d1-aa0e-75e8b2362800Category-DM/2368b8f4-ab16-449d-83d0-8c088b7f083a
respectively.
Why does the target_role_order of the last Category_DM (last character is t instead of u and therefore making it equal to the value of the value of the second Category_DM) differ between the original relationship and the copied one? Does that difference even matter? How should a relationship be copied to get the same results between original and copy?
The original relation was created using rpc operations like
{
"method": "ADD_LINK",
"jsonrpc": "2.0",
"id": "CONTENT_ENGINE_SERVER_CONNECTOR/ADD_LINK/1",
"params": {
"linkDescriptor": {
"relationshipModel": "BuffetCategoriesRM",
"entities": [
{
"role": "Buffet",
"docRef": "Buffet-DM/cd1727c6-9fd3-46f8-9e23-ebb4a90ac9d7"
},
{
"role": "Category",
"docRef": "#{#ADD_CATEGORY_OPERATION.docRef}"
}
],
"position": "BOTTOM"
}
}
}