Accessing fields on extended types from references to parent type


A field on a type is set to PartyRole.

entity type someType schema name ‘REF’ {
myPartyRole : PartyRole
calcField1 : string ‘stored calc myPartyRole.field1’

There are several party roles defined, and myPartyRole above can be set to any of the below.

entity type PartyRole1 extends PartyRole type key ‘PR1’ {
field1 : string

entity type PartyRole2 extends PartyRole type key ‘PR2’ {
field2 : int

I need calcField1 to be field1 when myPartyRole is a PartyRole1. I can’t seem to do this traversal - someType.myPartyRole.field1. What’s the best way to do this?