Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Always getting result as 'true' in 'isUnique' operation
Always getting result as 'true' in 'isUnique' operation [message #21396] |
Mon, 06 February 2006 05:56 |
Shrawanika Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Hi,
With the following isUnique() operations, I am always getting result
as true. Is this incorrect or my usage is incorrect?
Set{1,1,3,2,4,1}->isUnique(1) : true
Bag{1,1,3,2,4,1}->isUnique(1) : true
Sequence{1,1,3,2,4,1}->isUnique(1) : true
OrderedSet{1,1,3,2,4,1}->isUnique(1) : true
Even with this also:
Set{1,1,3,2,4,1}->isUnique(8) : true
-Shrawanika
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #21405 is a reply to message #21396] |
Mon, 06 February 2006 14:05 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Shrawanika,
I'm afraid that the answer is "yes and yes." :-)
Your usage is incorrect and the OCL interpreter appears to have a bug.
The isUnique iterator determines whether the body expression has a different
value for every element in the collection. Your expressions should be
formulated thusly (e.g):
Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
Your examples should all result in "false" by the very nature of the body
expression being a constant. Whatever the collection value and whatever
the iterator expression, the interpreter is always answering true.
Care to add to your list of reported bugzillae?
Thanks,
Christian
Shrawanika wrote:
> Hi,
>
> With the following isUnique() operations, I am always getting result
> as true. Is this incorrect or my usage is incorrect?
>
> Set{1,1,3,2,4,1}->isUnique(1) : true
>
> Bag{1,1,3,2,4,1}->isUnique(1) : true
>
> Sequence{1,1,3,2,4,1}->isUnique(1) : true
>
> OrderedSet{1,1,3,2,4,1}->isUnique(1) : true
>
> Even with this also:
>
> Set{1,1,3,2,4,1}->isUnique(8) : true
>
> -Shrawanika
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #21412 is a reply to message #21405] |
Tue, 07 February 2006 04:40 |
Shrawanika Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Hi Christian,
As you told me I tried the expressions formulated like this also:
Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
But still the result is true always:
Set{1,1,3,2,4,1}->isUnique(e | e = 1) : true
Bag{1,1,3,2,4,1}->isUnique(e | e = 1) : true
Sequence{1,1,3,2,4,1}->isUnique(e | e = 1) : true
OrderedSet{1,1,3,2,4,1}->isUnique(e | e = 1) : true
Set{1,1,3,2,4,1}->isUnique(e | e = 8) : true
Regards,
Shrawanika
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #21431 is a reply to message #21405] |
Wed, 08 February 2006 02:20 |
Eclipse User |
|
|
|
Originally posted by: jos.warmer.klasse.nl
Hi,
If you are trying to check that the elements in the collections are
unique you need to write:
Bag{1,1,3,2,4,1}->isUnique(e | e)
because the body expression now evaluates to the value of the elements
in the collection this shoudl result in 'true' is each element is unique.
If you write
Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
The body evaluates to a boolean value and it will therefore check
whether this boolean value is unique.
Jos
Christian W. Damus wrote:
> Hi, Shrawanika,
>
> I'm afraid that the answer is "yes and yes." :-)
>
> Your usage is incorrect and the OCL interpreter appears to have a bug.
>
> The isUnique iterator determines whether the body expression has a different
> value for every element in the collection. Your expressions should be
> formulated thusly (e.g):
>
> Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
>
> Your examples should all result in "false" by the very nature of the body
> expression being a constant. Whatever the collection value and whatever
> the iterator expression, the interpreter is always answering true.
>
> Care to add to your list of reported bugzillae?
>
> Thanks,
>
> Christian
>
>
> Shrawanika wrote:
>
>> Hi,
>>
>> With the following isUnique() operations, I am always getting result
>> as true. Is this incorrect or my usage is incorrect?
>>
>> Set{1,1,3,2,4,1}->isUnique(1) : true
>>
>> Bag{1,1,3,2,4,1}->isUnique(1) : true
>>
>> Sequence{1,1,3,2,4,1}->isUnique(1) : true
>>
>> OrderedSet{1,1,3,2,4,1}->isUnique(1) : true
>>
>> Even with this also:
>>
>> Set{1,1,3,2,4,1}->isUnique(8) : true
>>
>> -Shrawanika
>
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #21455 is a reply to message #21431] |
Tue, 07 February 2006 17:48 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Ouch! Good point.
There being only two boolean values, any collection of more than two
elements will guarantee a result of false.
Of course, this doesn't make our bug go away because the result will still
always be true! :-D
Christian
Jos Warmer wrote:
> Hi,
>
> If you are trying to check that the elements in the collections are
> unique you need to write:
>
> Bag{1,1,3,2,4,1}->isUnique(e | e)
>
> because the body expression now evaluates to the value of the elements
> in the collection this shoudl result in 'true' is each element is unique.
>
> If you write
>
> Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
>
> The body evaluates to a boolean value and it will therefore check
> whether this boolean value is unique.
>
>
> Jos
>
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #21468 is a reply to message #21405] |
Wed, 08 February 2006 04:44 |
Shrawanika Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Hi,
I tried all these:
If element 1 is checked for it's uniqueness in collection:
Bag{1,1,3,2,4,1}->isUnique(1) : true
Checking if all elements are unique or not:
Bag{1,1,3,2,4,1}->isUnique(e | e ) : true
Checking as per as specified usage:
Bag{1,1,3,2,4,1}->isUnique(e | e = 1) : true
8 is not in collection , expression should fail or result in false:
Bag{1,1,3,2,4,1}->isUnique(e | e = 8) : true
So, I raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=126861
Thanks and Regards,
Shrawanika
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #21750 is a reply to message #21455] |
Fri, 10 February 2006 03:30 |
Eclipse User |
|
|
|
Originally posted by: jos.warmer.klasse.nl
Christian,
Yep, it's still a bug.
Jos
Christian W. Damus wrote:
> Ouch! Good point.
>
> There being only two boolean values, any collection of more than two
> elements will guarantee a result of false.
>
> Of course, this doesn't make our bug go away because the result will still
> always be true! :-D
>
> Christian
>
>
> Jos Warmer wrote:
>
>> Hi,
>>
>> If you are trying to check that the elements in the collections are
>> unique you need to write:
>>
>> Bag{1,1,3,2,4,1}->isUnique(e | e)
>>
>> because the body expression now evaluates to the value of the elements
>> in the collection this shoudl result in 'true' is each element is unique.
>>
>> If you write
>>
>> Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
>>
>> The body evaluates to a boolean value and it will therefore check
>> whether this boolean value is unique.
>>
>>
>> Jos
>>
>
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #565955 is a reply to message #21396] |
Mon, 06 February 2006 14:05 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Shrawanika,
I'm afraid that the answer is "yes and yes." :-)
Your usage is incorrect and the OCL interpreter appears to have a bug.
The isUnique iterator determines whether the body expression has a different
value for every element in the collection. Your expressions should be
formulated thusly (e.g):
Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
Your examples should all result in "false" by the very nature of the body
expression being a constant. Whatever the collection value and whatever
the iterator expression, the interpreter is always answering true.
Care to add to your list of reported bugzillae?
Thanks,
Christian
Shrawanika wrote:
> Hi,
>
> With the following isUnique() operations, I am always getting result
> as true. Is this incorrect or my usage is incorrect?
>
> Set{1,1,3,2,4,1}->isUnique(1) : true
>
> Bag{1,1,3,2,4,1}->isUnique(1) : true
>
> Sequence{1,1,3,2,4,1}->isUnique(1) : true
>
> OrderedSet{1,1,3,2,4,1}->isUnique(1) : true
>
> Even with this also:
>
> Set{1,1,3,2,4,1}->isUnique(8) : true
>
> -Shrawanika
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #565989 is a reply to message #21405] |
Tue, 07 February 2006 04:40 |
Shrawanika Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Hi Christian,
As you told me I tried the expressions formulated like this also:
Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
But still the result is true always:
Set{1,1,3,2,4,1}->isUnique(e | e = 1) : true
Bag{1,1,3,2,4,1}->isUnique(e | e = 1) : true
Sequence{1,1,3,2,4,1}->isUnique(e | e = 1) : true
OrderedSet{1,1,3,2,4,1}->isUnique(e | e = 1) : true
Set{1,1,3,2,4,1}->isUnique(e | e = 8) : true
Regards,
Shrawanika
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #566033 is a reply to message #21405] |
Wed, 08 February 2006 02:20 |
Jos Warmer Messages: 66 Registered: July 2009 |
Member |
|
|
Hi,
If you are trying to check that the elements in the collections are
unique you need to write:
Bag{1,1,3,2,4,1}->isUnique(e | e)
because the body expression now evaluates to the value of the elements
in the collection this shoudl result in 'true' is each element is unique.
If you write
Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
The body evaluates to a boolean value and it will therefore check
whether this boolean value is unique.
Jos
Christian W. Damus wrote:
> Hi, Shrawanika,
>
> I'm afraid that the answer is "yes and yes." :-)
>
> Your usage is incorrect and the OCL interpreter appears to have a bug.
>
> The isUnique iterator determines whether the body expression has a different
> value for every element in the collection. Your expressions should be
> formulated thusly (e.g):
>
> Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
>
> Your examples should all result in "false" by the very nature of the body
> expression being a constant. Whatever the collection value and whatever
> the iterator expression, the interpreter is always answering true.
>
> Care to add to your list of reported bugzillae?
>
> Thanks,
>
> Christian
>
>
> Shrawanika wrote:
>
>> Hi,
>>
>> With the following isUnique() operations, I am always getting result
>> as true. Is this incorrect or my usage is incorrect?
>>
>> Set{1,1,3,2,4,1}->isUnique(1) : true
>>
>> Bag{1,1,3,2,4,1}->isUnique(1) : true
>>
>> Sequence{1,1,3,2,4,1}->isUnique(1) : true
>>
>> OrderedSet{1,1,3,2,4,1}->isUnique(1) : true
>>
>> Even with this also:
>>
>> Set{1,1,3,2,4,1}->isUnique(8) : true
>>
>> -Shrawanika
>
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #566162 is a reply to message #21431] |
Tue, 07 February 2006 17:48 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Ouch! Good point.
There being only two boolean values, any collection of more than two
elements will guarantee a result of false.
Of course, this doesn't make our bug go away because the result will still
always be true! :-D
Christian
Jos Warmer wrote:
> Hi,
>
> If you are trying to check that the elements in the collections are
> unique you need to write:
>
> Bag{1,1,3,2,4,1}->isUnique(e | e)
>
> because the body expression now evaluates to the value of the elements
> in the collection this shoudl result in 'true' is each element is unique.
>
> If you write
>
> Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
>
> The body evaluates to a boolean value and it will therefore check
> whether this boolean value is unique.
>
>
> Jos
>
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #566228 is a reply to message #21405] |
Wed, 08 February 2006 04:44 |
Shrawanika Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Hi,
I tried all these:
If element 1 is checked for it's uniqueness in collection:
Bag{1,1,3,2,4,1}->isUnique(1) : true
Checking if all elements are unique or not:
Bag{1,1,3,2,4,1}->isUnique(e | e ) : true
Checking as per as specified usage:
Bag{1,1,3,2,4,1}->isUnique(e | e = 1) : true
8 is not in collection , expression should fail or result in false:
Bag{1,1,3,2,4,1}->isUnique(e | e = 8) : true
So, I raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=126861
Thanks and Regards,
Shrawanika
|
|
|
Re: Always getting result as 'true' in 'isUnique' operation [message #566409 is a reply to message #21455] |
Fri, 10 February 2006 03:30 |
Jos Warmer Messages: 66 Registered: July 2009 |
Member |
|
|
Christian,
Yep, it's still a bug.
Jos
Christian W. Damus wrote:
> Ouch! Good point.
>
> There being only two boolean values, any collection of more than two
> elements will guarantee a result of false.
>
> Of course, this doesn't make our bug go away because the result will still
> always be true! :-D
>
> Christian
>
>
> Jos Warmer wrote:
>
>> Hi,
>>
>> If you are trying to check that the elements in the collections are
>> unique you need to write:
>>
>> Bag{1,1,3,2,4,1}->isUnique(e | e)
>>
>> because the body expression now evaluates to the value of the elements
>> in the collection this shoudl result in 'true' is each element is unique.
>>
>> If you write
>>
>> Bag{1,1,3,2,4,1}->isUnique(e | e = 1)
>>
>> The body evaluates to a boolean value and it will therefore check
>> whether this boolean value is unique.
>>
>>
>> Jos
>>
>
|
|
|
Goto Forum:
Current Time: Thu Apr 18 18:18:44 GMT 2024
Powered by FUDForum. Page generated in 0.02634 seconds
|