Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Bug in exists and forall operation
Bug in exists and forall operation [message #1547461] Mon, 05 January 2015 12:48 Go to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
I am having a problem with exists and forAll operations. Results are opposite to expected and correct result. In MAC, these operations also cause stackoverflow.

I have attached a sample project. It contains one ecore file and one XMI file.
Ecore is very simple containing only two classes (class1 and class2). Class1 contains association to CLass2 and it is of containment type. Class1 contains two boolean typed derived attributes while class2 contains only 1 boolean type attribute. Class1 contains following attributes with derivation statement.

attribute anyAvailable : ecore::EBooleanObject { derived volatile }
{
derivation: class2.available->exists(true);
}
attribute allAvailable : ecore::EBooleanObject { derived volatile }
{
derivation: class2.available->forAll(true);
}
property class2#class1 : Class2[*] { composes };
}

I have attached XMI file containg 1 instance of class1 and 3 instances of class2. Attribute "available" for class2's instances is set to false. The result for class1.anyAvaiable and class1.allAvailable should be false but if you open XMI file in eclipse then it shows both attributes as true.

i have attached complete project.

it feels a bug in implementation of exists and forall operation. Please help me rectifying the problem.

Cheers
Re: Bug in exists and forall operation [message #1549388 is a reply to message #1547461] Tue, 06 January 2015 13:52 Go to previous message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 260
Registered: April 2012
Senior Member
The expressions u used always return true, no matter which context u use.

You expressions should be like:

attribute anyAvailable : ecore::EBooleanObject { derived volatile }
{
derivation: class2.available->exists(i | i = true);
}
attribute allAvailable : ecore::EBooleanObject { derived volatile }
{
derivation: class2.available->forAll(i | i = true);
}
property class2#class1 : Class2[*] { composes };
}

Probably ->exists(i | i) or even ->exists(i) will work. The same is true for forAll(i|i) and forAll(i)
Previous Topic:Unexpected conversion from Sequence to OrderedSet
Next Topic:issue with OCLInEcore Editor - NPE on gendoc documentation with null value
Goto Forum:
  


Current Time: Tue Mar 19 08:22:09 GMT 2024

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

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

Back to the top