Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » AQL problem in "includes"/"excludes" functions?
AQL problem in "includes"/"excludes" functions? [message #1823276] Tue, 24 March 2020 09:51 Go to next message
Avi Shaked is currently offline Avi ShakedFriend
Messages: 116
Registered: October 2019
Senior Member
Hi,

I suspect there is a bug in the "excludes"/"includes" function.

I would have imagined that if I choose a model element and apply:
aql: self. ancestors()->includes(self.ancestors())
this would result in "true".
However, it results in "false."
The same logic applies to .excludes(), with similar opposite result.

I used the above query only for demonstration, but I keep getting same opposite logic in similar less trivial implementations.
My real purpose was to find whether an object that an edge points to as source (self.source in my implementation) is a child of the target (self.target). I use:
aql: self.source.ancestors()->includes(self.target)
and keep getting "false" when the source is indeed an element contained within target.

Can you enlighten me? What am I doing wrong?
Re: AQL problem in "includes"/"excludes" functions? [message #1823277 is a reply to message #1823276] Tue, 24 March 2020 10:12 Go to previous messageGo to next message
Yvan Lussaud is currently offline Yvan LussaudFriend
Messages: 56
Registered: July 2009
Member
The service is applied on a collection and take an element as the parameter. Here you are passing a collection of elements and this collection is not in the receiver so it return false. What you want to do is probably something like:

aql:self. ancestors()->includes(self.ancestors()->first())

or

aql:self. ancestors()->includesAll(self.ancestors())

In this case you don't have any error because testing the presence of a collection into an other one is also a valid use case.
Re: AQL problem in "includes"/"excludes" functions? [message #1823286 is a reply to message #1823277] Tue, 24 March 2020 11:07 Go to previous messageGo to next message
Avi Shaked is currently offline Avi ShakedFriend
Messages: 116
Registered: October 2019
Senior Member
Thank you for the explanation.

There's still a problem I encounter. I will try to share the details soon.

Regards,
Avi
Re: AQL problem in "includes"/"excludes" functions? [message #1823288 is a reply to message #1823286] Tue, 24 March 2020 11:32 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6874
Registered: July 2009
Senior Member
Hi

If you use the OCL editor to check you AQL which is probably the same as OCL you will get hovertext andtype validation.

Regards

Ed Willink
Previous Topic:No viewpoint available´╝č
Next Topic:Getting to the "root" element by AQL query
Goto Forum:
  


Current Time: Thu Oct 22 13:08:47 GMT 2020

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

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

Back to the top