Suppose I have the following blocks:

What I want:

When I make an instance of this, I want total weight to be the sum of all of the weight values from the Sub-Blocks.

As I understand, I have to make a Customization Element whose target I set as a stereotype, and I apply that stereotype to Main Block, and then I have an OCL expression to calculate the value of the block (though I thought OCL just returned Boolean values?) which then has to have either a Java Listener put together or a Metachain.

I'm struggling to figure out what goes where to do this, so if someone could just provide a basic example that does what I'm after it would be greatly appreciated.