You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: metametamodel/metametamodel.adoc
+18-12
Original file line number
Diff line number
Diff line change
@@ -98,12 +98,12 @@ Language elements contained in a Language are allowed to refer to these other La
98
98
* within declared dependencies
99
99
* within _transitive_ dependencies.
100
100
+
101
-
Example: if Language B depends on Language A, and Language C depends on B, then Language C can also refer to members of Language A without explicitly declaring a dependency.
101
+
Example: if Language _B_ depends on Language _A_, and Language _C_ depends on _B_, then Language _C_ can also refer to members of Language _A_ without explicitly declaring a dependency.
102
102
103
103
A Language CAN declare a transitive dependency explicitly.
104
-
In the example above, Language C CAN declare an explicit dependency on Language A.
104
+
In the example above, Language _C_ CAN declare an explicit dependency on Language _A_.
105
105
106
-
##TODO: Dependency on builtins {fn-org153}##
106
+
As any Language depends (at least transitively and <<Concept.extends, implicitly>>) on <<stdlib>> elements, a Language CAN declare a dependency on builtins -- but _does not_ need to.{fn-org153}
107
107
108
108
[[Concept]]
109
109
==== Concept
@@ -139,12 +139,22 @@ A Concept `implements` zero or more <<ConceptInterface, ConceptInterfaces>>.
139
139
A Concept can have any number of <<Classifier.features, `features`>>, given it is a <<Classifier>>.
140
140
141
141
.Constraints
142
-
TBD
142
+
A Concept MUST NOT extend itself, or form circles via `extends`.
143
143
144
144
[[Annotation]]
145
145
==== Annotation
146
-
An Annotation is a limited[*] additional, orthogonal information attached to potentially any node, sharing the node’s lifecycle.
146
+
An Annotation is an additional piece of information attached to potentially any node, sharing the node’s lifecycle.
147
147
The annotated node (or its concept) does not need to know about the annotation.{fn-org13}
148
+
Annotations CAN be attached to other Annotations (although this structure is hard to comprehend, and should be used with caution).
149
+
150
+
Annotations should only have limited content because the more complex the annotation is, the more likely it should not be part of the annotated node's lifecycle -- We might want to reuse the complex annotation somewhere else. +
151
+
Example: In MPS, the editor of a concept can be seen as an annotation of that concept.
152
+
But even if we deleted the concept, we might want to reuse the editor for another (similar) concept.
153
+
154
+
Annotations' contents should be orthogonal to the annotated node, because actual content should be part of the original concepts, and unrelated contents should be somewhere else. +
155
+
Example: Let's assume our Language defines a `Date` PrimitiveType.
156
+
We might annotate `Date` with `@JavaImplementation(java.util.Date)` and `@TypeScriptImplementation(JsJoda.LocalDate)`.
157
+
Our core model stays platform-independent, but we maintain the implementation details at the right place -- if we ever deleted `Date`, all related information would be gone without further cleanup.
148
158
149
159
.Example
150
160
We design a fancy documentation language, and can annotate any other node with such documentation.
@@ -166,13 +176,13 @@ An Annotation is a <<Classifier>>, and indirectly a <<LanguageEntity>> (as it is
166
176
Each Annotation specifies which <<Classifier, `Classifiers`>> it `annotates`.
167
177
If it should be applicable to any node, it annotates <<Node>>.
168
178
169
-
As Annotations can specify which Concept or Annotation it [[Annotation.extends, Annotation.extends]]`extends` and which interfaces it [[Annotation.implements, Annotation.implements]] `implements`.
170
-
An Annotation can have any number of <<Classifier.features, `features`>>, given it is a <<Classifier>>.
179
+
Annotations can specify which Annotation it [[Annotation.extends, Annotation.extends]]`extends` and which interfaces it [[Annotation.implements, Annotation.implements]] `implements`.
180
+
An Annotation CAN have any number of <<Classifier.features, `features`>>, given it is a <<Classifier>>.
171
181
172
182
.Constraints
173
183
We CANNOT redefine `multiple` and `annotates` in a sub-annotation (i.e. an annotation that `extends` another).{fn-org154}
174
184
175
-
We can attach an instance of an Annotation only to instances of the Concept the Annotation `annotates` (and sub-concepts thereof).
185
+
We MUST attach an instance of an Annotation only to instances of the Concept the Annotation `annotates` (and sub-concepts thereof).
[*] "limited" because the more complex the annotation is, the more likely it should not be part of the annotated node's lifecycle -- We might want to reuse the complex annotation somewhere else.
298
-
Example: In MPS, the editor of a concept can be seen as an annotation of that concept. But even if we deleted the concept, we might want to reuse the editor for another (similar) concept.
299
-
300
306
[[ConceptInterface]]
301
307
==== ConceptInterface
302
308
A ConceptInterface represents a category of entities sharing some similar characteristics.
:fn-mof: footnote:mof[https://en.wikipedia.org/wiki/Meta-Object_Facility[Meta-Object Facility], also known as M3 model]
5
6
6
7
= LIonWeb Serialization Format
8
+
:toc: preamble
9
+
:toclevels: 3
10
+
11
+
This document describes the serialization format for LIonWeb chunks.
7
12
8
13
== Conventions used in this document
9
14
* _italic_ words refer to concepts defined by JSON.
@@ -17,6 +22,9 @@ We do not take any measures to reduce the amount of transmitted data.{fn-org73}
17
22
== Description
18
23
LIonWeb node serialization format is defined in JSON (https://datatracker.ietf.org/doc/html/rfc8259[RFC 8259]).
19
24
25
+
We follow the advice of RFC 8259 to be "interoperable", i.e. we assume object keys are unique, and their order is undefined.
26
+
Any violations SHOULD be reported as error.{fn-org159}
27
+
20
28
== Overview of structures
21
29
22
30
plantuml::serialization.puml[format=svg]
@@ -29,18 +37,18 @@ Root level MUST be an _object_ with three members, called *serialization chunk*.
29
37
##TODO: Are more members allowed?{fn-org67}##
30
38
31
39
[[SerializationChunk.serializationFormatVersion]]
32
-
The first member MUST be _key_ `serializationFormatVersion` with a _string_ _value_.{fn-org58}
40
+
The first member SHOULD be _key_ `serializationFormatVersion` with a _string_ _value_.{fn-org58}{fn-org159}
33
41
The value MUST be a decimal integer (without leading or trailing whitespace) describing the serialization format version used to create the processed document, according to <<versions>>.
34
42
35
43
[[SerializationChunk.languages]]
36
-
The second member MUST be _key_ `languages` with an _array_ _value_.{fn-org76}{fn-org78}
44
+
The second member SHOULD be _key_ `languages` with an _array_ _value_.{fn-org76}{fn-org78}{fn-org159}
37
45
Each _element_ in the value array MUST adhere to <<language>>.
38
46
The order of _elements_ is undefined.
39
47
_elements_ MUST contain all language/version referred to by any <<meta-pointer>> in the processed document.
40
48
Each _element_ must be unique with respect to all its _members_.
41
49
42
50
[[SerializationChunk.nodes]]
43
-
The third member MUST be _key_ `nodes` with an _array_ _value_.{fn-org33}
51
+
The third member SHOULD be _key_ `nodes` with an _array_ _value_.{fn-org33}{fn-org159}
44
52
Each _element_ in the value array MUST adhere to <<node>>.
45
53
The order of _elements_ is undefined.
46
54
Each _element_ must be unique with respect to the value of its _key_ `id`.
@@ -49,9 +57,11 @@ Each _element_ must be unique with respect to the value of its _key_ `id`.
49
57
=== Language structure
50
58
[[UsedLanguage]]
51
59
Each *used language* MUST be an _object_.{fn-org129}
52
-
##TODO: include builtins in used language? {fn-org153}##
53
60
The order of _members_ is undefined.
54
61
62
+
NOTE: If the chunk describes a language (M2), it might include instances of builtins' language entities.
63
+
In this case, builtins MUST be listed as *used language* like any other language.{fn-org153}
64
+
55
65
The _object_ MUST contain the following _members_:{fn-org76}
56
66
57
67
* [[UsedLanguage.key]] _key_ `key` with _string_ _value_, adhering to <<language-key>>.
@@ -96,13 +106,13 @@ The _object_ MUST contain the following _members_:{fn-org59}{fn-java33}{fn-org55
96
106
* [[Node.concept]] _key_ `concept`{fn-org37-name} with _object_ _value_, adhering to <<meta-pointer>>.
97
107
The *meta-pointer*'s ``key``'s _value_ refers to the <<{m3}.adoc#IKeyed.key, *key*>> of the <<{m3}.adoc#Concept, *Concept*>> this *node* is an instance of.
98
108
* [[Node.properties]] _key_ `properties` with _array_ _value_, each _element_ adhering to <<property>>.
99
-
The order of _elements_ is undefined.
109
+
The order of _elements_ is undefined.{fn-org156}
100
110
* [[Node.children]] _key_ `children`{fn-org55-name-children} with _array_ _value_, each _element_ adhering to <<child>>.
101
-
The order of _elements_ is undefined.
111
+
The order of _elements_ is undefined.{fn-org156}
102
112
* [[Node.references]] _key_ `references`{fn-org55-name-references} with _array_ _value_, each _element_ adhering to <<reference>>.
103
-
The order of _elements_ is undefined.
113
+
The order of _elements_ is undefined.{fn-org156}
104
114
* [[Node.annotations]] _key_ `annotations`{fn-org150} with _array_ _value_, each _element_ adhering to <<annotation>>.
105
-
The order of _elements_ is undefined.
115
+
The order of _elements_ MUST be maintained as set by <<{refarch}.adoc#client, model client>>.{fn-org157}
106
116
* [[Node.parent]] _key_ `parent` with _string_ or _null_ _value_, adhering to <<parent>>.
107
117
108
118
##TODO: How to store invalid text?{fn-org62}##
@@ -143,7 +153,7 @@ The _object_ MUST contain the following _members_:
143
153
The *meta-pointer*'s ``key``'s _value_ refers to the <<{m3}.adoc#IKeyed.key, *key*>> of the <<{m3}.adoc#Containment, *Containment*>> this *child* is an instance of.
144
154
* [[Child.children]] _key_ `children` with _array_ _value_ with _string_ _elements_.
145
155
Each _element_ adheres to <<{m3}.adoc#identifiers, Identifier spec>>, and refers to the *id* of the contained *node*.
146
-
The order of _elements_ is undefined.
156
+
The order of _elements_ MUST be maintained as set by <<{refarch}.adoc#client, model client>>.{fn-org157}
147
157
+
148
158
NOTE: Each *child* element is the inverse relation of a *parent*.
149
159
+
@@ -159,7 +169,8 @@ The _object_ MUST contain the following _members_:
159
169
160
170
* [[Reference.reference]] _key_ `reference` with _object_ _value_, adhering to <<meta-pointer>>.
161
171
The *meta-pointer*'s ``key``'s _value_ refers to the <<{m3}.adoc#IKeyed.key, *key*>> of the <<{m3}.adoc#Reference, *Reference*>> this *reference* is an instance of.
162
-
* [[Reference.targets]] _key_ `targets` with __object_ _elements_.
172
+
* [[Reference.targets]] _key_ `targets` with _array_ _value_ with __object_ _elements_.
173
+
The order of _elements_ MUST be maintained as set by <<{refarch}.adoc#client, model client>>.{fn-org157}
163
174
Each _element_ MUST have the following _members_ in undefined order:{fn-org55-name-references}
164
175
** [[Reference.reference.resolveInfo]] _key_ `resolveInfo`{fn-org36} with _value_ as one of:
165
176
*** _string_ containing *resolveInfo*, a textual hint that might be used to find the target *node* of this reference.
@@ -178,17 +189,11 @@ NOTE: The referred *node* CAN be contained in the processed document, but also C
178
189
[[annotation]]
179
190
==== Annotation
180
191
[[Annotation]]
181
-
Each *annotation* MUST be an _object_.
182
-
The order of _members_ is undefined.
183
-
184
-
The _object_ MUST contain the following _members_:
192
+
Each *annotation* MUST be a _string_.
193
+
It adheres to <<{m3}.adoc#identifiers, Identifier spec>>, and refers to the *id* of the contained annotation *node*.
185
194
186
-
* [[Annotation.annotations]] _key_ `annotations` with _array_ _value_ with _string_ _elements_.
187
-
Each _element_ adheres to <<{m3}.adoc#identifiers, Identifier spec>>, and refers to the *id* of the contained *node*.
188
-
The order of _elements_ is undefined.
189
-
+
190
195
NOTE: Each *annotation* element is the inverse relation of a *parent*.
191
-
+
196
+
192
197
NOTE: The annotation *node* CAN be contained in the processed document, but also CAN be outside the processed document (i.e. not contained in the processed document).
193
198
194
199
[[parent]]
@@ -211,6 +216,7 @@ NOTE: The referred *node* CAN be contained in the processed document, but also C
211
216
All property values MUST be serialized as JSON _string_.{fn-org34}{fn-org9}.
212
217
An unset property CAN be serialized as JSON _null_.
213
218
219
+
[[string]]
214
220
==== String
215
221
<<{m3}.adoc#String, LIonCore Strings>> might be any string, of any length, including (but not limited to):
216
222
@@ -220,6 +226,7 @@ An unset property CAN be serialized as JSON _null_.
<<{m3}.adoc#Boolean, LIonCore Booleans>> MUST be encoded as exactly one of these JSON _strings_:
225
232
@@ -228,6 +235,7 @@ An unset property CAN be serialized as JSON _null_.
228
235
229
236
Booleans MUST NOT be encoded with leading or trailing whitespace, uppercase characters, short forms (like `t` or `f`), or decimal representation (like `1`, `0`, `-1`).
230
237
238
+
[[integer]]
231
239
==== Integer
232
240
<<{m3}.adoc#Integer, LIonCore Integers>> MUST be encoded as JSON _string_.
233
241
@@ -262,6 +270,7 @@ Booleans MUST NOT be encoded with leading or trailing whitespace, uppercase char
262
270
* `" 5"`
263
271
* `"-6 "`
264
272
273
+
[[json]]
265
274
==== JSON
266
275
<<{m3}.adoc#JSON, LIonCore JSON>> MUST be encoded as JSON _string_.
267
276
All double quotes, line breaks, etc. MUST be escaped to form a proper JSON _string_.
@@ -273,6 +282,7 @@ The value MUST adhere to JSON spec (RFC 8259).
273
282
.Invalid example
274
283
`{ "key": "my value", "myArray": [1, -2, true] }`
275
284
285
+
[[literal]]
276
286
==== Enumeration literals
277
287
<<{m3}.adoc#EnumerationLiteral, LIonCore Enumeration literals>> MUST be encoded as JSON _string_ _value_ according to <<{m3}.adoc#keys, Key spec>>.
278
288
MUST refer to the <<{m3}.adoc#IKeyed.key, key>> of an <<{m3}.adoc#EnumerationLiteral, EnumerationLiteral>> of the <<{m3}.adoc#Enumeration, Enumeration>> defined as <<{m3}.adoc#Property.type, type>> of this *Property*.{fn-org128}
Copy file name to clipboardExpand all lines: shared/issue-footnotes.adoc
+3
Original file line number
Diff line number
Diff line change
@@ -145,3 +145,6 @@
145
145
:fn-org150: footnote:org150[https://github.com/LIonWeb-org/organization/issues/150[How to represent annotations in serialization #150]]
146
146
:fn-org153: footnote:org153[https://github.com/LIonWeb-org/organization/issues/153[Details on builtin language #153]]
147
147
:fn-org154: footnote:org154[https://github.com/LIonWeb-org/organization/issues/154[Details on Annotations #154]]
148
+
:fn-org156: footnote:org156[https://github.com/LIonWeb-org/organization/issues/156[Keep serialization order between different features? #156]]
149
+
:fn-org157: footnote:org157[https://github.com/LIonWeb-org/organization/issues/157[Maintain order in serialization of each containment / reference / annotation #157]]
150
+
:fn-org159: footnote:org159[https://github.com/LIonWeb-org/organization/issues/159[Don't rely on valid, but ambiguous JSON structures #159]]
0 commit comments