using includes and excludes returns unexpected result using interactive Xtext OCL [message #1229231] |
Thu, 09 January 2014 01:11 |
|
Hi
I am using interactive Xtext OCL inside eclipse for evaluating OCL expressions
I use DB.ecore of the Epsilon project from this link here (see attached diagram plz)
I am trying to evaluate the following constraints over a table instance(context is table) for the instance created over this Ecore:
(self.columns->asSet())->includes(self.primaryKeys->asSet())
I am expecting that above expression return True for my instance as below:
Table Student:
column id
column name
and I choose the "column id" to be its primary key as well. But it returns false!!! Why?
The only difference I see in the ecore file for the "columns" and "primaryKeys" is that the former is byVale and the latter is byRef for the class Table. Does this cause this weird behaviour?
I attached the diagram of the ecore file for better presentation.
[Updated on: Thu, 09 January 2014 02:28] Report message to a moderator
|
|
|
|
|
Re: using includes and excludes returns unexpected result [message #1229584 is a reply to message #1229331] |
Thu, 09 January 2014 19:20 |
|
Thanks for your reply Ed
The names of the operations was misleading for me! that caused the problem at first place I think!!
to summarize then, OCL "includes" operation for Sets is equal to membership (i.e. "\in" in latex notation) and OCL "includesAll" is the subset operation for Sets (i.e. "\subset" in latex notation).
So what I expected was the subset operation, so I should have used "includesAll" instead of "Includes".
so I tried
(self.columns->asSet())->includesAll(self.primaryKeys->asSet())
for my example and it returns True as I am expecting
Thanks
Hamid
|
|
|
Powered by
FUDForum. Page generated in 0.04138 seconds