Since Papyrus 3.0 (Eclipse Oxygen), Papyrus provides the Expressions Framework.
This framework provides one basis interface IExpression<CONTEXT_TYPE, RETURN_TYPE>
. This interface provides the method evaluate(CONTEXT_TYPE):RETURN_TYPE
. This framework has been developed to be hightly extensible. Please read the expression developer documentation to go further.
The Expressions have initially been developed for Papyrus Matrices Table. Developing the matrices, we need to provide a way to the user to easily filter the rows and the columns to show. That's the reason for which the first expressions available in Papyrus are the boolean expressions.
Nowadays (Papyrus 3.0), for the users, the expressions are only used in the context of the Papyrus Matrices Table. Throw the Matrix Property View, the user can create its own expressions to use them as filter. It is also possible for him to reference existing expressions provides by Papyrus.
An ExpressionCatalog owns IExpression<?,?>
. It allows to provide predefined expressions to the user.
For these expressions, the evaluate method takes as argument an
EObject and returns a
Boolean, so true
or false
.
If you don't know what is an EObject, it is not matter. It is a detail of the implementation of UML in Eclipse.
The only thing to know for Papyrus user, it that all UML Elements are EObject.
Here, we present you the generic boolean expressions provided by Papyrus:
true
false
AndExpresion
,
AndExpresion
.
true
by default.OrExpression
,
OrExpression
.
false
by default.NotExpression
,
NotExpression
.
false
as default value.
ExpressionCatalog
.true
.false
if the EAttribute is not defined. We only return true
when the EAtribute value is eaquals to the expected one.After defining these main objects required to write boolean expression, we provided some expressions dedicated to UML:
true
when the stereotype is applied on the element. If the
profile URI is defined, we check that the stereotype comes from the expected profile.
false
, if the stereotype identifier is not defined.true
when at least one stereotype is applied on the element.true
when the evaluated element is strictly an instance of the excepted metaclass. So for subtypes, of the expected metaclass, we return false
.false
when the
UML Metaclass is not defined.
true
when the evaluated element is an instance of the excepted metaclass. So for subtypes, of the expected metaclass, we return true
too.false
when the
UML Metaclass is not defined.
true
when the stereotype is applied on the element. If the
profile URI is defined, we check that the stereotype comes from the expected profile.
false
, if the stereotype identifier is not defined.true
when the stereotype applied on the context element is a Kind of the identified stereotype. So for element stereotyped by a stereotype that generalize the expected stereotype, we return true
. If the
profile URI is defined, we check that the stereotype comes from the expected profile.
false
, if the stereotype identifier is not defined.true
when the required stereotype is applied on the context element and when its property value is equals to the expected one. If the
profile URI is defined, we check that the stereotype comes from the expected profile.
false
, when the qualified name, or the property, or the expected value, is not defined.