DataCatalogs.html 92.5 KB
Newer Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
<p>Concepts: features, resources, perspectives, views, editors</p>
</li>
<li>
<p>Opening perspectives and views</p>
</li>
<li>
<p>Installing new software manually</p>
</li>
</ul>
</div>
</li>
<li>
<p>Team support with Git</p>
</li>
</ul>
</div>
</li>
<li>
<p>Learn how to use the Ecore diagram editor</p>
</li>
<li>
<p>Launch the Eclipse Marketplace</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>For now, you can dismiss the welcome screen. It can be opened anytime by executing <code>Help &#8594; Welcome</code></p>
</div>
</div>
<div class="sect2">
<h3 id="truemodeling-data-catalogs-for-simulation-with-ecore"><a class="anchor" href="#truemodeling-data-catalogs-for-simulation-with-ecore"></a>Modeling Data Catalogs for Simulation with Ecore</h3>
<div class="paragraph">
<p>Now you should see the initial layout of Eclipse with <em>Model Explorer</em> and <em>Outline</em> on the left and a big empty editing area with <em>Properties</em> view below to the right.</p>
</div>
<div class="paragraph">
<p>Since we will use Ecore diagrams for data modeling, create your first Ecore modeling project now:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Execute <code>File &#8594; New &#8594; Ecore Modeling Project</code> from main menu&#8201;&#8212;&#8201;not <code>Modeling Project</code>!</p>
</li>
<li>
<p>Name it <code>project.first</code> and click <code>Next &gt;</code></p>
</li>
<li>
<p>Uncheck <code>Use Default Location</code> so that the new project is <strong>not</strong> stored in the workspace, but a different directory you choose, then click <code>Next &gt;</code></p>
</li>
<li>
<p>Provide <code>datacatalog</code> as main Java package name and click <code>Finish</code>.</p>
</li>
</ol>
</div>
<div class="paragraph">
<p>Eclipse should look like below with an new empty graphical Ecore diagram editor opened.
The diagram is automatically named <code>datacatalog</code> after the package name for the Java classes that will be generated from it (provided above).
The <em>Model Explorer</em> shows the contents of the new Ecore modeling project.</p>
</div>
<div class="imageblock thumb">
<div class="content">
<img src="DataCatalogs2Images/ProjectFirst1.png" alt="ProjectFirst1">
</div>
<div class="title">Figure 4. New Ecore Modeling Project</div>
</div>
<div class="paragraph">
<p>To get your feet wet, do this:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Drag a <em>Class</em> from the palette on the right onto the editor&#8217;s canvas: it will materialize as a rectangle labeled <code>NewEClass1</code>.</p>
</li>
<li>
<p>The class symbol was selected initially, so you can see its attributes in the <em>Properties</em> view.</p>
</li>
<li>
<p>In there replace <code>NewEClass1</code> by <code>EnergyComponentsCatalog</code> to rename the class.</p>
</li>
<li>
<p>Click anywhere on the canvas and notice that the class symbol is deselected and the toolbar at the top adapts accordingly.</p>
</li>
<li>
<p>In the toolbar change <code>100%</code> to <code>75%</code> to scale the diagram</p>
</li>
<li>
<p>Execute <code>File &#8594; Save</code> and model and diagram are saved.</p>
</li>
<li>
<p>Close diagram editor <code>datacatalog</code> by closing its tab.</p>
</li>
<li>
<p>Reopen saved diagram by double click on entry <code>datacatalog</code> in the <em>Model Explorer</em>.</p>
</li>
</ol>
</div>
<div class="paragraph">
<p>Technically, everything is in place now to begin modeling the data that the projected catalog shall contain.
Except &#8230;&#8203; understanding the basics of object-oriented modeling would be helpful.
This is why developers should support domain experts at this stage.</p>
</div>
<div class="paragraph">
<div class="title">Model Data with Class Diagrams</div>
<p>Ecore diagrams are simplified UML class diagrams.
Here some resources on what this is all about:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="http://www.cs.toronto.edu/~sme/CSC340F/slides/11-objects.pdf">Toronto Lecture on Object Oriented Modeling</a></p>
</li>
<li>
<p><a href="http://agilemodeling.com/artifacts/classDiagram.htm">UML 2 Class Diagrams: An Agile Introduction</a></p>
</li>
<li>
<p><a href="https://www.amazon.de/UML-Classroom-Einführung-objektorientierte-Modellierung-ebook/dp/B00AIBE1QA/ref=sr_1_2?__mk_de_DE=ÅMÅŽÕÑ&amp;dchild=1&amp;keywords=UML&amp;qid=1585854599&amp;sr=8-2">UML @ Classroom: Eine Einführung in die objektorientierte Modellierung (German Book)</a></p>
</li>
</ul>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="paragraph">
<p>Beginners are strongly encouraged to read the first two resources. The first one contains a gentle introduction, especially suited for domain experts. The second one can also serve as reference.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>We will touch central object oriented concepts <em>Class</em>, <em>Object</em>, <em>Attribute</em>, <em>Association</em>, <em>Composition</em>, and <em>Multiplicity</em> in an example below, but work through above sources to get a deeper understanding and enhance your modeling skills.</p>
</div>
<div class="paragraph">
<p>Note that the sources differentiate between <em>conceptual</em> and <em>detailed</em> models.
In principle we go for detailed models, since only these contain enough information to generate code.
Having said this, it is usually a good idea to have two or three conceptual iterations at a white board to agree on the broad approach before going too much into detail.
But even if one starts with Ecore models right away, these also can be adapted any time to follow a new train of thought.</p>
</div>
<div class="paragraph">
<p>See here the essential and typical structure of a data catalog in a class diagram.
Instead of artificial example classes like <em>Foo</em> and <em>Bar</em> it shows classes from an existing catalog, albeit in a very condensed form.</p>
</div>
<div class="imageblock thumb">
<div class="content">
<img src="http://localhost:49751/afx/cache/8068a4d732d1847a062d97696687b38f.png" alt="8068a4d732d1847a062d97696687b38f">
</div>
<div class="title">Figure 5. Principle Structure of a Data Catalog</div>
</div>
<div class="paragraph">
<p>The diagram models four types of technical components whose data shall be stored in the catalog for later use, e.g. for parameterization of simulation models: <em>Boiler</em>, <em>CombinedHeatPower</em>, <em>SolarPanel</em>, and <em>Inverter</em>.</p>
</div>
<div class="paragraph">
<p>The catalog itself is represented by class <em>EnergyComponentsCatalog</em>.
Unlike dozens, hundreds, or even thousands of objects to be cataloged&#8201;&#8212;&#8201;Boilers, Inverters etc.&#8201;&#8212;&#8201;there will be just exactly <strong>one</strong> catalog object in the data representing the catalog itself.
Its "singularity" is not visible in the class diagram, but an <em>Ecore</em> convention requires that all objects must form a composition hierarchy with only one root object.</p>
</div>
<div class="paragraph">
<div class="title">Composition</div>
<p>If, in the domain, one object is composed of others, this is expressed by a special kind of association called <em>composition</em>.
Compositions are depicted as a link with a diamond shape attached to the containing object. In the <em>Boiler</em> case said link translates to: The <em>EnergyComponentsCatalog</em> contains&#8201;&#8212;&#8201;or is composed of&#8201;&#8212;&#8201;zero or more (<code>0..*</code>) boiler objects stored in a list named <code>boilers</code>.</p>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
<div class="paragraph">
<p>Note that class names&#8201;&#8212;&#8201;despite the fact that they model a set of similar objects&#8201;&#8212;&#8201;are always written in <em>singular</em>! They are written in <a href="https://en.wikipedia.org/wiki/Camel_case">Camel case notation</a> starting with an upper case letter. Associations and attributes are written the same way, but starting with a lower case letter. Names for list-like associations and attributes usually are written in plural form.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<div class="title">Inheritance</div>
<p>Besides composition of <strong>objects</strong>, the model above shows another completely different kind of hierarchy: the inheritance hierarchy between <strong>classes</strong>.
Whenever classes of objects share the same attributes or associations, we don&#8217;t like to repeat ourselves by adding that attribute or relation to all classes again and again.
Instead, we create a <em>super class</em> to define common attributes and associations and connect it to <em>sub classes</em> that will automatically <em>inherit</em> all the features of their super class.</p>
</div>
<div class="paragraph">
<p>In our example above, common to all four energy components are attributes <code>modelName</code> and <code>revisionYear</code>, thus these are modeled by class <code>EnergyComponent</code> that is directly or indirectly a super class of <em>Boiler</em>, <em>CombinedHeatPower</em>, <em>SolarPanel</em>, and <em>Inverter</em>.
Similar, <em>Boiler</em> and <em>CombinedHeatPower</em> share attribute <code>installedThermalPower</code> factored out by class <em>ChemicalEnergyDevice</em>.</p>
</div>
<div class="paragraph">
<div class="title">Associations</div>
<p>You probably noticed a fifth type of objects contained in the catalog, namely <code>Manufacturer</code> objects stored in list <code>manufactureres</code>.
How come? Ok, here is the story:</p>
</div>
<div class="sidebarblock">
<div class="content">
<div class="title">Domain Expert Meets Developer</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;I&#8217;d like to store a component&#8217;s manufacturer. Shall I add a String attribute <code>manufacturerName</code> to all classes like <em>Boiler</em>, <em>Inverter</em> and so on to store the manufacturer&#8217;s name?&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em> shudders: &#8220;Well, what do you mean by "&#8230;&#8203; and so on"?&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;Basically, I mean all energy components.&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;Fine. We already have a class representing all those energy components, brilliantly named <em>EnergyComponent</em>. Thus, we can define <code>manfacturerName</code> there, following one of Developer&#8217;s holy principles: "<em>DRY</em>&#8201;&#8212;&#8201;Don&#8217;t repeat yourself!"
By the way: Is the name all you want to know about manufacturers?&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;Mhm, maybe we need to know if they are still in business &#8230;&#8203;&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;&#8230;&#8203; or even since when they were out of business, if at all &#8230;&#8203;&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;&#8230;&#8203; and the country or region they are active.&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;Ok, so it&#8217;s not just the name&#8201;&#8212;&#8201;we need a class <code>Manufacturer</code> to model all these information.&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em> sighs.</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;Come on, its not that hard to add a class to our data model, isn&#8217;t it?&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;Ok, but how can we express what components a manufacturer produces?&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;Wasn&#8217;t it the other way around? I thought, you just wanted to know the manufacturer of a component?&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;What is the difference?&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;In data modeling, it is the difference between a uni-directional and a bi-directional association.&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;&#8230;&#8203;?&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;Let&#8217;s put it that way: The difference between a link with an arrow on one side or on both sides.&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;Ok. We don&#8217;t need a list of components per manufacturer, but simply a reference from the component to its manufacturer.&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;Fine, then in Ecore please create a simple reference from class <code>EnergyComponent</code> to class <code>Manufacturer</code>, maybe named <code>producedBy</code>.&#8221;</p>
</div>
<div class="paragraph">
<p><em>Exp</em>: &#8220;I will try this and get back to you.&#8221;</p>
</div>
<div class="paragraph">
<p><em>Dev</em>: &#8220;Fine &#8230;&#8203; good meeting.&#8221;</p>
</div>
</div>
</div>
<div class="paragraph">
<p>Observe in our data model, reference <code>producedBy</code> points <em>from</em> <code>EnergyComponent</code> <em>to</em> <code>Manufacturer</code> making it uni-directional reference.
One can simply query the manufacturer of a product, but not so the other way around.
With a bi-directional reference both queries would be available.</p>
</div>
<div class="paragraph">
<p>Observe also the annotations <code>0..*</code> and <code>1..1</code> near class <code>Manufacturer</code>.
These are <em>multiplicities</em> of associations: An <code>EnergyComponentsCatalog</code> contains zero, one, or many objects of class <code>Manufacturer</code> and an <code>EnergyComponent</code> must reference exactly one manufacturer&#8201;&#8212;&#8201;not less, not more.</p>
</div>
<div class="openblock float-group">
<div class="content">
<div class="imageblock right thumb">
<div class="content">
<img src="DataCatalogs2Images/EcoreRelations.gif" alt="EcoreRelations" width="200">
</div>
<div class="title">Figure 6. Ecore Relations</div>
</div>
<div class="paragraph">
<p>To recapitulate: Our example data catalog already exhibits all four types of relations provided by Ecore.
You find these in the Ecore editor&#8217;s palette shown here.
To create a relation between a sub class and a super class use tool <code>SuperType</code>.
Use the other tools to create an association between classes, may it be a simple (uni-directional) reference, a bi-directional reference, or a composition.</p>
</div>
</div>
</div>
<div class="paragraph">
<div class="title">Attributes and Enumerations</div>
<p>Obviously, attributes are central in data modeling.
Create one by dragging it from the palette onto our one and only class so far: <code>EnergyComponentsCatalog</code>.
The class symbol will turn red to indicate an error.
Hover with the mouse pointer over the new attribute and a tooltip with a more or less helpful error message will appear.
The error is caused in that no data type was set for the new attribute.
Data types for attributes can be integer or float numbers, strings, dates, booleans, and more.
To get rid of the error:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>If not already selected, select new attribute by clicking at it in the editor.</p>
</li>
<li>
<p>In view <em>Properties</em> find <code>EType</code> and click button <code>&#8230;&#8203;</code> to see a quite long list of available data types.</p>
</li>
<li>
<p>Choose <code>EString [java.lang:String]</code> from the list and the error is gone.</p>
</li>
</ol>
</div>
<div class="openblock float-group">
<div class="content">
<div class="imageblock right thumb">
<div class="content">
<img src="DataCatalogs2Images/EcoreClassWithAttribute.png" alt="EcoreClassWithAttribute" width="200">
</div>
<div class="title">Figure 7. Class with Attribute</div>
</div>
<div class="paragraph">
<p>Change the attribute&#8217;s name to <code>author</code> and the class should look like shown here.</p>
</div>
<div class="paragraph">
<p>Most data types to choose from begin with an <strong>E</strong> like in <strong>E</strong>core. These are simply Ecore enabled variants of the respective Java types, thus, choose EInt for an int, EFloat for a 32 bit floating point number, EDouble for a 64 bit one, and so on.</p>
</div>
<div class="paragraph">
<p>Ecore allows to introduce new data types. We employ this feature later to enable data model with physical units and quantities.</p>
</div>
</div>
</div>
<div class="paragraph">
<p>There exists one other means to define the values an attribute can take, namely enumerations of distinct names. Take <em>Monday</em>, <em>Tuesday</em>, <em>Wednesday</em>, &#8230;&#8203; as a typical example for representing weekdays.
In our example data model you&#8217;ll find one <em>Enumeration</em> named <code>BoilerType</code> with values <code>LowTemperature</code> and <code>Condensing</code>.</p>
</div>
<div class="paragraph">
<div class="title">Homework</div>
<p>The next section deals with generation of Java code from data models. To have more to play with, please implement our example model in Ecore now.</p>
</div>
<div class="openblock float-group">
<div class="content">
<div class="imageblock right thumb">
<div class="content">
<img src="DataCatalogs2Images/EcoreClassifier.png" alt="EcoreClassifier" width="200">
</div>
<div class="title">Figure 8. Abstract Class</div>
</div>
<div class="paragraph">
<p>To do this, there is one more thing to know about classes: the difference between ordinary classes and abstract classes.
'Ordinary class' doesn&#8217;t sound nice, therefore, classes that are not abstract are called <em>concrete</em> classes.
Our example diagram depicts abstract classes with letter <strong>A</strong> while concrete classes are labeled with <strong>C</strong>. You add abstract classes to a model with a special palette tool shown here.</p>
</div>
<div class="paragraph">
<p>The thing is: Objects can be created for concrete classes only!</p>
</div>
<div class="paragraph">
<p>In our example, it makes no sense to create an object from class <em>EnergyComponent</em>, because there is not such a thing like an energy component <em>per se</em>.
Therefore, this class is <em>abstract</em>.
It is true that an inverter <em>is</em> an energy component, thus inheriting all its features, but it was <em>created</em> as <em>Inverter</em>, not as <em>EnergyComponent</em>.</p>
</div>
<div class="paragraph">
<p>Super classes will be abstract most of the time.
So my advice is: Model a super class as abstract class unless you convince yourself that there are real objects in the domain that belong to the super class but, at the same time, do not belong to any of its sub classes.</p>
</div>
<div class="paragraph">
<p>In the Ecore editor properties view, you can specify if a class is abstract or not, simply by toggling check box <code>Abstract</code>.</p>
</div>
</div>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="paragraph">
<p>An exhaustive user manual for Ecore diagram editor is available. Execute <code>Help &#8594; Welcome</code> and follow link <code>Learn how to use the diagram editor</code>.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="paragraph">
<p>If Ecore models get bigger, you may find it more convenient to work with a form based UI instead of, or in addition to, the diagram editor.
Open this kind of editor via command <code>Open With &#8594; Ecore Editor</code> from the context menu over entry <code>datacatalog.ecore</code> in the <em>Model Explorer</em> view.
Note that Eclipse synchronizes different editors of the same content automatically.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="truegeneration-of-java-code-from-data-model"><a class="anchor" href="#truegeneration-of-java-code-from-data-model"></a>Generation of Java Code from Data Model</h3>
<div class="paragraph">
<p>TBD</p>
</div>
<div class="paragraph">
<p>Let us bring the data model to life, that is, generate program code from it that can be used to create, edit and delete concrete data objects of the classes modeled in computers.</p>
</div>
<div class="paragraph">
<p>I would like to tell you that this is done with one click but, actually, you need two or three:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Make sure, all files are saved by ..</p>
</li>
<li>
<p>Open the context menu of Ecore editor showing the model and perform <code>Gerenerate &#8594; Model Code</code></p>
</li>
<li>
<p><code>Gerenerate &#8594; Edit Code</code> (Do not execute <code>Gerenerate &#8594;Editor Code</code>&#8201;&#8212;&#8201;we do not need this).</p>
</li>
</ol>
</div>
<div class="paragraph">
<div class="title">Development Cycle</div>
<p>Creation&#8201;&#8212;&#8201;Recreation</p>
</div>
<div class="paragraph">
<p>Custom code marked with <code>@generated NOT</code> in <code>de.hftstuttgart.energycomponents.provider</code> in project <code>de.hftstuttgart.energycomponents.edit</code></p>
</div>
</div>
<div class="sect2">
<h3 id="truegeneration-and-tweaking-of-ui"><a class="anchor" href="#truegeneration-and-tweaking-of-ui"></a>Generation and Tweaking of UI</h3>
<div class="paragraph">
<p>If there are many types of entities, their tables may be ordered hierarchical in the user interface to simplify user access. Probably, this hierarchy will be different from aggregation and inheritance hierarchies present in the Ecore model. We get to this later when we create a UI model for the data catalog.</p>
</div>
<div class="paragraph">
<p>Table columns sequence and width.</p>
</div>
<div class="paragraph">
<p>for creating custom UI labels:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>ExponentialFunctionItemProvider.java</code></p>
</li>
<li>
<p><code>LinearFunctionItemProvider.java</code></p>
</li>
<li>
<p><code>TableFunctionItemProvider.java</code></p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="truerun-and-deploy-the-demo-data-catalog-application"><a class="anchor" href="#truerun-and-deploy-the-demo-data-catalog-application"></a>Run and Deploy the Demo Data Catalog Application</h3>
<div class="paragraph">
<div class="title">Run from Eclipse IDE</div>
<p>TBD</p>
</div>
<div class="paragraph">
<div class="title">Install Maven Support</div>
<p>We are going to create a complete Eclipse desktop application from generated code.
We also want to deploy this application for Linux, macOS and Windows operating systems.
Eclipse offers several approaches for compiling and deploying such an application, traditionally with <em>Ant</em> scripts.</p>
</div>
<div class="paragraph">
<p>Creation and maintenance of these scripts turned out to be tedious and error prone.
For quite some years now, the proposed&#8201;&#8212;&#8201;and mostly supported&#8201;&#8212;&#8201;method for building Eclipse applications is to use <em>Maven</em> build system, more specifically, a couple of Maven plug-ins, subsumed under the name <em>Tycho</em>.</p>
</div>
<div class="paragraph">
<p>Many Eclipse platforms have Maven support <a href="https://www.eclipse.org/m2e/"><em>M2Eclipse</em></a> already built in, not so our <em>Eclipse Modeling Tools</em>.
But don&#8217;t worry: Installation of required Eclipse feature is easy and straight forward.
And, by the way, you will acquire the indispensable skill of how to install new plug-ins/features to Eclipse.</p>
</div>
<div class="paragraph">
<p>First, tell your Eclipse installation where to look for the new software.
Execute <code>Help &#8594; Install new Software&#8230;&#8203;</code> to invoke dialog <em>Available Software</em> and press <code>Add&#8230;&#8203;</code>.
Sub-dialog <code>Add Repository</code> pops up.</p>
</div>
<div class="imageblock thumb">
<div class="content">
<img src="DataCatalogs2Images/InstallMaven1.gif" alt="InstallMaven1">
</div>
<div class="title">Figure 9. Add update site m2e</div>
</div>
<div class="paragraph">
<p>In there provide <code>m2e</code> as name and</p>
</div>
<div class="literalblock">
<div class="content">
<pre>http://download.eclipse.org/technology/m2e/releases</pre>
</div>
</div>
<div class="paragraph">
<p>as location.
After confirmation with <code>Add</code>, Eclipse now looks up the site for available software.</p>
</div>
<div class="imageblock thumb">
<div class="content">
<img src="DataCatalogs2Images/InstallMaven2.gif" alt="InstallMaven2">
</div>
<div class="title">Figure 10. Choose features to install</div>
</div>
<div class="paragraph">
<p>Check the items to install like shown above and confirm all following questions about licenses and security concerns.
After download is complete&#8201;&#8212;&#8201;it can take a few minutes&#8201;&#8212;&#8201;restart Eclipse.
Verify that Maven version 3.6.3 or above is now installed in <code>Window &#8594; Preferences&#8230;&#8203;</code> (or <code>Eclipse &#8594; Preferences&#8230;&#8203;</code> on macOS) under <code>Maven &#8594; Installations</code>.</p>
</div>
<div class="imageblock thumb">
<div class="content">
<img src="DataCatalogs2Images/InstallMaven3.gif" alt="InstallMaven3" width="400">
</div>
<div class="title">Figure 11. Check Maven installation</div>
</div>
<div class="paragraph">
<div class="title">"Mavenize" our Projects for Deployment</div>
<p><strong>TBD</strong></p>
</div>
</div>
<div class="sect2">
<h3 id="trueadd-units-to-the-mix"><a class="anchor" href="#trueadd-units-to-the-mix"></a>Add Units to the Mix</h3>
<div class="paragraph">
<p><strong>TBD</strong></p>
</div>
<div class="paragraph">
<p>As mentioned earlier, data catalogs for simulations should be able to represent quantities, not just bare integer and real numbers.</p>
</div>
<div class="paragraph">
<p>using Indrya, the reference implementation for Units of Measurement in Java (JSR 385)</p>
</div>
<div class="paragraph">
<p>To this end, the author has created two Eclipse plug-in projects providing this feature to be used by Ecore and EMF Forms.</p>
</div>
<div class="paragraph">
<p>Third-party libraries like Indrya, usually, are not distributed as plug-ins, but <em>Tycho</em> can wrap them automatically as OSGi plug-ins that can added directly to our application.</p>
</div>
<div class="paragraph">
<p>Another plug-in, created by the author connects the Ecore and Indrya. We will compile it from source code, simply by importing the projects.</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Copy to file system &#8230;&#8203;</p>
</li>
<li>
<p>Import project but <strong>not</strong> copying it in the workspace (just linking)</p>
</li>
</ol>
</div>
</div>
<div class="sect2">
<h3 id="trueecore-solutions-for-specific-modeling-problems"><a class="anchor" href="#trueecore-solutions-for-specific-modeling-problems"></a>Ecore Solutions for Specific Modeling Problems</h3>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>How to Represent Parameterized Functions</p>
</li>
</ol>
</div>
<div class="paragraph">
<p><strong>TBD</strong></p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>How to Model Derived References and Attributes</p>
</li>
</ol>
</div>
<div class="paragraph">
<p><strong>TBD</strong></p>
</div>
<div class="paragraph">
<p>We haven&#8217;t used derived references or attributes by now. But if one has to implement some by providing a getter, it is necessary to return an unmodifiable list like BasicEList.UnmodifiableEList or EcoreUtil.unmodifiableList(&#8230;&#8203;) instead of EList as described here: <a href="https://www.ntnu.no/wiki/plugins/servlet/mobile?contentId=112269388#content/view/112269388" class="bare">https://www.ntnu.no/wiki/plugins/servlet/mobile?contentId=112269388#content/view/112269388</a> .</p>
</div>
</div>
<div class="sect2">
<h3 id="trueversioning-and-collaboration"><a class="anchor" href="#trueversioning-and-collaboration"></a>Versioning and Collaboration</h3>
<div class="paragraph">
<p><strong>TBD</strong></p>
</div>
</div>
<div class="sect2">
<h3 id="truesummary"><a class="anchor" href="#truesummary"></a>Summary</h3>
<div class="paragraph">
<p><strong>TBD</strong></p>
</div>
<div class="paragraph">
<p>Three hierarchies: Composition of objects, Inheritance of classes, Trees in user interface.</p>
</div>
<div style="page-break-after: always;"></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="trueaccessing-and-using-data-catalogs"><a class="anchor" href="#trueaccessing-and-using-data-catalogs"></a>Accessing and Using Data Catalogs</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="trueaccessing-xml-catalogs"><a class="anchor" href="#trueaccessing-xml-catalogs"></a>Accessing XML-Catalogs</h3>
<div class="paragraph">
<div class="title">Add Ecore data model to a third-party Java application</div>
<p><strong>TBD</strong></p>
</div>
<div class="paragraph">
<div class="title">Load XML Data Catalog and Access Corresponding Java Objects in Code</div>
<p><strong>TBD</strong></p>
</div>
<div class="paragraph">
<div class="title">Access from Python?</div>
<p><strong>TBD</strong></p>
</div>
</div>
<div class="sect2">
<h3 id="truecreate-insel-models-with-handlebars-templates"><a class="anchor" href="#truecreate-insel-models-with-handlebars-templates"></a>Create Insel Models with Handlebars Templates</h3>
<div class="paragraph">
<p>Handlebar templates to access data catalogs and create/parameterize textual simulation models.</p>
</div>
<div class="paragraph">
<div class="title">Parameterization of blocks</div>
<p><strong>TBD</strong></p>
</div>
<div class="paragraph">
<div class="title">Creation of submodels, e.g. computing parameterized functions</div>
<p><strong>TBD</strong></p>
</div>
</div>
</div>
</div>
</div>
<div id="footnotes">
<hr>
<div class="footnote" id="_footnotedef_1">
<a href="#_footnoteref_1">1</a>. A similar approach is in use to standardize extensions to CityGML via so called application domain extensions (ADE) like the energy ADE for exchanging energy related data.
</div>
<div class="footnote" id="_footnotedef_2">
<a href="#_footnoteref_2">2</a>. A comparable, but completely different approach would be to combine several web applications and services via portal software in web browsers.
</div>
<div class="footnote" id="_footnotedef_3">
<a href="#_footnoteref_3">3</a>. The notion of an Eclipse package has nothing to do with Java packages.
</div>
<div class="footnote" id="_footnotedef_4">
<a href="#_footnoteref_4">4</a>. Projects possess one or more <em>natures</em> used to define a project&#8217;s principal type.
</div>
<div class="footnote" id="_footnotedef_5">
<a href="#_footnoteref_5">5</a>. Or even work on the same workspace provided in the cloud, see <a href="https://www.eclipse.org/che/technology/">Eclipse Che</a>.
</div>
<div class="footnote" id="_footnotedef_6">
<a href="#_footnoteref_6">6</a>. AdoptOpenJDK recently joined the Eclipse foundation and soon will change its name to <em>Adoptium</em> for legal reasons.
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2020-09-14 11:07:03 +0200
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
<script>hljs.initHighlighting()</script>
</body>
</html>
For faster browsing, not all history is shown. View entire blame