Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » Incquery - how to query the association relationship in UML(Incquery - how to query the association relationship in UML)
Incquery - how to query the association relationship in UML [message #1758328] Mon, 27 March 2017 17:06 Go to next message
sarah Adam is currently offline sarah AdamFriend
Messages: 3
Registered: March 2017
Junior Member
hi,

I am trying to use Incquery to query the content of UML file. However , I am not sure how to write the pattern for UML association relationship. Can you please advice on this.

@Edge(source = sub, target = sup, label = "impl")
@Format(color = "#0000FF", lineWidth = 1, lineStyle = "dashed")
pattern associationImpl(sub : Class, sup : Class) {
Property.Owner(IR,sub);
Property(IR);
Property.type(IR,sup);
}

Regards
Laila
Re: Incquery - how to query the association relationship in UML [message #1758345 is a reply to message #1758328] Mon, 27 March 2017 20:28 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 335
Registered: July 2015
Senior Member
Hi,

I would start with the features of the Association class, such as Association.memberEnds to collect the two properties the association collects, and then navigate to the owners of said properties. As an example, look for the implementation of the related EndType derived feature of Association class of the UML metamodel [1].

[1] http://git.eclipse.org/c/viatra/org.eclipse.viatra.git/tree/integration/plugins/org.eclipse.viatra.integration.uml/src/org/eclipse/viatra/integration/uml/derivedfeatures/DerivedFeatures.vql#n468

Best regards,
Zoltán
Re: Incquery - how to query the association relationship in UML [message #1758392 is a reply to message #1758345] Tue, 28 March 2017 11:28 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 187
Registered: September 2015
Senior Member
You could try out the Query by Example addon ( https://viatra.net/news/2016/7/introducing-viatra-query-by-example ), that helps specifically in exploring a metamodel and defining queries. Even better, the blog post uses UML as an example as well.
Re: Incquery - how to query the association relationship in UML [message #1758563 is a reply to message #1758392] Thu, 30 March 2017 07:19 Go to previous messageGo to next message
sarah Adam is currently offline sarah AdamFriend
Messages: 3
Registered: March 2017
Junior Member
Hi Zoltan,
Thanks for your reply..
I tried the following but it not seem to work, am I doing something wrong.
Also "propert.owner" is not seem to be supported by incquery.

@Edge(source = src, target = targ, label = "associate")
pattern association(src:Class , targ:Class){
Association(Ass_0);
find associationEndType(Ass_0,pro);
TypedElement.type(pro, targ);

Property.owner(pro,src);
}
pattern associationEndType(
self : Association,
pro : Property
) {
Association.memberEnd(self, pro);


}
salwa

[Updated on: Thu, 30 March 2017 07:40]

Report message to a moderator

Re: Incquery - how to query the association relationship in UML [message #1758661 is a reply to message #1758563] Fri, 31 March 2017 11:02 Go to previous message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 335
Registered: July 2015
Senior Member
Hi,

What do you mean by not supported? Does it return an error message of it being a derived feature? In that case, have a look at the UML integration feature available in the IncQuery/VIATRA update site (see https://wiki.eclipse.org/VIATRA/Integration/UMLSupport).

Or is it some other kind of issue?

Zoltán
Previous Topic:Importing Ecore metamodel into Modelspace with VIATRA2 R3.1
Next Topic:Self-reference in viatra
Goto Forum:
  


Current Time: Mon Nov 20 08:04:07 GMT 2017

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

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