The Graph Definition resource can be used to:
– Summarize a set of profiles on resources
– Define a graph of resources to return in a query
– Define a graph of resources to include in a document
– Document rules about the relationship between a set of resources e.g. must all resources concern the same patient?
There is a close relationship between Profiles and Graph Definitions:
– A Structure Definition defines a profile, and profiles can make rules about the relationships between resources. A carefully defined set of profiles implies part of what is in a Graph Definition
– A GraphDefinition defines rules about the relationships between resources, and in so doing, implies some constraints that would need to be represented in their profiles
Profiles and Graph Definitions can be used together, or separately. When used together, they should be consistent. Note, though, that a graph definition may contain a subset, or a superset of the relationships explicitly described in the profiles it refers to.
It is possible that in some circumstances, a graph definition makes incompatible rules with the Profiles it refers to – in this case, no graph if resources will meet the constraints expressed. Applications should – but are not required – detect when such incompatibilities arise.