Hi,
I created an OCL document containing invariants against a certain metamodel. The meta model contains a class Foo and a class Bar which is derived from Foo. (So Bar inherits from Foo.)
When I create a model (according to the meta model) and I let the CompleteOCLEObjectValidator perform the validations, it turns out that given a constraint for Foo, any object of type Bar is not validated.
To make it specific.
The metamodel:
package zoo : zoo = 'http://zoo.walb.com'
{
class Foo
{
attribute name : String[?] { ordered };
}
class Bar extends Foo
{
attribute id : String[?] { ordered };
}
}
The ocl document:
import 'http://zoo.walb.com'
package zoo
context Foo
inv AlwaysFalseFoo: false
endpackage
I would expect that when I validate a model containing a Bar object, that the validator would indicate that the AlwaysFalseFoo constraint is not fulfilled.
Am I misunderstanding the OCL specification or did I trigger a bug in the tool?
Greetings,
Wilbert.