Reply To: Selecting a subtype instance in OAL

homepage Forums BridgePoint/xtUML Usage and Training Selecting a subtype instance in OAL Reply To: Selecting a subtype instance in OAL

#6009
Levi
Participant

In OAL, you must specify key letters in all association traversals. So in your case:

select one dl_subtype_inst related by dl_inst->SUBTYPE_KL[R1];

Unfortunately, OAL doesn’t support selecting a generic subtype as it appears you may be trying to do. The typical pattern used here would be something like:

select one dl_subtype_inst related by dl_inst->SUBTYPE1_KL[R1];
if ( empty dl_subtype_inst )
select one dl_subtype_inst related by dl_inst->SUBTYPE2_KL[R1];
if ( empty dl_subtype_inst )
select one dl_subtype_inst related by dl_inst->SUBTYPE3_KL[R1];
if ( empty dl_subtype_inst )
// …. etc ….
end if;
end if;
end if;

Depending on what you are attempting to do with the generic subtype, there is some support. xtUML and OAL support polymorphic event handling, i.e. events can be generated to a supertype instance and each of the subtype instance can handle them in their own state machines.

Another feature that I have personally been wanting for a long time is deferred (abstract) operations. An operation could be defined on a supertype class and in each of its subtype classes. If invoked on an instance of the supertype, the related subtype operation would get invoked. This is not currently supported, but it would be interesting to hear if there are other people that have been wanting it!

Levi