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: 131
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: 63
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: 131
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: 7655
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: Tue Apr 23 11:32:35 GMT 2024

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

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

Back to the top