GfSE / SpecIF

Specification Integration Facility - schema, constraint checker and examples
Apache License 2.0
15 stars 6 forks source link

Introduce 'alternativeIds' #26

Closed odungern closed 4 years ago

odungern commented 4 years ago

When merging models from different tools, the same element has different ids with all likelyhood. We should keep track of original ids, which can be used for searching or updating. As there can be more than one original id, it should be a list.

oalt commented 4 years ago

I agree with this proposal.

odungern commented 4 years ago

In Telco on 2020-01-29 approved. Discussion came up on whether it is useful to include other information such as projectId or tool-name. In this case, the property name could/should be 'sources'. In the end: Yes, there are possible use-cases, but no concrete requirement.

odungern commented 4 years ago

We will implement the option to specify a string specifying an identifier or an object with a mandatory attribute 'id' and other optional information such as 'project'. Implemented with schema v1.0.0, but the constraint check is still to be enhanced.

odungern commented 4 years ago

Just thinking: The consolidation of a resource in the course of integrating two models is conceptually the same as merging two branches. Therefore it is an idea to add the id/key of a consolidated resource to the 'replaces' list instead of an 'alternativeIds' list. However, a consolidated resource is only added to the 'replaces' list once. In contrast, the 'alternativeIds' list keeps the keys of all consolidated resources 'forever', so they can be used to easily find the correct resource in case of an update.

odungern commented 4 years ago

The merge of two branches of the same model and the integration of two different models is similar, but not the same, however:

oeichmann commented 4 years ago

Concerning the merge of two branches I agree. The item with the older revision should be replaced by the newer one. For bidirectional traceability it is important to keep the ID that was used in the initial model as alternativeid. I would suggest to store the corresponding model or project ID. In case there are multiple initial models, alternativeids can be allocated to the respective models.

odungern commented 4 years ago

Yes, I agree. The current idea ist to allow both simple IDs (strings) or JSON-Objects with several properties, which must include the id of the merged model element and may include revision, project-id and perhaps other properties;

Schema:

    "alternativeIds": {
      "description": "The list of consolidated items which can be used in case a consolidated item shall be updated.",
      "type": "array",
      "items": {
        "description": "A list of pointers to resources resp statements which have been merged to this one.",
        "oneOf": [{
          "description": "A string with a valid identifier of a model-element; where the last revision (i.e. revision=0) is implied.",
          "$ref": "#/definitions/id"
        }, {
          "type": "object",
          "properties": {
            "id": {
              "description": "A string with a valid identifier of a model-element",
              "$ref": "#/definitions/id"
            },
            "revision": {
              "$ref": "#/definitions/revision"
            },
            "project": {
              "description": "A string with a valid project identifier",
              "$ref": "#/definitions/id"
            }
          },
          "required": [ "id" ]
        }]
      }
    },
odungern commented 4 years ago

Implemented in schema v1.0.0, no need for any consistency check.