Release 5

This page is part of the FHIR Specification (v5.0.0: R5 - STU). This is the current published version in it's permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

Bundle.shex

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: No defined compartments

Raw ShEx

ShEx statement for bundle

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <uri.shex>
IMPORT <code.shex>
IMPORT <string.shex>
IMPORT <instant.shex>
IMPORT <decimal.shex>
IMPORT <Resource.shex>
IMPORT <Signature.shex>
IMPORT <Identifier.shex>
IMPORT <unsignedInt.shex>
IMPORT <BackboneElement.shex>


start=@<Bundle> AND {fhir:nodeRole [fhir:treeRoot]}

# Contains a collection of resources
<Bundle> EXTENDS @<Resource> CLOSED {   

    a [fhir:Bundle]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:identifier @<Identifier>?;         # Persistent identifier for the 
                                            # bundle 
    fhir:type @<code> AND
    	{fhir:v @fhirvs:bundle-type};  # document | message | transaction | 
                                            # transaction-response | batch | 
                                            # batch-response | history | 
                                            # searchset | collection | 
                                            # subscription-notification 
    fhir:timestamp @<instant>?;             # When the bundle was assembled
    fhir:total @<unsignedInt>?;             # If search, the total number of 
                                            # matches 
    fhir:link @<OneOrMore_Bundle.link>?;    # Links related to this Bundle
    fhir:entry @<OneOrMore_Bundle.entry>?;  # Entry in the bundle - will have a 
                                            # resource or information 
    fhir:signature @<Signature>?;           # Digital Signature
    fhir:issues @<Resource>?;               # Issues with the Bundle
}  

# Additional execution information (transaction/batch/history)
<Bundle.entry.request> EXTENDS @<BackboneElement> CLOSED {   
    fhir:method @<code> AND
    	{fhir:v @fhirvs:http-verb};  # GET | HEAD | POST | PUT | DELETE | 
                                            # PATCH 
    fhir:url @<uri>;                        # URL for HTTP equivalent of this 
                                            # entry 
    fhir:ifNoneMatch @<string>?;            # For managing cache validation
    fhir:ifModifiedSince @<instant>?;       # For managing cache currency
    fhir:ifMatch @<string>?;                # For managing update contention
    fhir:ifNoneExist @<string>?;            # For conditional creates
}  

# Results of execution (transaction/batch/history)
<Bundle.entry.response> EXTENDS @<BackboneElement> CLOSED {   
    fhir:status @<string>;                  # Status response code (text 
                                            # optional) 
    fhir:location @<uri>?;                  # The location (if the operation 
                                            # returns a location) 
    fhir:etag @<string>?;                   # The Etag for the resource (if 
                                            # relevant) 
    fhir:lastModified @<instant>?;          # Server's date time modified
    fhir:outcome @<Resource>?;              # OperationOutcome with hints and 
                                            # warnings (for batch/transaction) 
}  

# Search related information
<Bundle.entry.search> EXTENDS @<BackboneElement> CLOSED {   
    fhir:mode @<code> AND
    	{fhir:v @fhirvs:search-entry-mode}?;  # match | include - why this is in 
                                            # the result set 
    fhir:score @<decimal>?;                 # Search ranking (between 0 and 1)
}  

# Links related to this Bundle
<Bundle.link> EXTENDS @<BackboneElement> CLOSED {   
    fhir:relation @<code> AND
    	{fhir:v @fhirvs:iana-link-relations};  # See 
                                            # http://www.iana.org/assignments/-
                                            # link-relations/link-relations.xh-
                                            # tml#link-relations-1 
    fhir:url @<uri>;                        # Reference details for the link
}  

# Entry in the bundle - will have a resource or information
<Bundle.entry> EXTENDS @<BackboneElement> CLOSED {   
    fhir:link @<OneOrMore_Bundle.link>?;    # Links related to this entry
    fhir:fullUrl @<uri>?;                   # URI for resource (e.g. the 
                                            # absolute URL server address, URI 
                                            # for UUID/OID, etc.) 
    fhir:resource @<Resource>?;             # A resource in the bundle
    fhir:search @<Bundle.entry.search>?;    # Search related information
    fhir:request @<Bundle.entry.request>?;  # Additional execution information 
                                            # (transaction/batch/history) 
    fhir:response @<Bundle.entry.response>?;  # Results of execution 
                                            # (transaction/batch/history) 
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Bundle.link> CLOSED {
    rdf:first @<Bundle.link>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Bundle.link> 
}

<OneOrMore_Bundle.entry> CLOSED {
    rdf:first @<Bundle.entry>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Bundle.entry> 
}

#---------------------- Value Sets ------------------------

# Indicates the purpose of a bundle - how it is intended to be used.
fhirvs:bundle-type ["document" "message" "transaction" "transaction-response" "batch" "batch-response" "history" "searchset" "collection" "subscription-notification"]

# HTTP verbs (in the HTTP command line). See [HTTP rfc](https://tools.ietf.org/html/rfc7231) for details.
fhirvs:http-verb ["GET" "HEAD" "POST" "PUT" "DELETE" "PATCH"]

# Link Relation Types defined at https://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
fhirvs:iana-link-relations ["about" "acl" "alternate" "amphtml" "appendix" "apple-touch-icon" "apple-touch-startup-image" "archives" "author" "blocked-by" "bookmark" "canonical" "chapter" "cite-as" "collection" "contents" "convertedFrom" "copyright" "create-form" "current" "describedby" "describes" "disclosure" "dns-prefetch" "duplicate" "edit" "edit-form" "edit-media" "enclosure" "external" "first" "glossary" "help" "hosts" "hub" "icon" "index" "intervalAfter" "intervalBefore" "intervalContains" "intervalDisjoint" "intervalDuring" "intervalEquals" "intervalFinishedBy" "intervalFinishes" "intervalIn" "intervalMeets" "intervalMetBy" "intervalOverlappedBy" "intervalOverlaps" "intervalStartedBy" "intervalStarts" "item" "last" "latest-version" "license" "linkset" "lrdd" "manifest" "mask-icon" "media-feed" "memento" "micropub" "modulepreload" "monitor" "monitor-group" "next" "next-archive" "nofollow" "noopener" "noreferrer" "opener" "openid2.local_id" "openid2.provider" "original" "P3Pv1" "payment" "pingback" "preconnect" "predecessor-version" "prefetch" "preload" "prerender" "prev" "preview" "previous" "prev-archive" "privacy-policy" "profile" "publication" "related" "restconf" "replies" "ruleinput" "search" "section" "self" "service" "service-desc" "service-doc" "service-meta" "sponsored" "start" "status" "stylesheet" "subsection" "successor-version" "sunset" "tag" "terms-of-service" "timegate" "timemap" "type" "ugc" "up" "version-history" "via" "webmention" "working-copy" "working-copy-of"]

# Why an entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.
fhirvs:search-entry-mode ["match" "include" "outcome"]


Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.