In the serialization format, for properties of an enum type, we refer to the key of the literal.
Options
Option A: Refer to the literal's key
Pro:
- Stable across different repositories
- Stable against renamed literals
Con:
- Cannot interpret the property without the metamodel
Option B: Refer to the literal's id
Con:
- Cannot exchange M1 data between repositories, as they might use different ids for the M2 literal node.
- Cannot interpret the property without the metamodel
Option C: Refer to the literal's name
Pro:
- Property value easily understood without metamodel
Con:
- If the user changed the name of the literal, we cannot read older M1 instances any more.
Rationale
- The instance is on M1, the literal on M2. Every time we cross a meta-level, we use keys.
- Most stable
Example
Assume the following metamodel:
language Bank [key: AAA]
version: 1
concept Payment [key: aaa]
property amount: int [key: bbb]
property currency: Currency [key: ccc]
enum Currency [key: ddd]
literal EUR [key: eee]
literal USD [key: fff]
And the following instance:
Currency:
amount: 42
currency: EUR
The instance would be serialized as:
{
"nodes": [
{
"id": "111",
"concept": {
"language": "AAA",
"version": "1",
"key": "aaa"
},
"properties": [
{
"property": {
"language": "AAA",
"version": "1",
"key": "bbb"
},
"value": "42"
},
{
"property": {
"language": "AAA",
"version": "1",
"key": "ccc"
},
"value": "eee"
}
],
"children": [],
"references": [],
"parent": null
}
]
}
In the serialization format, for properties of an enum type, we refer to the key of the literal.
Options
Option A: Refer to the literal's key
Pro:
Con:
Option B: Refer to the literal's id
Con:
Option C: Refer to the literal's name
Pro:
Con:
Rationale
Example
Assume the following metamodel:
And the following instance:
The instance would be serialized as:
{ "nodes": [ { "id": "111", "concept": { "language": "AAA", "version": "1", "key": "aaa" }, "properties": [ { "property": { "language": "AAA", "version": "1", "key": "bbb" }, "value": "42" }, { "property": { "language": "AAA", "version": "1", "key": "ccc" }, "value": "eee" } ], "children": [], "references": [], "parent": null } ] }