0
0

Studio Reference Manual

Docs
2888 / 1
Docs EInnovator Posted 20 May 20

Data-Modeling

Many/Most software applications are used model some part or aspects of a real or virtual world — its domain. As such, application make use of a data-model to capture the structure, properties, and behaviors of the entities living in that domain. Entities are defined to have a set of properties, each with a name and a type. Property types can be simple such as number, string, and boolean, references to other entities, and collections or maps or such types. Entities are categorized as to belong to a class, something designed also as a structured type, defining a commonly set of properties that all members of the class have. At program execution time, many instances of a class will typically exist, possibly created and destroyed as needed.

About Entities

Entities define a type of objects in an application domain being modeled. Each entity will have a set of fixed (possibly optional or nullable) properties, each defining an attribute or characteristic of the instances of that entity. Other support object type may as well loosely be called an Entities such as Enum(erated) and Associations. In EInnovator App Studio entities thus have a (meta-)field named type or category for distinguish these different uses of *Entities. The all set of Entities and support types used by an application is called it Data Model, and constitutes one of the most important if not the most important element to consider when implementing an application and software solution in general.

Here is a few examples domains, and possibles entities and support types used as data-model:

  • ECommerce/EShop:
    • Entities: Product, ShoppingCart, Order, OrderItem, Recommendation, Stock, etc.
    • Enum: ProductCategory, OrderStatus, etc.
    • Enum: ProductCategory, OrderStatus, etc.

First step into creating an application is to define its data model. That is, the set of entities, associations, and support types together with their properties, that captures and represents the domain. For the Superhero project, we will use only one Entity named Superhero and one support Enum type named Squad.

Entity Superhero

Create entity of category Entity with name Superhero. Select as parent entity the built-in library entity EntityBase3*. This provides some basic fields to the Entity, like a unique id, a unique uuid, and creationDate.

Create another entity of category Enum with name Squad.

Open the dashboard for entity Superhero and add the properties below:

  • name of type String variant Text. Set as editor widget Input:Text. Enable filtering, and set as filtering property q with operator contains. Enable also the Table Column option. While these setting are not strictly necessary, they inform view and component generation with makes it easier and faster to get the app to prototype stage.

  • img of type String varient Image:URL. Set as editor widget Upload:Media.

  • description of type String variant Text. Se as editor widget Textarea. Enable filtering, and set as filtering property q with operator contains (same as for property name).

squad of type Squad (the enum you created earlier). Set as editor widget Select. Enable filtering for this property.

  • villian of type Boolean. Set as editor widget Checkbox.

Squad Enum

We already already created enumerated Squad but did not specify which values are possible. Open the dashboard for enum Squad, and navigate to the tab Dataset. Each enumerated can have a set of static values, each with two (and possibly other) properties, namely value and displayValue. Add two values to Squad:

  • MARVEL value, with displayValue = Marvel
  • DC value, with displayValue = DC

One-to-Many Association

So far the data-model in very simply in the sense that there is no association between entities. To make it more realistic and interesting let’s define an additional property named friends as a One-To-Many association between each Superhero and a set of other Superheros. Set the type of this property to List with element type Superhero.

Review the defined data-model in the the tab Data-Model > Data-Graph.

Something useful to do before moving forward is to generate a dummy dataset of instances of Entity for the purpose of later testing the app. In the dashboard of entity Supehero, tab Dataset click Generate Values. Select a instance count of 100. Confirm that 100 instance of dummy Supeheros have been created, using automatically generated value for the different properties, including name and description, and an identicon for the image.

Creating Entities

To create an Entity press Add New in the entity tab of the project details page.

Image below shows some an example of an Entity named Tour being created for project TravelTour.

Create Entity

Datasets

Comments and Discussion

Content