Skip to main content



      Home
Home » Eclipse Projects » Sirius » AQL problem in "includes"/"excludes" functions?
AQL problem in "includes"/"excludes" functions? [message #1823276] Tue, 24 March 2020 05:51 Go to next message
Eclipse UserFriend
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 06:12 Go to previous messageGo to next message
Eclipse UserFriend
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 07:07 Go to previous messageGo to next message
Eclipse UserFriend
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 07:32 Go to previous message
Eclipse UserFriend
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: Wed Jun 18 05:45:28 EDT 2025

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

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

Back to the top