Core Model Meta Meta-Model
Table of Contents
Overview Core Model
Every meta-model is based on the Actifsource Core Model. Make sure that you understand the concepts of Resource, Class and Property before you start creating your own meta-model.
Resource
In Actifsource everything is a Resource. That means that every Resource you create extends the Resource. Even Resource extends Resource, so that the core model can describe itself.
If the Resource shall has a name you can extend from NamedResource.
Class
Creating your own meta-model you have to specify a set of classes and their relationships. The Core Model therefore provides you a NamedResource called Class. Class is the only Resource in Actifsource that can be instantiated where in this context we mean by instantiate that there is a typeOf relation. For that reason Resource is of type Class and Class extends NamedResource.
This recursive definition becomes necessary as the Actifsource core model has to describe itself. You can say that the Actifsource core model is meta-model of itself.
Property
Any information is modelled by a property. Specifying your own class therefore also means specifying all properties of this class.
There are different types of properties.
Property
The property acts as an abstract base class. Please note that properties are fully typed. In Actifsource the type of a property is named range.
Every resource that can be referenced by a range has to be of type AbstractType. One abstract type you already know by now is Class.
-
SubjectCardinality The Property defines the subject cardinality which determines how many resources of type B can be referenced by a resource of type A via relation b.
You may choose one of the following predefined cardinality instances.
It is also possible to define any other cardinality just by specifying minCardinality and maxCardinality.
-
Relation The relation acts as an abstract base class for any relation property between classes.
-
Extends The relation extends allows you to define sub-properties of existing properties in a super class.
ASub.bSub extends A.b in the following example. That means that instances of ASub can have only references to resources of type BSub while it is still possible to access the ASub.bSub resources via A.b as type of B
It is also possible to have more than one sub-property that extends the same super-property, as long as the sum of cardinalities of the sub-properties complies with the cardinality of the super-property.
Please note that is it only allowed to extend a property of the same type (i.e. UseRelation extends UseRelation, Composition extends Composition). -
ObjectCardinality The Relation defines the object cardinality which determines how many resources of type A can reference a resource of type B via relation b
You may choose one of the following predefined cardinality instances.
UseRelation
The UseRelation (UML: Association) references another resource without affecting the lifetime of this resource. Deleting the referencing resource will not delete the referenced resource.
The range of UseRelation is AbstractType.
- UseRangeRestrictionAspect You may want to restrict resources that can be referenced by a UseRelation depending on their context. Consider a state machine where only target states of the own state machine shall be selected.
Let’s define a UseRangeRestriction aspect for Transition.state that allows only states of the own state machine. Select the ResourceSelectorAspectImplementation for the easy to use Selector-Syntax (see Chapter 9.3.2 SelectorFunction) or the JavaAspectImplementation for a powerful Java implementation.
Starting from Transition navigating backwards via transition and state (note the minus sign for backward navigation) to Statemachine where navigating forward to all States.
Composition
The Composition (UML: Aggregation, Composition) aggregates another resource. Deleting the aggregating resource of type A will delete the referenced resources of type B
Please note that you have to adjust the ObjectCardinality if B may be owned either from A1 or A2
The range of Composition is Class.
DecoratingRelation
Combining two existing models together is a very important task. Sometimes this is done by so called model transformation. Actifsource chooses another way, because model transformation often only works in one direction. Actifsource allows decorating existing resources with other ones. That means that we can add any auxiliary information to already existing information. You will find out that this is a very powerful concept.
The DecoratingRelation allows building a homomorphism. A homomorphism is a structure-preserving map between two structures. The word homomorphism comes from the ancient Greek language: ὁμός (homos) meaning "same" and μορφή (morphe) meaning "shape".
Consider a resource A1 with a list b1 of resources of type B1 Consider a second List A2 that has a reference a1 to a resource of type A1 The decorating relation A2.b2 shall have 0..1 resources of type B2 for any resources reached via A2.a1.b1
The decorating relation A2.b2 needs a decorating aspect which defines where to find the resources that shall be decorated.
Let us create a resource TestA1 of type A1 first.
Now let us create a resource TestA2 of type A2 with a reference to TestA1 Please note that A2.b2 is now decorating A2.a1.b1 what is indicated by the brackets (i.e. b1[B1_1]).
Creating a decorated resource will automatically fill in the target property b1
Please note that the decorating relation needs a subclass of type Decorator.
If your decorating relation does not point to a resource which fits the requirements Actifsource comes up with a quick assist (see also Chapter 3.10 Quick Assist).
The quick assist extends the range of the decorating relation from Decorator and adds a sub relation to Decorator.target with type of the target of your decorating aspect.
SelectorRelation
[TBD]
Attribute
The Attribute allows creating simple literals. There are some predefined literal instances that you might use. Please note that the range of an attribute is Literal where Literal is also an AbstractType as already seen for Class (see Chapter 4.4.1 Property).
- BooleanLiteral The Boolean literal allows the values true or false only.
- DoubleLiteral The double literal is a 64 bit floating point value.
- IntegerLiteral The integer literal is a 32 bit integral value.
- LongLiteral The long literal is a 64 bit integral value.
- StringLiteral The string literal is a single-line string value.
- TextLiteral The text literal is a multi-line string value.
- ScopePathLiteral The scope literal allows referencing any file in the current project.
- JavaTypeLiteral The Java type literal allows referencing a Java class or interface.
- JavaClassLiteral The Java type literal allows referencing a Java class.
- JavaInterfaceLiteral The Java type literal allows referencing a Java interface.
AbstractType
As we have seen before, Class and Literal both extend AbstractType. Furthermore, AbstractLiteral is of type Literal and Resource is of type Class. To complete this picture, we can add Any which is of type AbstractType.
Core Resources
The Actifsource Core provides a set of resources that allows you to build your own meta-model. The most important resources are Class with its Properties and Enum.
ch.actifsource.core.Class
- typeOf To act as a class a resource has to be of type Class. To be type something of means to be an instance of something.
- comment The comment text literal let you comment your classes and literals. Comments are shown in tooltips when hovering the mouse pointer over class and property names.
Note that the comment property is inherited by extending from Commentable. Extending from Commentable allows writing comment for any resource and activates the tooltip functionality.
- aspect[InitializationAspect] The initialization aspect initializes a resource during creation. To be provided as Java class.
- aspect[ResourceValidationAspect] The resource validation aspect defines specific validation rules for a resource. To be provided as Java class.
- aspect[NameAspect] The name aspect defines the name of a resource. To be provided as Java class or in the simple selector syntax.
Note that you might define a selector aspect pointing to a TemplateFunction (see Chapter 9.3.6 TemplateFunction) or a TemplateLineFunction (see Chapter 9.3.7 TemplateLineFunction).
- extends Defines the base class and inherits all properties when instantiating.
- modifier The modifier defines if a class can be instantiated or sub classed.\
Modifier | Description |
---|---|
Abstract | No instance allowed of this class. |
Final | No subclass allowed of this class. |
-
property Defines the property of this class. Properties carry the data when instantiating the class. Choose the property type you need (see also Chapter Property).
-
definesAspect Defines aspects for instances of this class (see also aspect[InitializationAspect], aspect[ResourceValidationAspect], aspect\NameAspect] which are defined in the aspect property of the class Class.
-
allowRoot A Class is a root class if it is not aggregated exclusively (that mean owned by an ownRelation with ObjectCardinality1_1). Set this flag to true or false if you want to overwrite the Actifsource logic.
Please note that only root classes can be created directly via the New Actifsource Resource Tool (see Chapter 2.9.1 New Actifsource Resource). -
classIcon Sets an icon for this class and all instances. You can select an icon project by using content assist to browse the current project. The icon size shall be 16 x 16 pixels.
-
lineColor Deprecated.
-
fillColor Deprecated.
-
shape Deprecated.
ch.actifsource.core.Enum
The enum is a class with a set of values.
- Value Technically the value is an instance of the enum and therefore fully typed.
Note that you might define properties in your enum which are than accessible in the values.