R6 Ballot (1st Draft)

This page is part of the FHIR Specification v6.0.0-ballot1: Release 6 Ballot (1st Draft) (see Ballot Notes). The current version is 5.0.0. For a full list of available versions, see the Directory of published versions

5.10 Resource GraphDefinition - Content

FHIR Infrastructure icon Work GroupMaturity Level: 2 Trial UseSecurity Category: Anonymous Compartments: No defined compartments

A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by following references. The Graph Definition resource defines a set and makes rules about the set.

The GraphDefinition resource provides a formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by following references. The Graph Definition resource defines a set and makes rules about the set. The GraphDefinition 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 GraphDefinitions:

  • A StructureDefinition 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 GraphDefinition
  • A GraphDefinition defines rules about the relationships between resources, and in so doing, implies some constraints that could or should be represented in their profiles, if they are defined
  • Like CompartmentDefinition, GraphDefinition allows defining a grouping of resources and may be used for security access permissions. However, GraphDefinitions do not define additional query capabilities and are much more limited in how membership in the collection is defined (all resources that are part of a Compartment must expose a search parameter of the same name).

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 of resources will meet the constraints expressed. Applications should - but are not required to - detect when such incompatibilities arise.

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. GraphDefinition TUDomainResourceDefinition of a graph of resources
+ Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation

Elements defined in Ancestors: id, meta, implicitRules, language, text, contained, extension, modifierExtension
Interfaces Implemented: CanonicalResource
... url ΣC0..1uriCanonical identifier for this graph definition, represented as a URI (globally unique)
+ Warning: URL should not contain | or # - these characters make processing canonical references problematic
... identifier Σ0..*IdentifierAdditional identifier for the GraphDefinition (business identifier)

... version Σ0..1stringBusiness version of the graph definition
.... versionAlgorithmStringstring
.... versionAlgorithmCodingCoding
... name ΣC1..1stringName for this graph definition (computer friendly)
... title ΣT0..1stringName for this graph definition (human friendly)
... status ?!Σ1..1codedraft | active | retired | unknown
Binding: PublicationStatus (Required)
... experimental Σ0..1booleanFor testing purposes, not real usage
... date Σ0..1dateTimeDate last changed
... publisher ΣT0..1stringName of the publisher/steward (organization or individual)
... contact Σ0..*ContactDetailContact details for the publisher

... description T0..1markdownNatural language description of the graph definition
... useContext Σ0..*UsageContextThe context that the content is intended to support

... jurisdiction ΣXD0..*CodeableConceptIntended jurisdiction for graph definition (if applicable)
Binding: Jurisdiction ValueSet (Extensible)

... purpose T0..1markdownWhy this graph definition is defined
... copyright T0..1markdownUse and/or publishing restrictions
... copyrightLabel T0..1stringCopyright holder and year(s)
... start 0..1idStarting Node
... node 0..*BackboneElementPotential target for the link

.... nodeId 1..1idInternal ID - target for link references
.... description 0..1stringWhy this node is specified
.... type 1..1codeType of resource this link refers to
Binding: Version Independent Resource Types (All) (Required)
Additional BindingsPurpose
All Resource TypesUI Binding

.... profile 0..1canonical(StructureDefinition)Profile for the target resource
... link 0..*BackboneElementLinks this graph makes rules about

.... description 0..1stringWhy this link is specified
.... min 0..1integerMinimum occurrences for this link
.... max 0..1stringMaximum occurrences for this link
.... sourceId 1..1idSource Node for this link
.... path 0..1stringPath in the resource that contains the link
.... sliceName 0..1stringWhich slice (if profiled)
.... targetId 1..1idTarget Node for this link
.... params 0..1stringCriteria for reverse lookup
.... compartment 0..*BackboneElementCompartment Consistency Rules

..... use 1..1codewhere | requires
Binding: Graph Compartment Use (Required)
..... rule 1..1codeidentical | matching | different | custom
Binding: Graph Compartment Rule (Required)
..... code 1..1codePatient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
Binding: Compartment Type (Required)
..... expression 0..1stringCustom rule, as a FHIRPath expression
..... description 0..1stringDocumentation for FHIRPath expression

doco Documentation for this format icon

See the Extensions for this resource

UML Diagram (Legend)

GraphDefinition (DomainResource) +CanonicalResourceAn absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different serversurl : uri [0..1]A formal identifier that is used to identify this GraphDefinition when it is represented in other formats, or referenced in a specification, model, design or an instanceidentifier : Identifier [0..*]The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequenceversion : string [0..1]Indicates the mechanism used to compare versions to determine which is more currentversionAlgorithm[x] : DataType [0..1] « string|Coding; null (Strength=Extensible) VersionAlgorithm+ »A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generationname : string [1..1] « This element has or is affected by some invariantsC »A short, descriptive, user-friendly title for the capability statementtitle : string [0..1]The status of this graph definition. Enables tracking the life-cycle of the content (this element modifies the meaning of other elements)status : code [1..1] « null (Strength=Required)PublicationStatus! »A Boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usageexperimental : boolean [0..1]The date (and optionally time) when the graph definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changesdate : dateTime [0..1]The name of the organization or individual responsible for the release and ongoing maintenance of the graph definitionpublisher : string [0..1]Contact details to assist a user in finding and communicating with the publishercontact : ContactDetail [0..*]A free text natural language description of the graph definition from a consumer's perspectivedescription : markdown [0..1]The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate graph definition instancesuseContext : UsageContext [0..*]A legal or geographic region in which the graph definition is intended to be usedjurisdiction : CodeableConcept [0..*] « null (Strength=Extensible)JurisdictionValueSet+ »Explanation of why this graph definition is needed and why it has been designed as it haspurpose : markdown [0..1]A copyright statement relating to the graph definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the graph definitioncopyright : markdown [0..1]A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved')copyrightLabel : string [0..1]The Node at which instances of this graph start. If there is no nominated start, the graph can start at any of the nodesstart : id [0..1]NodeInternal ID of node - target for link referencesnodeId : id [1..1]Information about why this node is of interest in this graph definitiondescription : string [0..1]Type of resource this link refers totype : code [1..1] « null (Strength=Required)VersionIndependentResourceTyp...! »Profile for the target resourceprofile : canonical [0..1] « StructureDefinition »LinkInformation about why this link is of interest in this graph definitiondescription : string [0..1]Minimum occurrences for this linkmin : integer [0..1]Maximum occurrences for this linkmax : string [0..1]The source node for this linksourceId : id [1..1]A FHIRPath expression that identifies one of FHIR References to other resourcespath : string [0..1]Which slice (if profiled)sliceName : string [0..1]The target node for this linktargetId : id [1..1]A set of parameters to look upparams : string [0..1]CompartmentDefines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followeduse : code [1..1] « null (Strength=Required)GraphCompartmentUse! »identical | matching | different | no-rule | customrule : code [1..1] « null (Strength=Required)GraphCompartmentRule! »Identifies the compartmentcode : code [1..1] « null (Strength=Required)CompartmentType! »Custom rule, as a FHIRPath expressionexpression : string [0..1]Documentation for FHIRPath expressiondescription : string [0..1]Potential target for the linknode[0..*]Compartment Consistency Rulescompartment[0..*]Links this graph makes rules aboutlink[0..*]

XML Template

<GraphDefinition xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <!-- from DomainResource: text, contained, extension, and modifierExtension -->
 <url value="[uri]"/><!-- 0..1 Canonical identifier for this graph definition, represented as a URI (globally unique) -->
 <identifier><!-- 0..* Identifier Additional identifier for the GraphDefinition (business identifier) --></identifier>
 <version value="[string]"/><!-- 0..1 Business version of the graph definition -->
 <versionAlgorithm[x]><!-- 0..1 string|Coding How to compare versions --></versionAlgorithm[x]>
 <name value="[string]"/><!-- I 1..1 Name for this graph definition (computer friendly) -->
 <title value="[string]"/><!-- 0..1 Name for this graph definition (human friendly) -->
 <status value="[code]"/><!-- 1..1 draft | active | retired | unknown -->
 <experimental value="[boolean]"/><!-- 0..1 For testing purposes, not real usage -->
 <date value="[dateTime]"/><!-- 0..1 Date last changed -->
 <publisher value="[string]"/><!-- 0..1 Name of the publisher/steward (organization or individual) -->
 <contact><!-- 0..* ContactDetail Contact details for the publisher --></contact>
 <description value="[markdown]"/><!-- 0..1 Natural language description of the graph definition -->
 <useContext><!-- 0..* UsageContext The context that the content is intended to support --></useContext>
 <jurisdiction><!-- 0..* CodeableConcept Intended jurisdiction for graph definition (if applicable) --></jurisdiction>
 <purpose value="[markdown]"/><!-- 0..1 Why this graph definition is defined -->
 <copyright value="[markdown]"/><!-- 0..1 Use and/or publishing restrictions -->
 <copyrightLabel value="[string]"/><!-- 0..1 Copyright holder and year(s) -->
 <start value="[id]"/><!-- 0..1 Starting Node -->
 <node>  <!-- 0..* Potential target for the link -->
  <nodeId value="[id]"/><!-- 1..1 Internal ID - target for link references -->
  <description value="[string]"/><!-- 0..1 Why this node is specified -->
  <type value="[code]"/><!-- 1..1 Type of resource this link refers to -->
  <profile><!-- 0..1 canonical(StructureDefinition) Profile for the target resource --></profile>
 </node>
 <link>  <!-- 0..* Links this graph makes rules about -->
  <description value="[string]"/><!-- 0..1 Why this link is specified -->
  <min value="[integer]"/><!-- 0..1 Minimum occurrences for this link -->
  <max value="[string]"/><!-- 0..1 Maximum occurrences for this link -->
  <sourceId value="[id]"/><!-- 1..1 Source Node for this link -->
  <path value="[string]"/><!-- 0..1 Path in the resource that contains the link -->
  <sliceName value="[string]"/><!-- 0..1 Which slice (if profiled) -->
  <targetId value="[id]"/><!-- 1..1 Target Node for this link -->
  <params value="[string]"/><!-- 0..1 Criteria for reverse lookup -->
  <compartment>  <!-- 0..* Compartment Consistency Rules -->
   <use value="[code]"/><!-- 1..1 where | requires -->
   <rule value="[code]"/><!-- 1..1 identical | matching | different | custom -->
   <code value="[code]"/><!-- 1..1 Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare -->
   <expression value="[string]"/><!-- 0..1 Custom rule, as a FHIRPath expression -->
   <description value="[string]"/><!-- 0..1 Documentation for FHIRPath expression -->
  </compartment>
 </link>
</GraphDefinition>

JSON Template

{doco
  "resourceType" : "GraphDefinition",
  // from Resource: id, meta, implicitRules, and language
  // from DomainResource: text, contained, extension, and modifierExtension
  "url" : "<uri>", // Canonical identifier for this graph definition, represented as a URI (globally unique)
  "identifier" : [{ Identifier }], // Additional identifier for the GraphDefinition (business identifier)
  "version" : "<string>", // Business version of the graph definition
  // versionAlgorithm[x]: How to compare versions. One of these 2:
  "versionAlgorithmString" : "<string>",
  "versionAlgorithmCoding" : { Coding },
  "name" : "<string>", // I R!  Name for this graph definition (computer friendly)
  "title" : "<string>", // Name for this graph definition (human friendly)
  "status" : "<code>", // R!  draft | active | retired | unknown
  "experimental" : <boolean>, // For testing purposes, not real usage
  "date" : "<dateTime>", // Date last changed
  "publisher" : "<string>", // Name of the publisher/steward (organization or individual)
  "contact" : [{ ContactDetail }], // Contact details for the publisher
  "description" : "<markdown>", // Natural language description of the graph definition
  "useContext" : [{ UsageContext }], // The context that the content is intended to support
  "jurisdiction" : [{ CodeableConcept }], // Intended jurisdiction for graph definition (if applicable)
  "purpose" : "<markdown>", // Why this graph definition is defined
  "copyright" : "<markdown>", // Use and/or publishing restrictions
  "copyrightLabel" : "<string>", // Copyright holder and year(s)
  "start" : "<id>", // Starting Node
  "node" : [{ // Potential target for the link
    "nodeId" : "<id>", // R!  Internal ID - target for link references
    "description" : "<string>", // Why this node is specified
    "type" : "<code>", // R!  Type of resource this link refers to
    "profile" : "<canonical(StructureDefinition)>" // Profile for the target resource
  }],
  "link" : [{ // Links this graph makes rules about
    "description" : "<string>", // Why this link is specified
    "min" : <integer>, // Minimum occurrences for this link
    "max" : "<string>", // Maximum occurrences for this link
    "sourceId" : "<id>", // R!  Source Node for this link
    "path" : "<string>", // Path in the resource that contains the link
    "sliceName" : "<string>", // Which slice (if profiled)
    "targetId" : "<id>", // R!  Target Node for this link
    "params" : "<string>", // Criteria for reverse lookup
    "compartment" : [{ // Compartment Consistency Rules
      "use" : "<code>", // R!  where | requires
      "rule" : "<code>", // R!  identical | matching | different | custom
      "code" : "<code>", // R!  Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
      "expression" : "<string>", // Custom rule, as a FHIRPath expression
      "description" : "<string>" // Documentation for FHIRPath expression
    }]
  }]
}

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco


[ a fhir:GraphDefinition;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root

  # from Resource: .id, .meta, .implicitRules, and .language
  # from DomainResource: .text, .contained, .extension, and .modifierExtension
  fhir:url [ uri ] ; # 0..1 Canonical identifier for this graph definition, represented as a URI (globally unique)
  fhir:identifier  ( [ Identifier ] ... ) ; # 0..* Additional identifier for the GraphDefinition (business identifier)
  fhir:version [ string ] ; # 0..1 Business version of the graph definition
  # versionAlgorithm[x] : 0..1 How to compare versions. One of these 2
    fhir:versionAlgorithm [  a fhir:string ; string ]
    fhir:versionAlgorithm [  a fhir:Coding ; Coding ]
  fhir:name [ string ] ; # 1..1 I Name for this graph definition (computer friendly)
  fhir:title [ string ] ; # 0..1 Name for this graph definition (human friendly)
  fhir:status [ code ] ; # 1..1 draft | active | retired | unknown
  fhir:experimental [ boolean ] ; # 0..1 For testing purposes, not real usage
  fhir:date [ dateTime ] ; # 0..1 Date last changed
  fhir:publisher [ string ] ; # 0..1 Name of the publisher/steward (organization or individual)
  fhir:contact  ( [ ContactDetail ] ... ) ; # 0..* Contact details for the publisher
  fhir:description [ markdown ] ; # 0..1 Natural language description of the graph definition
  fhir:useContext  ( [ UsageContext ] ... ) ; # 0..* The context that the content is intended to support
  fhir:jurisdiction  ( [ CodeableConcept ] ... ) ; # 0..* Intended jurisdiction for graph definition (if applicable)
  fhir:purpose [ markdown ] ; # 0..1 Why this graph definition is defined
  fhir:copyright [ markdown ] ; # 0..1 Use and/or publishing restrictions
  fhir:copyrightLabel [ string ] ; # 0..1 Copyright holder and year(s)
  fhir:start [ id ] ; # 0..1 Starting Node
  fhir:node ( [ # 0..* Potential target for the link
    fhir:nodeId [ id ] ; # 1..1 Internal ID - target for link references
    fhir:description [ string ] ; # 0..1 Why this node is specified
    fhir:type [ code ] ; # 1..1 Type of resource this link refers to
    fhir:profile [ canonical(StructureDefinition) ] ; # 0..1 Profile for the target resource
  ] ... ) ;
  fhir:link ( [ # 0..* Links this graph makes rules about
    fhir:description [ string ] ; # 0..1 Why this link is specified
    fhir:min [ integer ] ; # 0..1 Minimum occurrences for this link
    fhir:max [ string ] ; # 0..1 Maximum occurrences for this link
    fhir:sourceId [ id ] ; # 1..1 Source Node for this link
    fhir:path [ string ] ; # 0..1 Path in the resource that contains the link
    fhir:sliceName [ string ] ; # 0..1 Which slice (if profiled)
    fhir:targetId [ id ] ; # 1..1 Target Node for this link
    fhir:params [ string ] ; # 0..1 Criteria for reverse lookup
    fhir:compartment ( [ # 0..* Compartment Consistency Rules
      fhir:use [ code ] ; # 1..1 where | requires
      fhir:rule [ code ] ; # 1..1 identical | matching | different | custom
      fhir:code [ code ] ; # 1..1 Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
      fhir:expression [ string ] ; # 0..1 Custom rule, as a FHIRPath expression
      fhir:description [ string ] ; # 0..1 Documentation for FHIRPath expression
    ] ... ) ;
  ] ... ) ;
]

Changes from both R4 and R4B

GraphDefinition
GraphDefinition.identifier
  • Added Element
GraphDefinition.versionAlgorithm[x]
  • Added Element
GraphDefinition.title
  • Added Element
GraphDefinition.copyright
  • Added Element
GraphDefinition.copyrightLabel
  • Added Element
GraphDefinition.start
  • Min Cardinality changed from 1 to 0
  • Type changed from code to id
  • Remove Binding `http://hl7.org/fhir/ValueSet/resource-types|4.0.0` (required)
GraphDefinition.node
  • Added Element
GraphDefinition.node.nodeId
  • Added Mandatory Element
GraphDefinition.node.description
  • Added Element
GraphDefinition.node.type
  • Added Mandatory Element
GraphDefinition.node.profile
  • Added Element
GraphDefinition.link.sourceId
  • Added Mandatory Element
GraphDefinition.link.targetId
  • Added Mandatory Element
GraphDefinition.link.params
  • Added Element
GraphDefinition.link.compartment
  • Added Element
GraphDefinition.link.compartment.use
  • Added Mandatory Element
GraphDefinition.link.compartment.rule
  • Added Mandatory Element
GraphDefinition.link.compartment.code
  • Added Mandatory Element
GraphDefinition.link.compartment.expression
  • Added Element
GraphDefinition.link.compartment.description
  • Added Element
GraphDefinition.profile
  • Deleted (-> .node.profile)
GraphDefinition.link.target
  • Deleted (-> .link.targetId / .node.nodeId)

See the Full Difference for further information

This analysis is available for R4 as XML or JSON and for R4B as XML or JSON.

See R4 <--> R5 Conversion Maps (status = See Conversions Summary.)

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. GraphDefinition TUDomainResourceDefinition of a graph of resources
+ Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation

Elements defined in Ancestors: id, meta, implicitRules, language, text, contained, extension, modifierExtension
Interfaces Implemented: CanonicalResource
... url ΣC0..1uriCanonical identifier for this graph definition, represented as a URI (globally unique)
+ Warning: URL should not contain | or # - these characters make processing canonical references problematic
... identifier Σ0..*IdentifierAdditional identifier for the GraphDefinition (business identifier)

... version Σ0..1stringBusiness version of the graph definition
.... versionAlgorithmStringstring
.... versionAlgorithmCodingCoding
... name ΣC1..1stringName for this graph definition (computer friendly)
... title ΣT0..1stringName for this graph definition (human friendly)
... status ?!Σ1..1codedraft | active | retired | unknown
Binding: PublicationStatus (Required)
... experimental Σ0..1booleanFor testing purposes, not real usage
... date Σ0..1dateTimeDate last changed
... publisher ΣT0..1stringName of the publisher/steward (organization or individual)
... contact Σ0..*ContactDetailContact details for the publisher

... description T0..1markdownNatural language description of the graph definition
... useContext Σ0..*UsageContextThe context that the content is intended to support

... jurisdiction ΣXD0..*CodeableConceptIntended jurisdiction for graph definition (if applicable)
Binding: Jurisdiction ValueSet (Extensible)

... purpose T0..1markdownWhy this graph definition is defined
... copyright T0..1markdownUse and/or publishing restrictions
... copyrightLabel T0..1stringCopyright holder and year(s)
... start 0..1idStarting Node
... node 0..*BackboneElementPotential target for the link

.... nodeId 1..1idInternal ID - target for link references
.... description 0..1stringWhy this node is specified
.... type 1..1codeType of resource this link refers to
Binding: Version Independent Resource Types (All) (Required)
Additional BindingsPurpose
All Resource TypesUI Binding

.... profile 0..1canonical(StructureDefinition)Profile for the target resource
... link 0..*BackboneElementLinks this graph makes rules about

.... description 0..1stringWhy this link is specified
.... min 0..1integerMinimum occurrences for this link
.... max 0..1stringMaximum occurrences for this link
.... sourceId 1..1idSource Node for this link
.... path 0..1stringPath in the resource that contains the link
.... sliceName 0..1stringWhich slice (if profiled)
.... targetId 1..1idTarget Node for this link
.... params 0..1stringCriteria for reverse lookup
.... compartment 0..*BackboneElementCompartment Consistency Rules

..... use 1..1codewhere | requires
Binding: Graph Compartment Use (Required)
..... rule 1..1codeidentical | matching | different | custom
Binding: Graph Compartment Rule (Required)
..... code 1..1codePatient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
Binding: Compartment Type (Required)
..... expression 0..1stringCustom rule, as a FHIRPath expression
..... description 0..1stringDocumentation for FHIRPath expression

doco Documentation for this format icon

See the Extensions for this resource

UML Diagram (Legend)

GraphDefinition (DomainResource) +CanonicalResourceAn absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different serversurl : uri [0..1]A formal identifier that is used to identify this GraphDefinition when it is represented in other formats, or referenced in a specification, model, design or an instanceidentifier : Identifier [0..*]The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequenceversion : string [0..1]Indicates the mechanism used to compare versions to determine which is more currentversionAlgorithm[x] : DataType [0..1] « string|Coding; null (Strength=Extensible) VersionAlgorithm+ »A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generationname : string [1..1] « This element has or is affected by some invariantsC »A short, descriptive, user-friendly title for the capability statementtitle : string [0..1]The status of this graph definition. Enables tracking the life-cycle of the content (this element modifies the meaning of other elements)status : code [1..1] « null (Strength=Required)PublicationStatus! »A Boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usageexperimental : boolean [0..1]The date (and optionally time) when the graph definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changesdate : dateTime [0..1]The name of the organization or individual responsible for the release and ongoing maintenance of the graph definitionpublisher : string [0..1]Contact details to assist a user in finding and communicating with the publishercontact : ContactDetail [0..*]A free text natural language description of the graph definition from a consumer's perspectivedescription : markdown [0..1]The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate graph definition instancesuseContext : UsageContext [0..*]A legal or geographic region in which the graph definition is intended to be usedjurisdiction : CodeableConcept [0..*] « null (Strength=Extensible)JurisdictionValueSet+ »Explanation of why this graph definition is needed and why it has been designed as it haspurpose : markdown [0..1]A copyright statement relating to the graph definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the graph definitioncopyright : markdown [0..1]A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved')copyrightLabel : string [0..1]The Node at which instances of this graph start. If there is no nominated start, the graph can start at any of the nodesstart : id [0..1]NodeInternal ID of node - target for link referencesnodeId : id [1..1]Information about why this node is of interest in this graph definitiondescription : string [0..1]Type of resource this link refers totype : code [1..1] « null (Strength=Required)VersionIndependentResourceTyp...! »Profile for the target resourceprofile : canonical [0..1] « StructureDefinition »LinkInformation about why this link is of interest in this graph definitiondescription : string [0..1]Minimum occurrences for this linkmin : integer [0..1]Maximum occurrences for this linkmax : string [0..1]The source node for this linksourceId : id [1..1]A FHIRPath expression that identifies one of FHIR References to other resourcespath : string [0..1]Which slice (if profiled)sliceName : string [0..1]The target node for this linktargetId : id [1..1]A set of parameters to look upparams : string [0..1]CompartmentDefines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followeduse : code [1..1] « null (Strength=Required)GraphCompartmentUse! »identical | matching | different | no-rule | customrule : code [1..1] « null (Strength=Required)GraphCompartmentRule! »Identifies the compartmentcode : code [1..1] « null (Strength=Required)CompartmentType! »Custom rule, as a FHIRPath expressionexpression : string [0..1]Documentation for FHIRPath expressiondescription : string [0..1]Potential target for the linknode[0..*]Compartment Consistency Rulescompartment[0..*]Links this graph makes rules aboutlink[0..*]

XML Template

<GraphDefinition xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <!-- from DomainResource: text, contained, extension, and modifierExtension -->
 <url value="[uri]"/><!-- 0..1 Canonical identifier for this graph definition, represented as a URI (globally unique) -->
 <identifier><!-- 0..* Identifier Additional identifier for the GraphDefinition (business identifier) --></identifier>
 <version value="[string]"/><!-- 0..1 Business version of the graph definition -->
 <versionAlgorithm[x]><!-- 0..1 string|Coding How to compare versions --></versionAlgorithm[x]>
 <name value="[string]"/><!-- I 1..1 Name for this graph definition (computer friendly) -->
 <title value="[string]"/><!-- 0..1 Name for this graph definition (human friendly) -->
 <status value="[code]"/><!-- 1..1 draft | active | retired | unknown -->
 <experimental value="[boolean]"/><!-- 0..1 For testing purposes, not real usage -->
 <date value="[dateTime]"/><!-- 0..1 Date last changed -->
 <publisher value="[string]"/><!-- 0..1 Name of the publisher/steward (organization or individual) -->
 <contact><!-- 0..* ContactDetail Contact details for the publisher --></contact>
 <description value="[markdown]"/><!-- 0..1 Natural language description of the graph definition -->
 <useContext><!-- 0..* UsageContext The context that the content is intended to support --></useContext>
 <jurisdiction><!-- 0..* CodeableConcept Intended jurisdiction for graph definition (if applicable) --></jurisdiction>
 <purpose value="[markdown]"/><!-- 0..1 Why this graph definition is defined -->
 <copyright value="[markdown]"/><!-- 0..1 Use and/or publishing restrictions -->
 <copyrightLabel value="[string]"/><!-- 0..1 Copyright holder and year(s) -->
 <start value="[id]"/><!-- 0..1 Starting Node -->
 <node>  <!-- 0..* Potential target for the link -->
  <nodeId value="[id]"/><!-- 1..1 Internal ID - target for link references -->
  <description value="[string]"/><!-- 0..1 Why this node is specified -->
  <type value="[code]"/><!-- 1..1 Type of resource this link refers to -->
  <profile><!-- 0..1 canonical(StructureDefinition) Profile for the target resource --></profile>
 </node>
 <link>  <!-- 0..* Links this graph makes rules about -->
  <description value="[string]"/><!-- 0..1 Why this link is specified -->
  <min value="[integer]"/><!-- 0..1 Minimum occurrences for this link -->
  <max value="[string]"/><!-- 0..1 Maximum occurrences for this link -->
  <sourceId value="[id]"/><!-- 1..1 Source Node for this link -->
  <path value="[string]"/><!-- 0..1 Path in the resource that contains the link -->
  <sliceName value="[string]"/><!-- 0..1 Which slice (if profiled) -->
  <targetId value="[id]"/><!-- 1..1 Target Node for this link -->
  <params value="[string]"/><!-- 0..1 Criteria for reverse lookup -->
  <compartment>  <!-- 0..* Compartment Consistency Rules -->
   <use value="[code]"/><!-- 1..1 where | requires -->
   <rule value="[code]"/><!-- 1..1 identical | matching | different | custom -->
   <code value="[code]"/><!-- 1..1 Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare -->
   <expression value="[string]"/><!-- 0..1 Custom rule, as a FHIRPath expression -->
   <description value="[string]"/><!-- 0..1 Documentation for FHIRPath expression -->
  </compartment>
 </link>
</GraphDefinition>

JSON Template

{doco
  "resourceType" : "GraphDefinition",
  // from Resource: id, meta, implicitRules, and language
  // from DomainResource: text, contained, extension, and modifierExtension
  "url" : "<uri>", // Canonical identifier for this graph definition, represented as a URI (globally unique)
  "identifier" : [{ Identifier }], // Additional identifier for the GraphDefinition (business identifier)
  "version" : "<string>", // Business version of the graph definition
  // versionAlgorithm[x]: How to compare versions. One of these 2:
  "versionAlgorithmString" : "<string>",
  "versionAlgorithmCoding" : { Coding },
  "name" : "<string>", // I R!  Name for this graph definition (computer friendly)
  "title" : "<string>", // Name for this graph definition (human friendly)
  "status" : "<code>", // R!  draft | active | retired | unknown
  "experimental" : <boolean>, // For testing purposes, not real usage
  "date" : "<dateTime>", // Date last changed
  "publisher" : "<string>", // Name of the publisher/steward (organization or individual)
  "contact" : [{ ContactDetail }], // Contact details for the publisher
  "description" : "<markdown>", // Natural language description of the graph definition
  "useContext" : [{ UsageContext }], // The context that the content is intended to support
  "jurisdiction" : [{ CodeableConcept }], // Intended jurisdiction for graph definition (if applicable)
  "purpose" : "<markdown>", // Why this graph definition is defined
  "copyright" : "<markdown>", // Use and/or publishing restrictions
  "copyrightLabel" : "<string>", // Copyright holder and year(s)
  "start" : "<id>", // Starting Node
  "node" : [{ // Potential target for the link
    "nodeId" : "<id>", // R!  Internal ID - target for link references
    "description" : "<string>", // Why this node is specified
    "type" : "<code>", // R!  Type of resource this link refers to
    "profile" : "<canonical(StructureDefinition)>" // Profile for the target resource
  }],
  "link" : [{ // Links this graph makes rules about
    "description" : "<string>", // Why this link is specified
    "min" : <integer>, // Minimum occurrences for this link
    "max" : "<string>", // Maximum occurrences for this link
    "sourceId" : "<id>", // R!  Source Node for this link
    "path" : "<string>", // Path in the resource that contains the link
    "sliceName" : "<string>", // Which slice (if profiled)
    "targetId" : "<id>", // R!  Target Node for this link
    "params" : "<string>", // Criteria for reverse lookup
    "compartment" : [{ // Compartment Consistency Rules
      "use" : "<code>", // R!  where | requires
      "rule" : "<code>", // R!  identical | matching | different | custom
      "code" : "<code>", // R!  Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
      "expression" : "<string>", // Custom rule, as a FHIRPath expression
      "description" : "<string>" // Documentation for FHIRPath expression
    }]
  }]
}

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco


[ a fhir:GraphDefinition;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root

  # from Resource: .id, .meta, .implicitRules, and .language
  # from DomainResource: .text, .contained, .extension, and .modifierExtension
  fhir:url [ uri ] ; # 0..1 Canonical identifier for this graph definition, represented as a URI (globally unique)
  fhir:identifier  ( [ Identifier ] ... ) ; # 0..* Additional identifier for the GraphDefinition (business identifier)
  fhir:version [ string ] ; # 0..1 Business version of the graph definition
  # versionAlgorithm[x] : 0..1 How to compare versions. One of these 2
    fhir:versionAlgorithm [  a fhir:string ; string ]
    fhir:versionAlgorithm [  a fhir:Coding ; Coding ]
  fhir:name [ string ] ; # 1..1 I Name for this graph definition (computer friendly)
  fhir:title [ string ] ; # 0..1 Name for this graph definition (human friendly)
  fhir:status [ code ] ; # 1..1 draft | active | retired | unknown
  fhir:experimental [ boolean ] ; # 0..1 For testing purposes, not real usage
  fhir:date [ dateTime ] ; # 0..1 Date last changed
  fhir:publisher [ string ] ; # 0..1 Name of the publisher/steward (organization or individual)
  fhir:contact  ( [ ContactDetail ] ... ) ; # 0..* Contact details for the publisher
  fhir:description [ markdown ] ; # 0..1 Natural language description of the graph definition
  fhir:useContext  ( [ UsageContext ] ... ) ; # 0..* The context that the content is intended to support
  fhir:jurisdiction  ( [ CodeableConcept ] ... ) ; # 0..* Intended jurisdiction for graph definition (if applicable)
  fhir:purpose [ markdown ] ; # 0..1 Why this graph definition is defined
  fhir:copyright [ markdown ] ; # 0..1 Use and/or publishing restrictions
  fhir:copyrightLabel [ string ] ; # 0..1 Copyright holder and year(s)
  fhir:start [ id ] ; # 0..1 Starting Node
  fhir:node ( [ # 0..* Potential target for the link
    fhir:nodeId [ id ] ; # 1..1 Internal ID - target for link references
    fhir:description [ string ] ; # 0..1 Why this node is specified
    fhir:type [ code ] ; # 1..1 Type of resource this link refers to
    fhir:profile [ canonical(StructureDefinition) ] ; # 0..1 Profile for the target resource
  ] ... ) ;
  fhir:link ( [ # 0..* Links this graph makes rules about
    fhir:description [ string ] ; # 0..1 Why this link is specified
    fhir:min [ integer ] ; # 0..1 Minimum occurrences for this link
    fhir:max [ string ] ; # 0..1 Maximum occurrences for this link
    fhir:sourceId [ id ] ; # 1..1 Source Node for this link
    fhir:path [ string ] ; # 0..1 Path in the resource that contains the link
    fhir:sliceName [ string ] ; # 0..1 Which slice (if profiled)
    fhir:targetId [ id ] ; # 1..1 Target Node for this link
    fhir:params [ string ] ; # 0..1 Criteria for reverse lookup
    fhir:compartment ( [ # 0..* Compartment Consistency Rules
      fhir:use [ code ] ; # 1..1 where | requires
      fhir:rule [ code ] ; # 1..1 identical | matching | different | custom
      fhir:code [ code ] ; # 1..1 Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare
      fhir:expression [ string ] ; # 0..1 Custom rule, as a FHIRPath expression
      fhir:description [ string ] ; # 0..1 Documentation for FHIRPath expression
    ] ... ) ;
  ] ... ) ;
]

Changes from both R4 and R4B

GraphDefinition
GraphDefinition.identifier
  • Added Element
GraphDefinition.versionAlgorithm[x]
  • Added Element
GraphDefinition.title
  • Added Element
GraphDefinition.copyright
  • Added Element
GraphDefinition.copyrightLabel
  • Added Element
GraphDefinition.start
  • Min Cardinality changed from 1 to 0
  • Type changed from code to id
  • Remove Binding `http://hl7.org/fhir/ValueSet/resource-types|4.0.0` (required)
GraphDefinition.node
  • Added Element
GraphDefinition.node.nodeId
  • Added Mandatory Element
GraphDefinition.node.description
  • Added Element
GraphDefinition.node.type
  • Added Mandatory Element
GraphDefinition.node.profile
  • Added Element
GraphDefinition.link.sourceId
  • Added Mandatory Element
GraphDefinition.link.targetId
  • Added Mandatory Element
GraphDefinition.link.params
  • Added Element
GraphDefinition.link.compartment
  • Added Element
GraphDefinition.link.compartment.use
  • Added Mandatory Element
GraphDefinition.link.compartment.rule
  • Added Mandatory Element
GraphDefinition.link.compartment.code
  • Added Mandatory Element
GraphDefinition.link.compartment.expression
  • Added Element
GraphDefinition.link.compartment.description
  • Added Element
GraphDefinition.profile
  • Deleted (-> .node.profile)
GraphDefinition.link.target
  • Deleted (-> .link.targetId / .node.nodeId)

See the Full Difference for further information

This analysis is available for R4 as XML or JSON and for R4B as XML or JSON.

See R4 <--> R5 Conversion Maps (status = See Conversions Summary.)

 

Additional definitions: Master Definition XML + JSON, XML Schema/Schematron + JSON Schema, ShEx (for Turtle) , the spreadsheet version & the dependency analysis

PathValueSetTypeDocumentation
GraphDefinition.versionAlgorithm[x] VersionAlgorithm Extensible

Indicates the mechanism used to compare versions to determine which is more current.

GraphDefinition.status PublicationStatus Required

The lifecycle status of an artifact.

GraphDefinition.jurisdiction JurisdictionValueSet Extensible

This value set defines a base set of codes for country, country subdivision and region for indicating where a resource is intended to be used.

Note: The codes for countries and country subdivisions are taken from ISO 3166 icon while the codes for "supra-national" regions are from UN Standard country or area codes for statistical use (M49) icon.

GraphDefinition.node.type VersionIndependentResourceTypesAll Required

Current and past FHIR resource types (deleted or renamed), including abstract types

  All Resource Types ui
GraphDefinition.link.compartment.use GraphCompartmentUse Required

Defines how a compartment rule is used.

GraphDefinition.link.compartment.rule GraphCompartmentRule Required

How a compartment must be linked.

GraphDefinition.link.compartment.code CompartmentType Required

Which type a compartment definition describes.

UniqueKeyLevelLocationDescriptionExpression
img cnl-0Warning (base)Name should be usable as an identifier for the module by machine processing applications such as code generationname.exists() implies name.matches('^[A-Z]([A-Za-z0-9_]){1,254}$')
img cnl-1Warning GraphDefinition.urlURL should not contain | or # - these characters make processing canonical references problematicexists() implies matches('^[^|# ]+$')

The GraphDefinition 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?

FHIR resources are relatively granular. In many/most cases, many resources are needed to handle any particular task. A typical example of this is a complex diagnostic report: it will start with a DiagnosticReport, which will link to a set of panels (Observation resources), each of which link to a set of Observation resources for atomic data items.

One way to represent this is to profile each of the resources, creating hundreds of profiles, and then leave it to the user to infer the overall pattern of the report from the detailed profiles for each observation in the report. But it's not easy to see the forest for the trees. A GraphDefinition can summarize the overall picture and present a summary to the user.

Here's an example icon of the kind of summary this represents. (Todo: make this an actual graph definition, and clone into the main spec)

As another example of using many resources, to completely represent a medication dispense, an application needs not only the MedicationDispense resource, but also resources to represent the patient, provider, organizations, and the associated prescription.

A client can retrieve a single resource:

  GET [base]/MedicationDispense/example

Then, when it reads the returned resource, it can fetch the referenced resources:

  GET [base]/Patient/example
  GET [base]/Practitioner/example
  GET [base]/MedicationRequest/example
  ... etc.

This is a very inefficient way to retrieve all the required resources. An alternative approach is to do a search, and _include the required resources:

  GET [base]/MedicationDispense?_id=example
    &_include=MedicationDispense:authorizingPrescription
    &_include=MedicationDispense:subject

But scaling this approach to fetch a full package with its dependencies becomes increasingly difficult as the package gets deeper. A graph definition can be used instead to inform the server what to return with the resource using the $graph operation:

  GET [base]/MedicationDispense/example/$graph?graph=med-package

This is a request to return a graph of resource, using the graph definition 'med-package'. In this case, the graph definition would look approximately like this:

MedicationDispense
  .subject
  .context
  .performer.actor
  .authorizingPrescription
     .requester.agent 
  .substitution.responsibleParty

Systems may either provide a pre-defined list of graph definitions that clients may choose from, or allow clients to define their own GraphDefinition resources and then refer to them.

Server may also allow clients also pass in their own graph definition using a text representation:

  GET [base]/MedicationDispense/example/$graph?definition=Patient{managingOrganization:Organization{endpoint:Endpoint}}

See below for further details.

A very similar issue applies when building a document using the $document operation. A document must include all the resources linked directly from the composition, but whether to include additional linked resources is at the discretion of the document author. How does the user inform the $document operation which linked resources to include? One option is a boolean flag for including all linked data, but this may be extensive - up to an entire patient record - and may include resources that are not desired.

An operation can use a graph definition as a parameter to the $document operation:

GET [base]/Composition/example/$document?graph=example

This tells the server to include the graph of resources defined in the example GraphDefinition - in this case, any resources referred to from lists, when the section content is a list. Alternatively, servers may allow a client to pass in a definition directly (as shown above) using the parameter definition.

One important question about the use of resources is cross-resource consistency. For example, if an Observation refers to both a Patient and Encounter, does the Encounter have to refer to the same patient?

In general, the answer to this is that it usually should - the record needs to be consistent. However there are edge cases where the references may differ. For example, with regard to patient references, they may differ for:

  • Health Records concerning mother and baby
  • Organ Transplants
  • Counselling, particularly family counselling

Other reasons for the references to differ - mixing records about the same patient from different servers, or specific records about patients mixed with records about groups of patients (particularly common in veterinarian care).

The GraphDefinition resource allows for compartment consistency rules to be made regarding the links between resources. For each link in the graph, the graph definition can make a rule about the compartment consistency. The rule can specify one of the following consistencies:

CodeMeaning
identicalThe compartment must be identical (the same literal reference)
matchingThe compartment must be the same - the record must be about the same patient, but the reference may be different
differentThe compartment must be different
customThe compartment rule is defined in the accompanying FHIRPath expression

Todo: how would this be validated? - where is the graph referred to?

GraphDefinition can walk a graph forward through the links, which is the natural order. As an example, consider a profile on composition that wants to specify that the graph follows the section entry into a list:

<!-- this graph starts with a composition. We don't care what the specific profile is
     (though the statement above 'this case doesn't cross patients' implies that we do care a little) -->
  <start value="composition1"/>
  
  <node>
    <nodeId value="composition1"/>
    <description value="The base composition"/>
    <type value="Composition"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/clinicaldocument"/>
  </node>
  <node>
    <nodeId value="list1"/>
    <description value="A list resource that a section entry reference points to"/>
    <type value="List"/>
  </node>
  <node>
    <nodeId value="resN"/>
    <description value="Generic resource that's the target of a list reference"/>
    <type value="Resource"/>
  </node>

  <!-- define the section -> list link -->
  <link>
    <description value="Link from Composition.section to list"/>
    <sourceId value="composition1"/>
    <!-- any section entry. Todo: this recurses; are we profiling this at all levels? --> 
    <path value="Composition.section.entry"/>
    <!-- 
      one target. This graph is not making rules about the content of the section entries - that
      would be done in a profile. it's just saying, if you see a reference to a list in a section
      entry, these are the rules that describe the graph
    -->
    <targetId value="list1"/>
  </link>    

  <!-- and from the list, any references -->
  <link>
    <description value="Include any list entries"/>
    <sourceId value="list1"/>
    <path value="List.entry.item"/>
    <targetId value="resN"/>
  </link>      

The pattern can be extended to require that the none of the resources in this little graph reference a different patient - that is, it is a requirement when traversing the links that the patient compartment remain identical:

  <!-- define the section -> list link -->
  <link>
    <description value="Link from Composition.section to list"/>
    <sourceId value="composition1"/>
    <!-- any section entry. Todo: this recurses; are we profiling this at all levels? --> 
    <path value="Composition.section.entry"/>
    <!-- 
      one target. This graph is not making rules about the content of the section entries - that
      would be done in a profile. it's just saying, if you see a reference to a list in a section
      entry, these are the rules that describe the graph
    -->
    <targetId value="list1"/>
    <compartment>
      <use value="requirement"/>
      <code value="Patient"/>
      <rule value="identical"/>
    </compartment>
  </link>    

  <!-- and from the list, any references -->
  <link>
    <description value="Include any list entries"/>
    <sourceId value="list1"/>
    <path value="List.entry.item"/>
    <targetId value="resN"/>
    <compartment>
      <use value="requirement"/>
      <code value="Patient"/>
      <rule value="identical"/>
    </compartment>
  </link>

Another useful approach is to walk any link * (e.g. wildcard support):

  <link>
    <sourceId value="comp1">
    <!-- 
      follow all links that refers to a list
    -->
    <path value="*"/>
    <targetId value="list1">
  </link>
  <!-- and inside this list, follow any references -->
  <link>
    <sourceId value="list1">
    <path value="*"/>
    <targetId value="resN"/>
  </link>      

or you can follow any links in any resource:

  <link>
    <!-- 
      follow all links 
    -->
    <path value="*"/>
    <targetid value="resN"/>
  </link>

It's also possible to build a graph by walking links in reverse. This technique is useful, for example, when including provenance resources in a document:

  <link>
    <sourceId value="obs1"/>
    <!-- if the path is missing <path value=""/> -->
    <targetId value="prov"/>  <!-- any provenance -->
    <!--
      and specify the search parameters to include 
      all the provenances that refer to this resource
    -->
    <params value="target={ref}"/>      
  </link>

For convenience, a graph definition may be represented using a text short hand form. A graph definition is introduced by two or more node statements:

node start comp1 'The base composition' = Composition (http://hl7.org/fhir/StructureDefinition/clinicaldocument);
node list1 'A list resource that a section entry reference points to' = List;
node resN 'Generic resource that's the target of a list reference' = Resource;

Each node declaration starts with the fixed word node followed by the nodeId, the node description, =, the node type, and then, if the node has a profile, the profile value in brackets. One of the nodes have the key word "start"

Once all the nodes are declared, then the links are declared:

link 'Link from Composition.section to list' = comp1[Composition.section.entry] -> list1 requires identical patient;
link 'Include any list entries' = list1[List.entry.item] -> resN requires identical patient;

The format for a link is:

link '{description}' {min}..{max} = sourceId[{path}:{sliceName}] {targetId}?{params} {resource-compartment-rules};

where:

  • description, min, max, path, sliceName, params and resource-type-rules are all optional
  • resource-compartment-rules is present if there's a compartent, and the syntax is {use} {rule} {code}. If the rule is 'custom' then the syntax is '=' '{fhirpath}' '{description}'

In this format, the amount of whitespace, and its form, is irrelevant. For the purposes of clarity, the statements here are laid out on different lines, but this is not required. When a GraphDefinition is used as a parameter in a url, no extra whitespace is used, just a single space, and the descriptions SHOULD be omitted.

Here is a full example that uses all the features of the syntax:

node pat = Patient;
node org = Organization;
node org2 = Organization;
node ept = EndPoint;
node prac = Practitioner;
node grp = Group;

link 'patient managing org' 0..1 = pat[managingOrganization] -> org;
link = org[endpoint] -> ept
link 'groups patient is in' = pat -> grp?item={ref}
link 'registered GP' = pat[generalPractitioner] -> org;
link 'Observations for the patient' = pat -> org?patient={ref};
link = org[performer] -> prac;
link = org[related.where(type='has-member').target] -> org2 requires matching Patient;
link = org[related.where(type='derived-from').target] -> org2 requires identical Patient;
link = org[related.where(type='sequel-to').target] -> org2 requires different Organization;
link = org[related.where(type='qualified-by').target] -> org2 requires custom Patient = path;

Search parameters for this resource. See also the full list of search parameters for this resource, and check the Extensions registry for search parameters on extensions related to this resource. The common parameters also apply. See Searching for more information about searching in REST, messaging, and services.

NameTypeDescriptionExpressionIn Common
contexttokenA use context assigned to the graph definition(GraphDefinition.useContext.value.ofType(CodeableConcept))30 Resources
context-quantityquantityA quantity- or range-valued use context assigned to the graph definition(GraphDefinition.useContext.value.ofType(Quantity)) | (GraphDefinition.useContext.value.ofType(Range))30 Resources
context-typetokenA type of use context assigned to the graph definitionGraphDefinition.useContext.code30 Resources
context-type-quantitycompositeA use context type and quantity- or range-based value assigned to the graph definitionOn GraphDefinition.useContext:
  context-type: code
  context-quantity: value.ofType(Quantity) | value.ofType(Range)
30 Resources
context-type-valuecompositeA use context type and value assigned to the graph definitionOn GraphDefinition.useContext:
  context-type: code
  context: value.ofType(CodeableConcept)
30 Resources
datedateThe graph definition publication dateGraphDefinition.date30 Resources
descriptionstringThe description of the graph definitionGraphDefinition.description28 Resources
identifier NtokenExternal identifier for the graph definitionGraphDefinition.identifier35 Resources
jurisdictiontokenIntended jurisdiction for the graph definitionGraphDefinition.jurisdiction26 Resources
namestringComputationally friendly name of the graph definitionGraphDefinition.name27 Resources
publisherstringName of the publisher of the graph definitionGraphDefinition.publisher30 Resources
starttokenType of resource at which the graph startsGraphDefinition.start
statustokenThe current status of the graph definitionGraphDefinition.status36 Resources
urluriThe uri that identifies the graph definitionGraphDefinition.url35 Resources
versiontokenThe business version of the graph definitionGraphDefinition.version30 Resources