• No se han encontrado resultados

SECCIÓN II. METODOLÓGICA, DIAGNÓSTICO Y RESULTADO.

2.3 Valoración de la propuesta a partir de los evaluadores externos

The first transformation that will be defined is a transformation of plain objects of a regular class type. The corresponding type level transformation can be found in Section 5.2.1. This transformation introduces an arbitrary amount of instances of the class introduced on the type level. First, the definition of the corresponding instance model is given.

Definition 5.3.1(Instance modelImClass)

Let ImClassbe the instance model containing a set of objects objects which are all typed by classname. Furthermore, an injective functionf idis defined which maps every object in the set to its corresponding identifier. ImClass is typed by T mClass (Definition 5.2.1) and is defined as:

Object=objects

ObjectClass = {︂(ob, name) if ob∈objects

ObjectId = {︂(ob, f id(ob)) if ob∈objects

FieldValue ={}

DefaultValue ={}

Also see imod_class in Ecore-GROOVE-Mapping-Library.ClassInstance

Theorem 5.3.2 (Correctness ofImClass)

ImClass (Definition 5.3.1) is a valid instance model in the sense of Definition 3.2.19.

Also see imod_class_correct in Ecore-GROOVE-Mapping-Library.ClassInstance

A visual representation ofImClass with objects ={ob} and f id(ob) = xcan be seen in Figure 5.10a.

Although this visualisation only shows one object, it is possible to have an arbitrary amount of objects in ImClass, as long as they are all typed by the corresponding class introduced on the type level. In

the visualisation, the identifier .Example is used for the class, in correspondence with Figure 5.1a The correctness proof ofImClass is trivial, and therefore not included here. The proof can be found as part

of the Isabelle validated proofs.

In order to make composing transformation functions possible, ImClass should be compatible with the

instance model it is combined with.

Theorem 5.3.3 (Correctness ofcombine(Im, ImClass))

Assume an instance model Im that is valid in the sense of Definition 3.2.19. Then Im is compatible withImClass (in the sense of Definition 4.4.14) if:

• All requirements of Theorem 5.2.3 are met, to ensure the combination of the corresponding type models is valid;

x :Example

(a)ImClasswith one object identified asx

x:Example

(b)IGClasswith one node identified asx

• All the objects inImClass have an (internal and explicit) identity that is not yet used in Im.

Also see imod_class_combine_correctin Ecore-GROOVE-Mapping-Library.ClassInstance

Proof. Use Lemma 4.4.13. It is possible to show that all assumptions hold. Now we have shown that

combine(Im, ImClass)is consistent in the sense of Definition 3.2.19.

Please note that this combination is quite trivial, as the newly introduced objects cannot have fields. This is because they are all typed by the new class type introduced in T mClass. Since this new class

type is new by assumption, the existing model cannot have fields defined for the class type.

The definitions and theorems for introducing plain objects of regular classes within Ecore are now com- plete.

Encoding as nodes

A possible encoding for plain objects in Ecore is using nodes in GROOVE. Each node is typed by the node type that was introduced inT GClass, and copies the identifiers set of the objects to the corresponding

nodes. The encoding corresponding to ImClass can then be represented as IGClass, defined in the

following definition:

Definition 5.3.4(Instance graphIGClass)

Let IGClass be the instance graph with as nodes the converted objects of ImClass (Definition 5.3.1). Furthermore, reuse the injective function f id that maps every object to its identifier. Finally, use the node type introduced in T GClass (Definition 5.2.4). IGClass is defined typed byT GClass and is defined as:

N=objects E={}

ident = {︂(f id(ob), ob) if ob∈objects with

typen= {︂(ob,ns_to_list(name)) if ob∈objects

Also see ig_class_as_node_typein Ecore-GROOVE-Mapping-Library.ClassInstance

Theorem 5.3.5 (Correctness ofIGClass)

IGClass (Definition 5.3.4) is a valid instance graph in the sense of Definition 3.3.10.

Also see ig_class_as_node_type_correct in Ecore-GROOVE-Mapping-Library.ClassInstance

A visual representation of IGClass with objects ={ob} and f id(ob) = xcan be seen in Figure 5.10b.

Like the previous example for the Ecore instance model, only one node is shown here, but multiple nodes can be introduced at once if there are more objects in the objects set. As shown in the definition, the node type identified byExampleis used to type all the nodes, in correspondence with Figure 5.1b. The correctness proof ofIGClassis trivial, and therefore not included here. The proof can be found as part

of the Isabelle validated proofs.

In order to make composing transformation functions possible,IGClass should be compatible with the

instance graph it is combined with.

Theorem 5.3.6 (Correctness ofcombine(IG, IGClass))

Assume an instance graphIG that is valid in the sense of Definition 3.3.10. ThenIG is compatible with IGClass (in the sense of Definition 4.4.25) if:

• All requirements of Theorem 5.2.6 are met, to ensure the combination of the corresponding type graphs is valid;

• All the nodes in IGClass have an (internal and explicit) identity that is not yet used inIG.

Also see ig_class_as_node_type_combine_correct in

Ecore-GROOVE-Mapping-Library.ClassInstance

Proof. Use Lemma 4.4.24. It is possible to show that all assumptions hold. Now we have shown that

The next definitions define the transformation function fromImClass toIGClass: Definition 5.3.7(Transformation functionfClass)

The transformation functionfClass(Im)is defined as:

N =ObjectIm E={}

ident = {︂(f id(ob), ob) if ob∈ObjectIm with

typen= {︂(ob,ns_to_list(name)) if ob∈ObjectIm

Also see imod_class_to_ig_class_as_node_typein

Ecore-GROOVE-Mapping-Library.ClassInstance

Theorem 5.3.8 (Correctness offClass)

fClass(Im)(Definition 5.3.7) is a valid transformation function in the sense of Definition 4.4.26 trans- formingImClass intoIGClass.

Also see imod_class_to_ig_class_as_node_type_funcin

Ecore-GROOVE-Mapping-Library.ClassInstance

The proof of the correctness offClasswill not be included here. Instead, it can be found in the validated

Isabelle theories. The proof is quite trivial, as extendingImcan only add extra objects, but not remove the existing ones.

Finally, to complete the transformation, the transformation function that transforms IGClass into ImClassis defined:

Definition 5.3.9(Transformation functionfClass′ )

The transformation functionfClass′ (IG)is defined as:

Object=NIG

ObjectClass = {︂(ob, name) if ob∈NIG

ObjectId = {︂(ob, f id(ob)) if ob∈NIG

FieldValue = {}

DefaultValue ={}

Also see ig_class_as_node_type_to_imod_classin

Ecore-GROOVE-Mapping-Library.ClassInstance

Theorem 5.3.10 (Correctness offClass′ )

fClass′ (IG) (Definition 5.3.9) is a valid transformation function in the sense of Definition 4.4.31 trans- formingIGClass intoImClass.

Also see ig_class_as_node_type_to_imod_class_funcin

Ecore-GROOVE-Mapping-Library.ClassInstance

Once more, the correctness proof is not included here but can be found in the validated Isabelle proofs of this thesis.

5.3.2

Abstract classes

In this section, the instance level transformation corresponding to the type level transformation of ab- stract classes is discussed. The type level transformation of abstract class types can be found in Sec- tion 5.2.2.

Informally speaking, it is quite weird to think about the transformation of abstract classes on the instance level, as abstract classes cannot have instances. The transformation here is included for completeness, to allow for adding abstract types while working with transformations on the type level. In practice, the

instance level will consist of the empty instance model and empty instance graph, showing that after adding an abstract class on the type level, instances of the type model will still be valid.

First, the corresponding instance model is introduced.

Definition 5.3.11 (Instance modelImAbsClass)

Let ImAbsClass be the empty instance model Imϵ (Definition 4.4.9), except that it is typed by the type model T mAbsClass (Definition 5.2.11).

Also see imod_abstract_classin Ecore-GROOVE-Mapping-Library.AbstractClassInstance

Theorem 5.3.12 (Correctness ofImAbsClass)

ImAbsClass (Definition 5.3.11) is a valid instance model in the sense of Definition 3.2.19.

Also see imod_abstract_class_correctin

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

SinceImAbsClass does not define any objects, there is no need for a visual representation. However, in

order to make composing transformation functions possible,ImAbsClassshould still be compatible with

the instance model it is combined with.

Theorem 5.3.13 (Correctness ofcombine(Im, ImAbsClass))

Assume an instance model Im that is valid in the sense of Definition 3.2.19. Then Im is compatible withImAbsClass (in the sense of Definition 4.4.14) if:

• All requirements of Theorem 5.2.13 are met, to ensure the combination of the corresponding type models is valid.

Also see imod_abstract_class_combine_correctin

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

Proof. Use Lemma 4.4.13. It is possible to show that all assumptions hold. Now we have shown that

combine(Im, ImAbsClass)is consistent in the sense of Definition 3.2.19.

The definitions and theorems for the Ecore instance model corresponding to T mAbsClass are now com-

plete.

The node type encoding

As has been shown earlier, an possible encoding for abstract class types is by introducing an abstract node type. This has been done inT GAbsClass. Like the Ecore instance model, the GROOVE instance

graph is also empty, because abstract node types cannot be instantiated. This gives rise toIGAbsClass,

which is defined as follows:

Definition 5.3.14 (Instance graphIGAbsClass)

Let IGAbsClass be the empty instance graph IGϵ (Definition 4.4.20), except that it is typed by the type graph T GAbsClass (Definition 5.2.14).

Also see ig_abstract_class_as_node_type in

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

Theorem 5.3.15 (Correctness ofIGAbsClass)

IGAbsClass (Definition 5.3.14) is a valid instance graph in the sense of Definition 3.3.10.

Also see ig_abstract_class_as_node_type_correctin

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

In order to make composing transformation functions possible, IGAbsClass should be compatible with

the instance graph it is combined with.

Theorem 5.3.16 (Correctness ofcombine(IG, IGAbsClass))

Assume an instance graphIG that is valid in the sense of Definition 3.3.10. ThenIG is compatible with IGAbsClass (in the sense of Definition 4.4.25) if:

x :NewType

(a)ImSubclasswith one object identified asx

x:NewType

(b) IGSubclass with one node identified asx

Figure 5.11: Visualisation of the transformation of objects typed by a subclass

• All requirements of Theorem 5.2.16 are met, to ensure the combination of the corresponding type graphs is valid.

Also see ig_abstract_class_as_node_type_combine_correctin

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

Proof. Use Lemma 4.4.24. It is possible to show that all assumptions hold. Now we have shown that

combine(IG, IGAbsClass)is valid in the sense of Definition 3.3.10.

The next definitions define the transformation function fromImAbsClass toIGAbsClass: Definition 5.3.17 (Transformation functionfAbsClass)

The transformation function fAbsClass(Im) is defined as the function that always outputs the empty instance graphIGϵ (Definition 4.4.20), except that it is typed byT GAbsClass.

Also see imod_abstract_class_to_ig_abstract_class_as_node_typein

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

Theorem 5.3.18 (Correctness offAbsClass)

fAbsClass(Im) (Definition 5.3.17) is a valid transformation function in the sense of Definition 4.4.26 transforming ImAbsClass intoIGAbsClass.

Also see imod_abstract_class_to_ig_abstract_class_as_node_type_funcin

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

The proof of the correctness of fAbsClass will not be included here. Instead, it can be found in the

validated Isabelle theories. Obviously, the proof is trivial, as the function does not do any conversion. It does just output the empty instance model.

Finally, to complete the transformation, the transformation function that transforms IGAbsClass into ImAbsClassis defined:

Definition 5.3.19 (Transformation functionfAbsClass′ )

The transformation function fAbsClass′ (IG) is defined as the function that always outputs the empty instance modelImϵ (Definition 4.4.9), except that it is typed by T mAbsClass.

Also see ig_abstract_class_as_node_type_to_imod_abstract_classin

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

Theorem 5.3.20 (Correctness offAbsClass′ )

fAbsClass′ (IG) (Definition 5.3.19) is a valid transformation function in the sense of Definition 4.4.31 transforming IGAbsClass intoImAbsClass.

Also see ig_abstract_class_as_node_type_to_imod_abstract_class_funcin

Ecore-GROOVE-Mapping-Library.AbstractClassInstance

Once more, the correctness proof is not included here but can be found in the validated Isabelle proofs of this thesis.

Documento similar