Structure definition: Contained resources

Hello,
I am creating structure definition for document reference resource.
It has subject which references a contained resource.

How do I present this in structure definition?

Look at http://build.fhir.org/documentreference-example.xml
the Practitioner is contained, its id is a2 and it is referred to from author using #a2

Thank you, how ever I’m looking to see how to present this in structure definition.

First, make sure you’re using ‘contained’ appropriately. ‘contained’ isn’t intended as an easy transport mechanism, it’s used when the ‘contained’ resource doesn’t have enough information/identity to stand as an independent resource. If a resource is ‘contained’, then it can’t be effectively searched on its own and essentially has to stay as a ‘contained’ resource.

To profile and say that a resource must be contained, you can use the aggregationMode on the Reference element in the referencing profile to indicate that the target resource must be contained.