diff --git a/ParameterCatalogs.html b/ParameterCatalogs.html index 4b1ace44bbe61ac1c625be05995973071b510c65..b7d97db685c26f913c3e375f0cc3b5628a5bb768 100644 --- a/ParameterCatalogs.html +++ b/ParameterCatalogs.html @@ -484,14 +484,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
-

This work by Kai-Holger Brassel, Hamburg, is licensed under CC BY-NC-ND 4.0 +

This work by Kai-Holger Brassel, Hamburg, is licensed under CC BY-NC-ND 4.0 cc by nc nd

-

Version: October 19th, 2020.

+

Version: November 9th, 2020.

@@ -1026,16 +1026,103 @@ It contains links to exhaustive documentation on concept, features and usage of
-

For now, you can dismiss the welcome screen. It can be opened anytime by executing Help → Welcome

+

For now, you can dismiss the welcome screen. It can be opened anytime by executing Help → Welcome. +Now you should see the initial layout of Eclipse with Model Explorer and Outline on the left and a big empty editing area to the right with a Properties view below.

Modeling Parameter Catalogs for Simulation with Ecore

+
+
-

Now you should see the initial layout of Eclipse with Model Explorer and Outline on the left and a big empty editing area with Properties view below to the right.

+

There are two hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.

+
+
+
+— Phil Karlton / N.N. +
-

Since we will use Ecore diagrams for data modeling, create your first Ecore modeling project now:

+

It takes time and effort to come along with good names for model entities, projects, files, and so on. +Also, specific naming conventions are in place to enhance readability of models and program code. +Since it is not always clear where names provided during modeling are used later, I compiled a list of names important in Ecore projects and added examples and comments to elucidate their meaning and naming conventions.

+
+ + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 1. Naming
NameDemo Catalog ExampleReal World Expample

Namespace URI

http://example.org/democatalog

http://hft-stuttgart.de/buildingphysics

Namespace Prefix

democat

buildphys

Base Package (reverse domain)[8]

org.example

hft-stuttgart.de

Main Package

democatalog

buildingphysics

Eclipse Project[9]

org.example.democatalog

de.hft-stuttgart.buildingphysics

Class Prefix

Democatalog

Buildingphysics

XML File Suffix

democatalog

buildingphysics

Classes

e.g. SolarPanel

e.g. WindowType

Attributes

e.g. nominalPower

e.g. id

Associations

e.g. solarPanels

e.g. windowTypes

+
+

Classes are written in Camel case notation starting with an upper case letter. Associations and attributes are written the same way, but starting with a lower case letter.

+
+
+

All other names should be derived from the globally unique name space of the project, in our example: example.org/democatalog. +It consists of a global unique domain name and a path to the project, unique within that domain.

+
+
+

Use the names of example Demo Catalog to create your first Ecore modeling project:

    @@ -1043,13 +1130,13 @@ It contains links to exhaustive documentation on concept, features and usage of

    Execute File → New → Ecore Modeling Project from main menu — not Modeling Project!

  1. -

    Name it demo.catalog and click Next >

    +

    Name the project org.example.democatalog and uncheck Use default location so that the new project is not stored in workspace but a different directory you create/choose, then click Next >

  2. -

    Uncheck Use Default Location so that the new project is not stored in workspace, but a different directory you create/choose, then click Next >

    +

    Provide democatalog as main Java package name, uncheck Use default namespace parameter and provide http://example.org/democatalog as Ns URI and democat as Ns prefix

  3. -

    Provide democatalog as main Java package name and click Finish.

    +

    Click Finish.

@@ -1149,7 +1236,7 @@ Instead of artificial example classes like Foo and Bar it show
-8068a4d732d1847a062d97696687b38f +28c119036261e39473751e5cb111acc9
Figure 4. Principle Structure of a Parameter Catalog
@@ -1174,7 +1261,8 @@ Compositions are depicted as a link with a diamond shape attached to the contain
-

Note that class names — despite the fact that they model a set of similar objects — are always written in singular! They are written in Camel case notation 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.

+

Note that class names — despite the fact that they model a set of similar objects — are always written in singular! +Names for list-like associations and attributes usually are written in plural form.

@@ -1188,7 +1276,8 @@ Instead, we add a super class to define common attributes and associati

In our example above, common to all four energy components are attributes modelName and revisionYear, thus these are modeled by class EnergyComponent that is directly or indirectly a super class of Boiler, CombinedHeatPower, SolarPanel, and Inverter. -Similar, Boiler and CombinedHeatPower share attribute installedThermalPower factored out by class ChemicalEnergyDevice.

+Similar, Boiler and CombinedHeatPower share attribute installedThermalPower factored out by class ChemicalDevice. +SolarPanel and Inverter share attribute nominalPower modeled in abstract class ElectricalDevice.

Associations
@@ -1407,7 +1496,7 @@ Note that Eclipse synchronizes different editors of the same content automatical
-Homework +Homework
Figure 8. Example Model (Homework)
@@ -1421,10 +1510,10 @@ I would like to tell you that this is done with just one click but, actually, yo

Make sure all files are saved (File → Save All)

  • -

    Execute Generate → Model Code from context menu over democatalog.ecore

    +

    Execute Generate → Model Code from the context menu of Ecore editor democatalog

  • -

    Execute Generate → Edit Code from context menu over democatalog.ecore

    +

    Execute Generate → Edit Code from the same context menu

  • @@ -1445,7 +1534,7 @@ I would like to tell you that this is done with just one click but, actually, yo

    This would create code for a simple user interface, but we use more advanced EMF Forms for that later. -If, by mistake, project demo.catalog.editor was created, just delete it from Model Explorer and do not forget to check Delete project contents on disk in confirmation dialog.

    +If, by mistake, project org.example.democatalog.editor was created, just delete it from Model Explorer and do not forget to check Delete project contents on disk in confirmation dialog.

    @@ -1460,10 +1549,10 @@ If, by mistake, project demo.catalog.editor was created, just delet
    Figure 9. Generated Classes
    -

    Generate → Model Code creates classes that represent the modeled data in code. These classes are located in three packages under directory src-gen in demo.catalog.

    +

    Generate → Model Code creates classes that represent the modeled data in code. These classes are located in three packages under directory src-gen in org.example.democatalog.

    -

    Generate → Edit Code creates a whole new Eclipse project named demo.catalog.edit, again with generated classes under directory src-gen.

    +

    Generate → Edit Code creates a whole new Eclipse project named org.example.democatalog.edit, again with generated classes under directory src-gen.

    You may have a look at some Java classes for curiosity by double clicking at them in Model Explorer. There is no point in trying to understand the code in detail, but observe token @generated present in the comments of all classes, fields and methods. Classes, fields and methods marked with this token are (re)generated whenever above commands are executed.

    @@ -1495,10 +1584,10 @@ To find out what user interface controls and layouts are provided by this framew
    1. -

      From context menu over democatalog.ecore execute EMF Forms → Create View Model Project

      +

      In the Model Explorer execute EMF Forms → Create View Model Project from context menu over democatalog.ecore

    2. -

      Leave project name demo.catalog.viewmodel as is but uncheck Use default location — as we always do — and browse to the directory containing demo.catalog

      +

      Leave project name org.example.democatalog.viewmodel as is but uncheck Use default location — as we always do — and browse to the directory containing org.example.democatalog

    3. Click Next > and select EnergyComponentsCatalog as data element we want to create a user interface for

      @@ -1509,7 +1598,7 @@ To find out what user interface controls and layouts are provided by this framew
    -

    According to these inputs a new project is created with file EnergyComponentsCatalog.view under directory view models. +

    According to these inputs a new project is created with file EnergyComponentsCatalog.view under directory viewmodels. This file opens automatically in a special View Editor.

    @@ -1564,7 +1653,7 @@ You can even create new boilers or other objects in lists provided, with all for

    Of course, such automatic approach has its limits. -In our case, to have a long list of lists is not very user-friendly, because one has to scroll up and down to find a specific list. +In our case, a long list of lists is not very user-friendly, because one has to scroll up and down to find a specific list. Also, no specific object data are shown in the list and data can only be edited in a pop-up form (no inline editing).

    @@ -1716,7 +1805,7 @@ So, saving a form before the focus has shifted from the last edited field won Alas, instead a list of lists we have got an even bigger list of tables.

    -

    High time to introduce a master-detail view that presents categories of object types in a master view and, after one is selected, the according object table as detail.

    +

    High time to introduce a master-detail view that presents categories of object types in a master view and, after one is selected, the according object table in the detail view.

    @@ -1786,8 +1875,8 @@ In fact, this feature gives us a fully functional prototype. At least during refinement of model and UI, data sets can be created, edited, and tested for usability without the need to built a full blown, deployable application — see parts Accessing and Using Parameter Catalogs and Build (Parameter Catalog) Applications with Eclipse Tycho below.

    -

    Be aware that in some cases the view model must adapt to changes in the data model, e.g. a new leaf category and table component has to be created for a new catalog object type. -Other changes are automatically reflected in the generated UI, at least for default forms and other UI elements. +

    Be aware that in some cases the view model must adapt to changes in data model, e.g. a new leaf category and table component must be created for a new catalog object type. +Other changes are automatically reflected in the generated UI, at least for default forms and default table columns. To our convenience, view model specifications incompatible with data model are indicated by error badges in the View Editor.

    @@ -1801,15 +1890,15 @@ To our convenience, view model specifications incompatible with data model are i

    We created a graphical Ecore data model with a catalog class and five classes/types of objects therein. -Classes have been defined by name, attributes, and relations between, often with cardinalities. +Classes have been defined by name, attributes, and relations between them, often with cardinalities. Whenever classes shared some attributes or references we factored these out into super classes. -An enumeration introduced a new attribute type from a set of named values.

    +An enumeration introduced a new attribute type as a set of named values.

    -

    From this data model, we issued commands to create matching Java code for representing the data in memory as well as to store and retrieve them on and from disk. Methods to create, read, update and delete data objects (CRUD) were generated, too.

    +

    From this data model, we issued commands to create Java code for representing the data in memory as well as to store and retrieve them on and from disk. Methods to create, read, update and delete data objects (CRUD) were generated, too.

    -

    Lastly, we thought about a good user interface for this data and used EMF Forms to model and prototype it.

    +

    Lastly, we thought about a good user interface for this data and used EMF Forms to model it resulting in a full functional prototype.

    @@ -2077,10 +2166,16 @@ Verify that Maven version 3.6.3 or above is now installed in Window →
    7. Please stay away from version 2020-03 and 2020-06 of Eclipse Modeling Tools, since these came with a bug preventing the user from editing data in table cells within the generated UI.
    +
    +8. https://en.wikipedia.org/wiki/Reverse_domain_name_notation +
    +
    +9. https://wiki.eclipse.org/Naming_Conventions#Eclipse_Workspace_Projects +
    diff --git a/ParameterCatalogs.pdf b/ParameterCatalogs.pdf deleted file mode 100644 index 0bc31317b1e5f85b0e9d507f3a7b1903c078331b..0000000000000000000000000000000000000000 Binary files a/ParameterCatalogs.pdf and /dev/null differ