|Problems with another pattern I need to implement [message #1065446]
||Tue, 25 June 2013 14:10
| Alexander Fülleborn
Registered: April 2013
I need to express that an element has the applied stereotype "depend" as well as has a source element called "Problem Statement" (However better it would be a source element of appliedStereotype "Problem Statement").
I tried it this way and that does not work:
pattern isDirectRelationshipToProblemStatement(ElemDirectRelationshipToPS) =
check(name(StType) == "depend");
check(name(ProblemStatement) == "Problem Statement");
Support would very much be appreciated - thanks!
Kind regards, Alex
|Re: Problems with another pattern I need to implement [message #1066064 is a reply to message #1066032]
||Sat, 29 June 2013 12:52
| Abel Hegedus
Registered: July 2009
Alexander Fülleborn wrote on Sat, 29 June 2013 03:43|
E.g. in the spec and tutorial that I have I cannot find the description of the syntax
"uml.metamodel.uml.Element.appliedStereotype(AppliedST, DomainSpecificProblemStatement, StType);"
as you told me in one of your last answers.
For a quick introduction to pattern syntax, read http://wiki.eclipse.org/VIATRA2/Activity_Diagrams_to_Petri_Nets
For more details, see the language specification (http://www.eclipse.org/viatra2/doc/ViatraSpecification.pdf), where the detailed syntax of graph patterns are described from page 54, Section 5.4.
You can see that the gtpattern has a body, and the pattern body (page 58) contains local pattern body elements, pattern calls, check conditions, etc. First, local elements are model elements or relationships, model elements are either entities (e.g. uml.Element(DomainSpecificProblemStatement), where Element is the type and DomainSpecificProblemStatement is the variable which will be matched to an entity with the Element type) or relations (which is the one above uml.Element.appliedStereotype(AppliedST, DomainSpecificProblemStatement, StType), where appliedStereotype is a relation defined in the uml.Element entitiy, AppliedSt is the variable that matches the _relation itself_, DomainSpecificProblemStatement is the variable that will match the source element of the relation and StType is the target element of the relation).
It is important, that you won't find a specific syntax for UML profiles, as the pattern and transformation language does not have such extensions. The UML models and metamodel and profiles are all represented with VPM and thus can be handled with standard VTCL code. So the uml.Element.appliedStereotype(Rel,Src,Trg) is not a special syntax, it just means that:
- there is an Element named entity under the uml named entity under the metamodel named entity under the uml named entity (which is under the model space root)
- there is an appliedStereotype named relation under this Element entity, with the source being the Element entity itself and the target the Stereotype named entity (under the same entity as the Element).
- we are looking for relations which have the appliedStereotype named relation as their _type_ and we will substitute this relations into the variable Rel (so typeOf(Element.appliedStereotype,Rel) is true).
- if the Rel variable is substituted to a given relation (say uml.models.sample.elem1.asRel), then variable Src will be substituted to entity uml.models.sample.elem1 and variable Trg will be substituted to entity uml.models.sampleProfile.st1 for example.
The above is also explained in the tutorial example that I linked with UML activity diagrams and Petri nets.
Powered by FUDForum
. Page generated in 0.03347 seconds