Let's consider the following class diagram
I would like to express the following rule in OCL
if cond = true then
bderived = b
else
bderived.x = b.x + 10
bderived.y = b.y + 10
endif
My best guess to express the above using OCL is the following:
context A::bderived : B
derive: if cond = true then b
else
{b.x + 10, b.y + 10}
endif
I know that the above OCL expression is not correct, but I cannot figure out any valid OCL expression to express what I want.