Visual Model For F# – Metamodel

Metamodel

Metamodel in computer science is a set of concepts in a certain area. If the model is an abstraction of a phenomenon, a metamodel is an abstraction that represents the properties of this model. In this post discusses the modeling language metamodel presented in previous threads. The proposed metamodel is shown in the schematic diagram of classes (Figure 1) below. The figure shows the concept of the metamodel, elements that compose it, and the relationship between these elements.

Uproszczony diagram klas przedstawiający metamodel z projektu pracy magisterskiejFigure 1: Simplified diagram showing the metamodel classes

Metamodel has been built using the tools of Microsoft DSL Tools. With this tool, you could create its domain-specific language (called DSL), which has been discussed in previous posts showing the proposed solution.

With meta-concepts outlined below, you can create models of programs for functional language F#. The effective way to create models and generate skeletons functional programs. For the proposed and assumed level of abstraction can be partially generate code F#, the rest of the implementations need to be filled manually. Plugin does not allow for full generation source modeled for modeled programs.

This is not a full metamodel covering all aspects of the functional language F#, but a subset of the most important elements. In the future, it can extend the metamodel with new elements and the more detail.

In the below parts of metamodel (Figure 2 and Figure 3) shows that in the main element RootModel are code blocks CodeBlock. RootModel element can contain any number of elements CodeBlock, but each CodeBlock can be only in one RootModel. Then the elements can lead CodeBlock relation to any number of elements TypeElement or Function. As for the element TypeElement, the relationships are really defined in the section of operations, i.e. the part of Operations. Function element can take only one element of the relationship of CodeBlock.

Fragment metamodelu 1

Figure 2: First part of metamodel

Fragment metamodelu 1 cd.

Figure 3: Second part of metamodel

The following diagram (4) represents a different piece of metamodel. It shows that TypeElement element may consist of any number of elements of an Attribute or Operation, which is actually in the sections Attributes and Operations for the item TypeElement can add any number of elements. But every element of an Attribute or Operation must be defined in only one element TypeElement. TypeElement element can have one relationship to another element of inheritance TypeElement. TypeElement element relationships can take many generalizations, i.e. it can reach many relationships ended tip.

Fragment metamodelu 2

Figure 4: Part of metamodel 2

The following Figure 5 shows a fragment of another metamodel. Important element is a Compound. It is an abstract element in the metamodel, after which the field of two other domain classes: RootModel and Module. This means that these two elements can contain any number of elements such as: TypeElement, Module and Function. However, each of these three elements are in RootModel or Module. Among other things, this diagram can be deduced that the modules can be nested in itself.

Fragment metamodelu 3

Figure 5: Part of metamodel 3

Figure 6 shows a metamodel-fragment, showing that such a domain class as: TypeElement, Attribute, Operation, and Function CodeBlock, NamedElement element inherit. The latter has a property called Name, which inherit all the other classes.

Fragment metamodelu 4

Figure 6: Part of metamodel 4

Constraints

The restrictions that exist on these diagrams metamodel automatically define the modeling language syntax. Models can be created according to the metamodel-constraints. In addition to these core mentioned above, there are other, hidden in the source code of the project.

Inheritance relationships between elements can be created only TypeElement at the same level of nesting, when it comes to modules, or only in the main area of modeling, i.e. RootModel. Unions can not create a generalization between the two types that are in different modules. The same limitation occurs when the compound is to be created between the main area and a modeling module.

Another limitation relates to Link to Operation element. This compound can be run between a block of code CodeBlock Operations section in the element TypeElement. Binding of the relationship end of the arrow is located exactly at the site of operation in the Operations section in the element TypeElement.

Not all the F # language elements can be modeled by so defined metamodel. The plugin can be expanded with new elements in its future releases..

adamex

About Adam Bielasty

.NET Software Developer

Leave a Reply

Your email address will not be published. Required fields are marked *


× 1 = 3

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>