Once you have the tree fulfilled, it is time to indicate the specific properties of each of its elements. So that, we are going to see which elements can be created and the properties you can specify for each one, using the Properties View.
It is the root element and it has not got attributes to specify.
You are allowed to specify OCL expressions on different metamodels and after that evaluate them over the models that conform them, or to specify OCL expression on different models and evaluate them over its instances. In the Model class it is specified a concrete pair, metamodel/model or model/instance.
From now we will talk about models and instances, but we can consider metamodels and models as analogous way.
It has to be specified a name for the model/instance pair (property Name) and the relative root in the workspace that corresponds to the XMI file path that specifies both model and instance (through the properties Path and Path Instance, respectively). To fix these paths you are helped by a wizard, which is accessed through the field of these properties, in the PropertyView.
Selection wizard for the model.
It is permitted to define OCL expressions on several contexts, considering these contexts as the context concept of OCL. Only you have to specify its name by means of using the property Name of this element. For example, you can consider the context Customer of the Royal and Loyal model.
A context can “contain” a set of groups of: invariants (Invariant Group), queries (Query Group) or queries used for the specification of transformations or equivalence relations on models in QVT (QVT Query Group). These groups are used to organize the OCL expressions and you only have to set its name through the property Name.
When describing an invariant you have to fulfil the next properties:
Dialog window for the edition of OCL expressions.
The other properties are managed internally by the tool and you do not have to modify them.
Note that you do not have to the define context, neither indicate if you are dealing with an invariant when you set the OCL expression using the property Ocl (because of this information has been introduced in other point).
Example of an invariant that refers to the Royal and Loyal model, with context LoyalProgram would be correct to specify in the property Ocl the following expression:
self.partners.size() > 0
All we have said for the invariants is fine for the query element. There is only a need to indicate that these kind of expressions perform a query over all instances of a concrete class. So, you have always to start with the notation: context_name: allInstances().
An example of a query that refers to the Royal and Loyal model, with context Loyalty Program would be correct to specify in the property Ocl the following expression:
All we have said for the invariants is fine for the QVT query element. It has been given the chance to introduce this kind of queries in the OCLEditor for debugging tasks of OCL support in MOMENT. That is, queries that can be used for the transformation specification and for the equivalence relations over models in QVT.