[EVL] Possible Bug with collection comparison [message #383066] |
Tue, 29 April 2008 10:40  |
Eclipse User |
|
|
|
I may have discovered a bug which occurs when comparing collections. I
first ran the following validation file...
context SimpleClass!Entity {
constraint CheckingParentExists {
check : self.Child = true implies self.parent-> size = 1
message : 'There is no parent for ' + self.classname
}
constraint CheckChildOperations {
guard: self.Child = true
check : false
message : self.parent.operations->collect(s| s.name) + 'does not have the
correct operations' + self.operations->collect(b|b.name)
}
...which as you would expect returned: " first collection" does not have the
correct operations "second collection"
However when I add in a third constraint which should compare the two
collections (as can be seen below) there is no validation output not even to
the constraint where the check is set to false. Is this a bug or am I doing
something incorrectly? [This used to work correctly]
context SimpleClass!Entity {
constraint CheckingParentExists {
check : self.Child = true implies self.parent-> size = 1
message : 'There is no parent for ' + self.classname
}
constraint CheckChildOperations {
guard: self.Child = true
check : false
message : self.parent.operations->collect(s| s.name) + 'does not have the
correct operations' + self.operations->collect(b|b.name)
}
constraint CheckChildOperations {
guard: self.Child = true
check : self->collect(b|b.operations).includesAll( self.parent->collect(s|
s.operations ))
message : self.classname + 'does not have the correct operations'
}
}
|
|
|
Re: [Epsilon][EVL] Possible Bug with collection comparison [message #383068 is a reply to message #383066] |
Wed, 30 April 2008 05:46  |
Eclipse User |
|
|
|
Hi Andrew,
Each constraint in a context must be named uniquely. In your case the
2nd and 3rd constraint have the same name (CheckChildOperations), and
therefore the latter shadows the prior.
A couple of comments: you don't need to use the -> operator; the . does
the same (e.g. you can write x.collect(a|a>0) instead of
x->collect(...)). Also I'm not sure if the self->collect(...) code in
the last constraint makes sense as self is an instance of Entity and
self->collect(b|b.operations) will return a sequence of sequences of
operations (e.g. Sequence{Sequence{op1,op2,op3}} ).
Cheers,
Dimitrios
Andrew Lawson wrote:
> I may have discovered a bug which occurs when comparing collections. I
> first ran the following validation file...
>
> context SimpleClass!Entity {
>
>
> constraint CheckingParentExists {
>
> check : self.Child = true implies self.parent-> size = 1
>
> message : 'There is no parent for ' + self.classname
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : false
>
>
> message : self.parent.operations->collect(s| s.name) + 'does not have the
> correct operations' + self.operations->collect(b|b.name)
>
>
> }
>
> ..which as you would expect returned: " first collection" does not have the
> correct operations "second collection"
>
>
> However when I add in a third constraint which should compare the two
> collections (as can be seen below) there is no validation output not even to
> the constraint where the check is set to false. Is this a bug or am I doing
> something incorrectly? [This used to work correctly]
>
> context SimpleClass!Entity {
>
>
> constraint CheckingParentExists {
>
> check : self.Child = true implies self.parent-> size = 1
>
> message : 'There is no parent for ' + self.classname
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : false
>
>
> message : self.parent.operations->collect(s| s.name) + 'does not have the
> correct operations' + self.operations->collect(b|b.name)
>
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : self->collect(b|b.operations).includesAll( self.parent->collect(s|
> s.operations ))
>
>
> message : self.classname + 'does not have the correct operations'
>
>
> }
>
>
>
> }
>
>
|
|
|
Re: [Epsilon][EVL] Possible Bug with collection comparison [message #615804 is a reply to message #383066] |
Wed, 30 April 2008 05:46  |
Eclipse User |
|
|
|
Hi Andrew,
Each constraint in a context must be named uniquely. In your case the
2nd and 3rd constraint have the same name (CheckChildOperations), and
therefore the latter shadows the prior.
A couple of comments: you don't need to use the -> operator; the . does
the same (e.g. you can write x.collect(a|a>0) instead of
x->collect(...)). Also I'm not sure if the self->collect(...) code in
the last constraint makes sense as self is an instance of Entity and
self->collect(b|b.operations) will return a sequence of sequences of
operations (e.g. Sequence{Sequence{op1,op2,op3}} ).
Cheers,
Dimitrios
Andrew Lawson wrote:
> I may have discovered a bug which occurs when comparing collections. I
> first ran the following validation file...
>
> context SimpleClass!Entity {
>
>
> constraint CheckingParentExists {
>
> check : self.Child = true implies self.parent-> size = 1
>
> message : 'There is no parent for ' + self.classname
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : false
>
>
> message : self.parent.operations->collect(s| s.name) + 'does not have the
> correct operations' + self.operations->collect(b|b.name)
>
>
> }
>
> ..which as you would expect returned: " first collection" does not have the
> correct operations "second collection"
>
>
> However when I add in a third constraint which should compare the two
> collections (as can be seen below) there is no validation output not even to
> the constraint where the check is set to false. Is this a bug or am I doing
> something incorrectly? [This used to work correctly]
>
> context SimpleClass!Entity {
>
>
> constraint CheckingParentExists {
>
> check : self.Child = true implies self.parent-> size = 1
>
> message : 'There is no parent for ' + self.classname
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : false
>
>
> message : self.parent.operations->collect(s| s.name) + 'does not have the
> correct operations' + self.operations->collect(b|b.name)
>
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : self->collect(b|b.operations).includesAll( self.parent->collect(s|
> s.operations ))
>
>
> message : self.classname + 'does not have the correct operations'
>
>
> }
>
>
>
> }
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03541 seconds