• No results found

5.4 Foundational Definitions

5.4.2 Modelling Language Model

Meta models can be instantiated by models. When meta models are instantiated, instances of their classes are created, values are assigned to attributes, and targets are set for references, following the defined relations between abstract syntax elements of the meta model. Figure 5.13 accompanies the following definitions as an overview of the elements of models, their relation- ships to each other and to meta model elements. The upper part of Figure 5.13 shows the modeling language meta model elements defined above. The middle and the lower part show language models, their elements and their interconnections with each other and with a language meta model.

Language Meta Model

Rerefence

is a name name

name

Class Attribute Data Type

Containment Label isOfType isOfType has has Object Literal Label Language Model references hasValue

instanceOf instanceOf instanceOf

Reference Language Models Referenced Language Modes 1 Referenced Language Modes 2 Referenced Language Model n ... uses is a

Relation within the

model or meta model Ternary relation withinthe model Relation from themodel to the meta model

Figure 5.13: An overview of the elements of models, their relations to each other and to meta model elements

5.4 Foundational Definitions

Definition 9: Modelling Language Model

A model M is an instance of a meta model MM eta. It is defined as a tuple

M = (MM eta, O, V, N, F, R), where

• MM eta is the meta model of the model, • O is a set of objects building the model,

• V is a set of value literals, with a typing function −−−−−−→: V → DisOf T ype MM eta • N ⊆ V is a set of labels,

• F is a set of relations and functions, that define the interconnection of the objects, data types of the meta model, value literals, and abstract syntax elements of the meta model, subsequently defined in the following definitions.

• R is a set of models which are referenced by this model.

A meta model is instantiated by defining objects, assigning attribute values, and targets to references of objects, in correspondence to the rules defined by the meta model.

Definition 10: Meta Model Instantiation

A model M instantiates a meta model MM eta by instantiating the classes ClassesMM eta

with objects OM (see Definition 11), assigning values to attributes (see Definition 12), and assigning targets to references (see Definition 13).

Objects instantiate classes. They are typed by their classes. Definition 11: Class Instantiation

An object instantiates a class. For a meta model, its classes Classes, a model of that meta model and its objects O, the function

instanceOf

−−−−−−−→: O → Classes returns the class that an object instantiates.

Values can be assigned to the attributes of an object’s class. Definition 12: Assigning Values to Attributes

For a meta model, its attributes Attributes, a model of that meta model, its objects O, and its value literals V , the relation

hasV alue

−−−−−−→⊆ O × Attributes × V

5 Model Integration Concept

Attributes, and a value literal v ∈ V , this assignment can also be written: o.a−−−−−−→ v, or value(o.a) = vhasV alue

E.g. for an object o ∈ O, an attribute a ∈ Attributes that is owned by the class that o instantiates (i.e. o−−−−−−−→ c ∧ cinstanceOf −−→ a), with name(a) = id, and a value literal 1:has

o.id−−−−−−→ 1hasV alue

Constraint 2: Values can only be Assigned to Attributes of an Object’s Class It is only possible to assign values to attributes for an object, when the attribute is owned by the object’s class. Let o be an object, a be an attribute, and v be a value literal. Then

(o, a)−−−−−−→ v =⇒ ∃c ∈ Classes : ohasV alue −−−−−−−→ c ∧ cinstanceOf −−→ ahas

Constraint 3: Value Assignments of Attributes must respect the Attribute’s Type

The assignment of a value to an attribute for an object must respect the attribute’s type. For a meta model, its class c ∈ Classes, its attribute a ∈ Attributes, its data type d ∈ D, a model of the meta model, and its object o ∈ O, the following must be true:

(o, a)−−−−−−→ v ∧ ohasV alue −−−−−−−→ c ∧ cinstanceOf −−→ a ∧ ahas −−−−−−→ d =⇒ visOf T ype −−−−−−→ disOf T ype

Targets are assigned to references for objects. Target assignments respect the target type and the cardinality of the reference.

Definition 13: Assigning Targets to References

An object can assign targets to references owned by its class. For a meta model, its references Ref erences, a model of that meta model, and its objects O, the relation

ref erences

−−−−−−−→⊆ O × Ref erences × O assigns a target to a reference for a source object.

Let MM eta be a meta model, with csource, ctarget ∈ ClassesMM eta and

r ∈ Ref erencesMM eta. The reference is owned by csource and targets ctarget:

csource has

−−→ r, r−−−−−−→ cisOf T ype target.

Now let M −−−−−−−→ MinstanceOf M eta be a model of that meta model, with two objects

osource, otarget ∈ OM, with osource

instanceOf

−−−−−−−→ csource ∧ otarget −−−−−−−→ cinstanceOf target. Then the assignment (osource, r, otarget) ∈

ref erences

−−−−−−−→ can be written as follows: (osource, r)

ref erences

5.4 Foundational Definitions When the name of the reference is given, it can also be written in a short hand notation. Let the reference be named as follows: name(r) = child, then the assignment can be written as follows:

osource.child

ref erences

−−−−−−−→ otarget

Constraint 4: Targets can only be Assigned to References of an Object’s Class It is only possible to assign targets to references for an object, when the reference is owned by the object’s class.

Let osource be a source object, r be a reference, and otarget be a target object. Then

(osource, r)

ref erences

−−−−−−−→ otarget =⇒ ∃c ∈ Classes : osource

instanceOf

−−−−−−−→ c ∧ c−−→ rhas Constraint 5: Target Assignments of References must respect the Reference’s Type

The assignment of targets to references must respect the reference’s type. Let osourcebe a source object, r be a reference, and otarget be a target object. Then

(osource, r)

ref erences

−−−−−−−→ otarget =⇒ ∃c ∈ Classes : otarget

instanceOf

−−−−−−−→ c ∧ r−−−−−−→ cisOf T ype Constraint 6: Target Assignments of References must respect the Reference’s Cardinality

The assignment of targets to references must respect the reference’s cardinality. Let s be a source object, and r be a reference. Let −−−−−−−→ref erences s,r⊆−−−−−−−→ be the set of targetref erences assignments (s, r, o) for the reference r and the source object s. Then for all −−−−−−−→ref erences s,r:

r−−−−−−−→ 0..1 =⇒ 0 ≤cardinality ref erences −−−−−−−→s,r ≤ 1 r−−−−−−−→ 0..* =⇒ 0 ≤cardinality ref erences −−−−−−−→s,r ≤ ∞ r−−−−−−−→ 1..* =⇒ 1 ≤cardinality ref erences −−−−−−−→s,r ≤ ∞ r−−−−−−−→ 1..1 =⇒ 1 ≤cardinality ref erences −−−−−−−→s,r ≤ 1

5 Model Integration Concept

A model can reference other models. This means that all objects, literal values, string labels, and the functions and relations of the referenced models can be used in the referencing model.

Definition 14: Model Dependencies

For a model M = (MM eta, O, V, N, F, R), the set R declares models on which M depends. All objects o ∈ O, value literals v ∈ V , and functions and relations f ∈ F of dependencies r ∈ R can be used in the model M as if they were contained in the model itself.

Dependencies can span multiple levels. I.e. a model M1 that depends on a model M2 can itself be the dependency of another language M0.