Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » Problems with another pattern I need to implement(Do not know the syntax to implement another pattern)
Problems with another pattern I need to implement [message #1065446] Tue, 25 June 2013 18:10 Go to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi again,

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) =
{
uml.metamodel.uml.Element(ElemDirectRelationshipToPS);
uml.metamodel.uml.Stereotype(StType);
check(name(StType) == "depend");
uml.metamodel.uml.Element.appliedStereotype(AppliedST,ElemDirectRelationshipToPS, StType);

uml.metamodel.uml.Element.source();
ElemDirectRelationshipToPS.src(ProblemStatement);
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 #1065474 is a reply to message #1065446] Tue, 25 June 2013 20:57 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 197
Registered: September 2015
Senior Member
Hi,

first of all, you may find the following project helpful:
https://viatra.inf.mit.bme.hu/svn/experimental/trunk/xformdev/org.eclipse.viatra2.gui.patterngenerator/
I don't think it is part of any update site feature, but you should be able to check it out from SVN and then install it into your Eclipse. This adds a menu item in the local (right-click) menu of the VIATRA model space editor. You can select any number of entities and relations and it will try to create a pattern that matches the selection and you can paste it (Ctrl-V or Paste action) into your VTCL file.
Please note that this is experimental and not released functionality!

Quote:

uml.metamodel.uml.Element.source();
ElemDirectRelationshipToPS.src(ProblemStatement);


This is clearly not syntactically correct.
Try to work from the basics of the pattern language:
- entities of a given type are written in patterns as
TypeName(Var)

- relations are written as triples (relation, source, target):
TypeName.relName(RelVar,SrcVar,TrgVar)
Re: Problems with another pattern I need to implement [message #1066032 is a reply to message #1065474] Sat, 29 June 2013 07:43 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Ábel,

thanks for this helpful hint. I will try to use it. Besides this, are there also further language descriptions/specifications available? 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.

Concern the pattern generator, I will give you feedback as soon as I have first experiences with it.

Thanks and kind regards!

So long, Alex
Re: Problems with another pattern I need to implement [message #1066064 is a reply to message #1066032] Sat, 29 June 2013 16:52 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 197
Registered: September 2015
Senior Member
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.
Re: Problems with another pattern I need to implement [message #1066271 is a reply to message #1066064] Mon, 01 July 2013 20:00 Go to previous message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Abel,

many many thanks for this additional explanations - you are very patient with me Very Happy . I will further work on this and hope to be on the right track in the near future Wink.

Have a good time and thanks again, Alex
Previous Topic:Error with copy rule
Next Topic:Model Importer Skeleton for API
Goto Forum:
  


Current Time: Thu Apr 18 03:53:14 GMT 2024

Powered by FUDForum. Page generated in 0.03113 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top