Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Shrawanika is currently offline ShrawanikaFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Shrawanika is currently offline ShrawanikaFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Shrawanika is currently offline ShrawanikaFriend
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 Go to previous message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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 Go to previous message
Shrawanika is currently offline ShrawanikaFriend
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 Go to previous message
Jos Warmer is currently offline Jos WarmerFriend
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 Go to previous message
Eclipse UserFriend
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 Go to previous message
Shrawanika is currently offline ShrawanikaFriend
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 Go to previous message
Jos Warmer is currently offline Jos WarmerFriend
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
>>
>
Previous Topic:name and type of a Variable(Declaration)
Next Topic:ODM documenation
Goto Forum:
  


Current Time: Tue Apr 16 18:54:45 GMT 2024

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

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

Back to the top