Skip to content

Commit 2bfb624

Browse files
committed
JSON serialization: rename type into concept
1 parent 036280e commit 2bfb624

File tree

3 files changed

+61
-61
lines changed

3 files changed

+61
-61
lines changed

core/src/main/java/org/lionweb/lioncore/java/serialization/JsonSerialization.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public class JsonSerialization {
3030

31-
private static final String TYPE_LABEL = "type";
31+
private static final String CONCEPT_LABEL = "concept";
3232
private static final String ID_LABEL = "id";
3333

3434
/**
@@ -96,7 +96,7 @@ private String serializePropertyValue(Object value) {
9696

9797
private JsonObject serializeThisNode(Node node) {
9898
JsonObject jsonObject = new JsonObject();
99-
jsonObject.addProperty(TYPE_LABEL, node.getConcept().getID());
99+
jsonObject.addProperty(CONCEPT_LABEL, node.getConcept().getID());
100100
jsonObject.addProperty(ID_LABEL, node.getID());
101101

102102
JsonObject properties = new JsonObject();
@@ -219,7 +219,7 @@ public List<Node> unserialize(JsonElement jsonElement) {
219219
private Node unserializeNode(JsonElement jsonElement) {
220220
if (jsonElement.isJsonObject()) {
221221
JsonObject jsonObject = jsonElement.getAsJsonObject();
222-
String type = getStringProperty(jsonObject, TYPE_LABEL);
222+
String type = getStringProperty(jsonObject, CONCEPT_LABEL);
223223
Concept concept = conceptResolver.resolveConcept(type);
224224
String nodeID = getStringProperty(jsonObject, ID_LABEL);
225225
Node node = nodeInstantiator.instantiate(concept, jsonObject, nodeID);

core/src/test/resources/serialization/library-metamodel.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"type": "LIonCore_M3_Metamodel",
3+
"concept": "LIonCore_M3_Metamodel",
44
"id": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow",
55
"properties": {
66
"LIonCore_M3_Metamodel_qualifiedName": "library"
@@ -19,31 +19,31 @@
1919
}
2020
},
2121
{
22-
"type": "LIonCore_M3_PrimitiveType",
22+
"concept": "LIonCore_M3_PrimitiveType",
2323
"id": "INhBvWyXvxwNsePuX0rdNGB_J9hi85cTb1Q0APXCyJ0",
2424
"properties": {
2525
"LIonCore_M3_NamespacedEntity_simpleName": "String"
2626
},
2727
"parent": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow"
2828
},
2929
{
30-
"type": "LIonCore_M3_PrimitiveType",
30+
"concept": "LIonCore_M3_PrimitiveType",
3131
"id": "uHmTCy63BV23cvXwFSumVwK1DOh4IZvIyAnRJjW9eQI",
3232
"properties": {
3333
"LIonCore_M3_NamespacedEntity_simpleName": "boolean"
3434
},
3535
"parent": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow"
3636
},
3737
{
38-
"type": "LIonCore_M3_PrimitiveType",
38+
"concept": "LIonCore_M3_PrimitiveType",
3939
"id": "gVp8_QSmXE2k4pd-sQZgjYMoW95SLLaVIH4yMYqqbt4",
4040
"properties": {
4141
"LIonCore_M3_NamespacedEntity_simpleName": "int"
4242
},
4343
"parent": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow"
4444
},
4545
{
46-
"type": "LIonCore_M3_Concept",
46+
"concept": "LIonCore_M3_Concept",
4747
"id": "OcDK2GESljInG-ApIqtkXUoA2UeviB97u0UuiZzM0Hs",
4848
"properties": {
4949
"LIonCore_M3_NamespacedEntity_simpleName": "Book",
@@ -63,7 +63,7 @@
6363
"parent": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow"
6464
},
6565
{
66-
"type": "LIonCore_M3_Property",
66+
"concept": "LIonCore_M3_Property",
6767
"id": "Ei9m_HbdmEYg_EwMLLVZ71ERRBZyXH8GHVyOVia8Sqg",
6868
"properties": {
6969
"LIonCore_M3_NamespacedEntity_simpleName": "title",
@@ -78,7 +78,7 @@
7878
"parent": "OcDK2GESljInG-ApIqtkXUoA2UeviB97u0UuiZzM0Hs"
7979
},
8080
{
81-
"type": "LIonCore_M3_Property",
81+
"concept": "LIonCore_M3_Property",
8282
"id": "OJhF8vB_qRMrA8A9a-H0LsByONdYtHGmQ-lk9rUHUc4",
8383
"properties": {
8484
"LIonCore_M3_NamespacedEntity_simpleName": "pages",
@@ -93,7 +93,7 @@
9393
"parent": "OcDK2GESljInG-ApIqtkXUoA2UeviB97u0UuiZzM0Hs"
9494
},
9595
{
96-
"type": "LIonCore_M3_Reference",
96+
"concept": "LIonCore_M3_Reference",
9797
"id": "9ATCb8nXEuQAL3NOY-EUZwuThpIQnQ2C_2n97IRGA_g",
9898
"properties": {
9999
"LIonCore_M3_NamespacedEntity_simpleName": "author",
@@ -109,7 +109,7 @@
109109
"parent": "OcDK2GESljInG-ApIqtkXUoA2UeviB97u0UuiZzM0Hs"
110110
},
111111
{
112-
"type": "LIonCore_M3_Concept",
112+
"concept": "LIonCore_M3_Concept",
113113
"id": "Pk1NRJfHMt4eSja2kpXia7x8vj6Vzc6WQCUzT3aVeYY",
114114
"properties": {
115115
"LIonCore_M3_NamespacedEntity_simpleName": "Library",
@@ -128,7 +128,7 @@
128128
"parent": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow"
129129
},
130130
{
131-
"type": "LIonCore_M3_Property",
131+
"concept": "LIonCore_M3_Property",
132132
"id": "LdgCnVXNgZD7CLbBhBin2Rcdumx4qZUYz_jh2QnP5z8",
133133
"properties": {
134134
"LIonCore_M3_NamespacedEntity_simpleName": "name",
@@ -143,7 +143,7 @@
143143
"parent": "Pk1NRJfHMt4eSja2kpXia7x8vj6Vzc6WQCUzT3aVeYY"
144144
},
145145
{
146-
"type": "LIonCore_M3_Containment",
146+
"concept": "LIonCore_M3_Containment",
147147
"id": "TFS1ME6sEyRbkRchsr8zaZCcj_uF1LM0LXK24gbnxZM",
148148
"properties": {
149149
"LIonCore_M3_NamespacedEntity_simpleName": "books",
@@ -159,7 +159,7 @@
159159
"parent": "Pk1NRJfHMt4eSja2kpXia7x8vj6Vzc6WQCUzT3aVeYY"
160160
},
161161
{
162-
"type": "LIonCore_M3_Concept",
162+
"concept": "LIonCore_M3_Concept",
163163
"id": "DuBg-a_slgc_VOG0huySkSWi3rZQX1Q20EEd2f7lvLE",
164164
"properties": {
165165
"LIonCore_M3_NamespacedEntity_simpleName": "Writer",
@@ -177,7 +177,7 @@
177177
"parent": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow"
178178
},
179179
{
180-
"type": "LIonCore_M3_Property",
180+
"concept": "LIonCore_M3_Property",
181181
"id": "onRRrZaasiOtDU2qFJgyW8OVz8p5-hqQu0Vlc_7Aq6s",
182182
"properties": {
183183
"LIonCore_M3_NamespacedEntity_simpleName": "name",
@@ -192,7 +192,7 @@
192192
"parent": "DuBg-a_slgc_VOG0huySkSWi3rZQX1Q20EEd2f7lvLE"
193193
},
194194
{
195-
"type": "LIonCore_M3_Concept",
195+
"concept": "LIonCore_M3_Concept",
196196
"id": "nNUEzZ7it7d2HoHPAtk5rGO4SsqVA3hAlBwkK1KP8QU",
197197
"properties": {
198198
"LIonCore_M3_NamespacedEntity_simpleName": "GuideBookWriter",
@@ -212,7 +212,7 @@
212212
"parent": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow"
213213
},
214214
{
215-
"type": "LIonCore_M3_Property",
215+
"concept": "LIonCore_M3_Property",
216216
"id": "PoZyl6WXh-Cz5h2RspK1NL6zX9DdLwGpUUC-ygQmHMA",
217217
"properties": {
218218
"LIonCore_M3_NamespacedEntity_simpleName": "countries",
@@ -227,7 +227,7 @@
227227
"parent": "nNUEzZ7it7d2HoHPAtk5rGO4SsqVA3hAlBwkK1KP8QU"
228228
},
229229
{
230-
"type": "LIonCore_M3_Concept",
230+
"concept": "LIonCore_M3_Concept",
231231
"id": "RDa_L8gbU8XgW9z46oMysBi1Hb7vjcS8O8LUgXlFpeU",
232232
"properties": {
233233
"LIonCore_M3_NamespacedEntity_simpleName": "SpecialistBookWriter",
@@ -247,7 +247,7 @@
247247
"parent": "txjxNU9yRzEuyghtmgJK_l-nF93qWt7d1vErz5RbLow"
248248
},
249249
{
250-
"type": "LIonCore_M3_Property",
250+
"concept": "LIonCore_M3_Property",
251251
"id": "DbVixG73dI8xIF9TAoq2GOZru4CRQfRD8gG7TkFCZuU",
252252
"properties": {
253253
"LIonCore_M3_NamespacedEntity_simpleName": "subject",

0 commit comments

Comments
 (0)