I've got an EMF metamodel as described below:
class Application
- runsOn: Host [0..*]
interface Host
class VirtualMachine implements Host
- runsOn: Host [0..*]
class PhysicalMachine implements Host
The question I want to answer using OCL is: find all PhysicalMachine
s on which a given Application
actually runs (directly or transitively). Please note that all of the following paths can occur in the instance model:
- Application runsOn PhysicalServer
- Application runsOn VirtualMachine runsOn PhysicalServer
- Application runsOn VirtualMachine runsOn VirtualMachine runsOn PhysicalServer
- ...
I imagine that this could somehow be expressed using the closure
operator of OCL but I can't quite figure out the correct syntax.