Thursday, April 22, 2010

Mapping from Ecore to the Actifsource Core (and back)

As I am currently implementing the import of models created with the Eclipse Modeling Framework (EMF) into actifsource I had to think about the mapping from ecore to the actifsource core (the mapping needs to be bidirectional such that actifsource models can be exported to ecore as well) . If you are already acquainted with modeling using EMF this blog posting should help you getting started modeling with actifsource very quickly.

As both ecore and actifsource core are self-describing meta-meta models it is not surprising that in their heart they are very similar. But the naming is a bit different:

ecore nameactifsource name
EPackagePackage
EObjectResource
ENamedElementNamedResource
EClassClass
EStructuralFeatureProperty
EAttributeAttribute
EReferenceRelation
EDataTypeLiteral
EEnumEnum
EEnumLiteralEnumValue

Visually compared:





As a first difference you can see that the actifsource diagram contains dotted relations between elements which correspond to an instance relation. Have you ever tried to change the type of an elment in the ecore model editor after you created it? It is not possible because the fact that one elment is a type of another comes implicitly into the ecore model.

In actifsource however, the fact that one Resource is an instance of some other is modeled by the typeOf Relation. Therefore, types of Resources can be changed as easily as any other property of the model. (The typeOf Relation is part of the Class Resource and therefore every Resource has it. That's where the self-describing plays an important role -- which can be rather confusing at first but you do not have to fully understand this to successfully model with actifsource!)

You might wonder why we did not just use ecore instead of the actifsource core when they look so similar. In the next blog posting I will analyze the differences of ecore and the actifsource core which will show you that the origin of the cores are fundamentally different.

No comments:

Post a Comment