Presentation is loading. Please wait.

Presentation is loading. Please wait.

Training Course Domain Modeling. 2 What is the Domain model? An abstract data model A reflection of reality No ERD, closer to entity-oriented models Consists.

Similar presentations


Presentation on theme: "Training Course Domain Modeling. 2 What is the Domain model? An abstract data model A reflection of reality No ERD, closer to entity-oriented models Consists."— Presentation transcript:

1 Training Course Domain Modeling

2 2 What is the Domain model? An abstract data model A reflection of reality No ERD, closer to entity-oriented models Consists of entities, attributes and associations

3 3 What is an entity? Something that exists in real life “Blueprint for Mendix entities” Examples: Car House Client Order Product Email message

4 4 How to add an entity? Click on the “Entity” button Click on the desired location Set the name of the entity in the “Properties” window

5 5 What is an attribute? “Provides information about an Entity” Client ← Name, Address, City Car ← Brand, Type Order ← OrderNumber, OrderDate

6 6 Attribute types AutoNumber(Automatically incrementing number) Binary Boolean(True or False) Currency DateTime Enumeration(Collection of predefined values) Float(Floating-point number: 1.12) HashString Integer(Small number) Long(Big number) String(Text)

7 7 How to add attributes to an entity? Double click on an entity Go the ‘Attributes’ tab page Click on the “Add” button Enter the “Name” Select “Type”

8 8 What are associations? “Indicates the relationship between entities” Car – Owner Order – Client Product – Product group Book - Author

9 9 Association types Basic – Reference Advanced – Reference Set – 1-1 Reference (Reference BOTH) – MN Reference (Reference Set BOTH)

10 10 What is a reference? With a reference you can refer from one entity to another entity In the given example the customer refers to country The ‘1 to 0’ reference is the most common kind of association Similar to ERD 1 – n relations Customer refers to 1 Country Country can be referenced by multiple customers The reference is stored in the Customer The cardinality can be read as follows:  Customer refers to 1 country  Country refers to 0 customers

11 11 Reference in XML The reference is stored in the owner of the association which is indicated by the arrow (‘Order’ in the given example) KLM id_201 Holland

12 12 How to add a reference? Click on the “Add association” button Click on the border of the meta entity (starting at the owner) Keep the mouse button pressed Drag the association to the border of the other entity

13 13 What is a reference set? With a reference set one entity refers to multiple other entities In the example the Customer refers to many Groups Similar to ERD ‘N – M relations’ Customer refers to N groups Group can be referenced by multiple customers The relation is recorded in the customer The cardinality can be read as follows:  Customer refers to N groups  Group refers to 0 Customers

14 14 Reference set in XML General Motors id_201 id_202 VIP Christmas cards The reference is stored in the owner of the association which is indicated by the arrow (Customer in the given example)

15 15 How to add a reference set? Add an association Click on the association Set the property “Type” to “ReferenceSet”

16 16 What is a reference both? This indicates that two entities always belong together Could also be modeled as one large entity In the example the customer refers to a profile and profile to customer Similar to ERD ‘1 – 1 relations’ Customer refers to 1 profile Profile then always refers to the same Customer The relation is stored in both Customer and Profile The cardinality can be read as follows:  Customer refers to 1 Profile  Profile refers to 1 Customer

17 17 Reference both in XML General Motors id_201 Profile_General Motors id_101 The reference is stored in the owner of the association which is indicated by the arrow (both Customer and Profile in the example)

18 18 How to add a reference both? Add an association Click on the association Set the property “Owner” to “Both”

19 19 What is a reference set both? With a reference set both, both entities refer to multiple other entities In the given example, the Customer refers to many Groups and vice versa Similar to ERD ‘N – M relations’ Hardly ever used Customer has maximum of N groups and vice versa Group can belong to multiple customers and vice versa The relation is stored in both Customer and Group The cardinality can be read as follows:  Customer refers to N groups  Group refers to N Customers

20 If one entity is deleted, an associated entity is deleted as well This is commonly used by – Reference both associations – When one entity in reality is modeled as two entities, for example: Order & OrderLine Can be defined on both the parent or the child of the association In the given example, the Profile will be deleted when the Customer is deleted 20 What is cascading delete?

21 Select the association Click the... Button in the “Delete behavior” in the explorer Select the desired delete behavior (2nd radio button) 21 How do I configure cascading delete?

22 This prevents an entity from being deleted if it is referenced by other entities This prevents the existence of orphans or invalid references in the database A message to the end user can be specified for each association Always specify a message when blocking a delete In the given example, a Country can’t be deleted if it is referenced by a Customer 22 What is delete prevention?

23 Select the association Click the... Button in the “Delete behavior” in the explorer Select the desired delete behavior and enter a message for the end user 23 How do I configure delete prevention?

24 24 Combining cascading delete & delete prevention Question: What happens if a continent is deleted that contains countries with customers? Countries can only be deleted if they are not referenced by any customer If a continent is deleted all countries are deleted as well

25 Before an entity is committed all validations rules are checked Validation rules apply to attributes If one rule is violated then the commit action will be cancelled For each rule you can specify an error message All messages are returned to the caller If the caller is the client portal, the messages will be shown in the data view Validation rules are visualized in the model (green check next to attribute) 25 What are validation rules?

26 There are different kinds of validation rules: – Required The attribute is required to have a value – UniqueThe values of this attribute is unique across all instances of an entity – EqualsThe value equals a predefined value or other attribute – RangeThe value lies between two other values (other attributes or fixed values) – Regular expressionThe value conforms to a regular expression – Maximum lengthThere is a maximum length for the attribute 26 What are validation rules?

27 Double click on the entity Open tab page “Validation rules” Click the “Add” button 27 How to configure validation rules?

28 Select the attribute Define an error message, that is shown when the rule is violated Select the type of validation rule Set the necessary values Click OK 28 How to configure validation rules?

29 A term ‘borrowed’ from Entity-Oriented programming A subentity inherits from a superentity. The subentity inherits all attributes including validation rules and associations of the superentity. The superentity is extended, also called specialization In the example both Customer and Employee are specializations from User 29 What is Generalization?

30 Customer has the attributes: – Address – Name – Password Employee has the attributes: – Function – Name – Password 30 What is Generalization?

31 Select the entity in the Domain model Click on the … button of the property “Generalization” Select the superentity in the explorer popup Click Select 31 How do I configure inheritance?

32 When entities have a number of common attributes (keeps the model clear) When entities can be generalized as a super entity When you want to use functionality from another module (e.g. the System model) When two entities need to be displayed in one list (only shows the common attributes) 32 When to use Generalization?

33 Performance reduction through complex joins on database Challenging when used in combination with complex business logic and validation rules It becomes difficult to oversee implications of changes to the domain model when a lot of generalization is used 33 Generalization Drawbacks


Download ppt "Training Course Domain Modeling. 2 What is the Domain model? An abstract data model A reflection of reality No ERD, closer to entity-oriented models Consists."

Similar presentations


Ads by Google