|
Re: Help needed for implementing entity match pattern [message #1063802 is a reply to message #1063790] |
Fri, 14 June 2013 09:58 |
Abel Hegedus Messages: 197 Registered: September 2015 |
Senior Member |
|
|
Hi Alexander,
I will try to walk you through the pattern creation process so you will be able to create other patterns on your own.
Quote:
pattern isProblemStatement(DomainSpecificProblemStatement) =
{
// Requirement:
// The entity/model element 'PSL problem statement' needs to be
// found according to the following constraints:
// => 'PSL problem statement is the source element of
// 'DomainSpecificProblemStatement'
// => 'DomainSpecificProblemStatement' is the relation named "uN19363_47"
// of type 'appliedStereotype'
// => with the target "PSL problem statement". }
}
If I understand right:
- there is an uml.metamodel.uml.Element typed entity with name "PSL problem statement"
-> Let's call this variable Elem
- there is an uml.metamodel.uml.Stereotype typed entity with name "MyStereoType" (I intentionally changed it to avoid confusion)
-> Let's call this variable StType
- there is a relation with type uml.metamodel.uml.Element.appliedStereotype between Elem and StType
-> Let's call the variable representing the relation AppliedSt
Then, taking advantage of the declarative nature of the pattern language, you just convert each line to a statement, like this:
pattern isProblemStatement(Elem) =
{
uml.metamodel.uml.Element(Elem);
uml.metamodel.uml.Stereotype(StType);
check(name(StType) == "MyStereoType");
uml.metamodel.uml.Element.appliedStereotype(AppliedST,Elem,StType);
}
The above pattern will match on the entity which has the stereotype with the given name applied on it.
Unfortunately the links on the main site are broken, but the main wiki page has the correct links: http://wiki.eclipse.org/VIATRA2 (under Documentation, the language specfication, though outdated should still help in finding the details that are not covered by the wiki).
|
|
|
Powered by
FUDForum. Page generated in 0.03245 seconds