Release 5

This page is part of the FHIR Specification (v5.0.0: R5 - STU). This is a downloaded copy of the specification. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

Elementdefinition.shex

Modeling and Methodology Work GroupMaturity Level: N/AStandards Status: Informative

Raw ShEx

ShEx statement for ElementDefinition

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 <id.shex>
IMPORT <uri.shex>
IMPORT <oid.shex>
IMPORT <url.shex>
IMPORT <Age.shex>
IMPORT <code.shex>
IMPORT <date.shex>
IMPORT <time.shex>
IMPORT <uuid.shex>
IMPORT <Meta.shex>
IMPORT <Count.shex>
IMPORT <Money.shex>
IMPORT <Range.shex>
IMPORT <Ratio.shex>
IMPORT <string.shex>
IMPORT <Coding.shex>
IMPORT <Period.shex>
IMPORT <Timing.shex>
IMPORT <Dosage.shex>
IMPORT <boolean.shex>
IMPORT <Element.shex>
IMPORT <decimal.shex>
IMPORT <instant.shex>
IMPORT <integer.shex>
IMPORT <Address.shex>
IMPORT <markdown.shex>
IMPORT <dateTime.shex>
IMPORT <Distance.shex>
IMPORT <Duration.shex>
IMPORT <Quantity.shex>
IMPORT <canonical.shex>
IMPORT <integer64.shex>
IMPORT <HumanName.shex>
IMPORT <Reference.shex>
IMPORT <Signature.shex>
IMPORT <Annotation.shex>
IMPORT <Attachment.shex>
IMPORT <Identifier.shex>
IMPORT <RatioRange.shex>
IMPORT <Expression.shex>
IMPORT <unsignedInt.shex>
IMPORT <positiveInt.shex>
IMPORT <SampledData.shex>
IMPORT <BackboneType.shex>
IMPORT <base64Binary.shex>
IMPORT <ContactPoint.shex>
IMPORT <UsageContext.shex>
IMPORT <Availability.shex>
IMPORT <ContactDetail.shex>
IMPORT <CodeableConcept.shex>
IMPORT <DataRequirement.shex>
IMPORT <RelatedArtifact.shex>
IMPORT <CodeableReference.shex>
IMPORT <TriggerDefinition.shex>
IMPORT <ParameterDefinition.shex>
IMPORT <ExtendedContactDetail.shex>

# Definition of an element in a resource or extension
<ElementDefinition> EXTENDS @<BackboneType> CLOSED {   

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

    fhir:path @<string>;                    # Path of the element in the 
                                            # hierarchy of elements 
    fhir:representation @<OneOrMore_code> AND
    	{fhir:v @fhirvs:property-representation}?;  # xmlAttr | xmlText | typeAttr | 
                                            # cdaText | xhtml 
    fhir:sliceName @<string>?;              # Name for this particular element 
                                            # (in a set of slices) 
    fhir:sliceIsConstraining @<boolean>?;   # If this slice definition 
                                            # constrains an inherited slice 
                                            # definition (or not) 
    fhir:label @<string>?;                  # Name for element to display with 
                                            # or prompt for element 
    fhir:code @<OneOrMore_Coding>?;         # Corresponding codes in 
                                            # terminologies 
    fhir:slicing @<Element>?;               # This element is sliced - slices 
                                            # follow 
    fhir:short @<string>?;                  # Concise definition for 
                                            # space-constrained presentation 
    fhir:definition @<markdown>?;           # Full formal definition as 
                                            # narrative text 
    fhir:comment @<markdown>?;              # Comments about the use of this 
                                            # element 
    fhir:requirements @<markdown>?;         # Why this resource has been created
    fhir:alias @<OneOrMore_string>?;        # Other names
    fhir:min @<unsignedInt>?;               # Minimum Cardinality
    fhir:max @<string>?;                    # Maximum Cardinality (a number or *)
    fhir:base @<Element>?;                  # Base definition information for 
                                            # tools 
    fhir:contentReference @<uri>?;          # Reference to definition of content 
                                            # for the element 
    fhir:type @<OneOrMore_Element>?;        # Data type and Profile for this 
                                            # element 
    fhir:defaultValue @<base64Binary>  OR 
    			@<boolean>  OR 
    			@<canonical>  OR 
    			@<code>  OR 
    			@<date>  OR 
    			@<dateTime>  OR 
    			@<decimal>  OR 
    			@<id>  OR 
    			@<instant>  OR 
    			@<integer>  OR 
    			@<integer64>  OR 
    			@<markdown>  OR 
    			@<oid>  OR 
    			@<positiveInt>  OR 
    			@<string>  OR 
    			@<time>  OR 
    			@<unsignedInt>  OR 
    			@<uri>  OR 
    			@<url>  OR 
    			@<uuid>  OR 
    			@<Address>  OR 
    			@<Age>  OR 
    			@<Annotation>  OR 
    			@<Attachment>  OR 
    			@<CodeableConcept>  OR 
    			@<CodeableReference>  OR 
    			@<Coding>  OR 
    			@<ContactPoint>  OR 
    			@<Count>  OR 
    			@<Distance>  OR 
    			@<Duration>  OR 
    			@<HumanName>  OR 
    			@<Identifier>  OR 
    			@<Money>  OR 
    			@<Period>  OR 
    			@<Quantity>  OR 
    			@<Range>  OR 
    			@<Ratio>  OR 
    			@<RatioRange>  OR 
    			@<Reference>  OR 
    			@<SampledData>  OR 
    			@<Signature>  OR 
    			@<Timing>  OR 
    			@<ContactDetail>  OR 
    			@<DataRequirement>  OR 
    			@<Expression>  OR 
    			@<ParameterDefinition>  OR 
    			@<RelatedArtifact>  OR 
    			@<TriggerDefinition>  OR 
    			@<UsageContext>  OR 
    			@<Availability>  OR 
    			@<ExtendedContactDetail>  OR 
    			@<Dosage>  OR 
    			@<Meta>  ?;  # Specified value if missing from 
                                            # instance 
    fhir:meaningWhenMissing @<markdown>?;   # Implicit meaning when this element 
                                            # is missing 
    fhir:orderMeaning @<string>?;           # What the order of the elements 
                                            # means 
    fhir:fixed @<base64Binary>  OR 
    			@<boolean>  OR 
    			@<canonical>  OR 
    			@<code>  OR 
    			@<date>  OR 
    			@<dateTime>  OR 
    			@<decimal>  OR 
    			@<id>  OR 
    			@<instant>  OR 
    			@<integer>  OR 
    			@<integer64>  OR 
    			@<markdown>  OR 
    			@<oid>  OR 
    			@<positiveInt>  OR 
    			@<string>  OR 
    			@<time>  OR 
    			@<unsignedInt>  OR 
    			@<uri>  OR 
    			@<url>  OR 
    			@<uuid>  OR 
    			@<Address>  OR 
    			@<Age>  OR 
    			@<Annotation>  OR 
    			@<Attachment>  OR 
    			@<CodeableConcept>  OR 
    			@<CodeableReference>  OR 
    			@<Coding>  OR 
    			@<ContactPoint>  OR 
    			@<Count>  OR 
    			@<Distance>  OR 
    			@<Duration>  OR 
    			@<HumanName>  OR 
    			@<Identifier>  OR 
    			@<Money>  OR 
    			@<Period>  OR 
    			@<Quantity>  OR 
    			@<Range>  OR 
    			@<Ratio>  OR 
    			@<RatioRange>  OR 
    			@<Reference>  OR 
    			@<SampledData>  OR 
    			@<Signature>  OR 
    			@<Timing>  OR 
    			@<ContactDetail>  OR 
    			@<DataRequirement>  OR 
    			@<Expression>  OR 
    			@<ParameterDefinition>  OR 
    			@<RelatedArtifact>  OR 
    			@<TriggerDefinition>  OR 
    			@<UsageContext>  OR 
    			@<Availability>  OR 
    			@<ExtendedContactDetail>  OR 
    			@<Dosage>  OR 
    			@<Meta>  ?;  # Value must be exactly this
    fhir:pattern @<base64Binary>  OR 
    			@<boolean>  OR 
    			@<canonical>  OR 
    			@<code>  OR 
    			@<date>  OR 
    			@<dateTime>  OR 
    			@<decimal>  OR 
    			@<id>  OR 
    			@<instant>  OR 
    			@<integer>  OR 
    			@<integer64>  OR 
    			@<markdown>  OR 
    			@<oid>  OR 
    			@<positiveInt>  OR 
    			@<string>  OR 
    			@<time>  OR 
    			@<unsignedInt>  OR 
    			@<uri>  OR 
    			@<url>  OR 
    			@<uuid>  OR 
    			@<Address>  OR 
    			@<Age>  OR 
    			@<Annotation>  OR 
    			@<Attachment>  OR 
    			@<CodeableConcept>  OR 
    			@<CodeableReference>  OR 
    			@<Coding>  OR 
    			@<ContactPoint>  OR 
    			@<Count>  OR 
    			@<Distance>  OR 
    			@<Duration>  OR 
    			@<HumanName>  OR 
    			@<Identifier>  OR 
    			@<Money>  OR 
    			@<Period>  OR 
    			@<Quantity>  OR 
    			@<Range>  OR 
    			@<Ratio>  OR 
    			@<RatioRange>  OR 
    			@<Reference>  OR 
    			@<SampledData>  OR 
    			@<Signature>  OR 
    			@<Timing>  OR 
    			@<ContactDetail>  OR 
    			@<DataRequirement>  OR 
    			@<Expression>  OR 
    			@<ParameterDefinition>  OR 
    			@<RelatedArtifact>  OR 
    			@<TriggerDefinition>  OR 
    			@<UsageContext>  OR 
    			@<Availability>  OR 
    			@<ExtendedContactDetail>  OR 
    			@<Dosage>  OR 
    			@<Meta>  ?;  # Value must have at least these 
                                            # property values 
    fhir:example @<OneOrMore_Element>?;     # Example value (as defined for type)
    fhir:minValue @<date>  OR 
    			@<dateTime>  OR 
    			@<instant>  OR 
    			@<time>  OR 
    			@<decimal>  OR 
    			@<integer>  OR 
    			@<integer64>  OR 
    			@<positiveInt>  OR 
    			@<unsignedInt>  OR 
    			@<Quantity>  ?;  # Minimum Allowed Value (for some 
                                            # types) 
    fhir:maxValue @<date>  OR 
    			@<dateTime>  OR 
    			@<instant>  OR 
    			@<time>  OR 
    			@<decimal>  OR 
    			@<integer>  OR 
    			@<integer64>  OR 
    			@<positiveInt>  OR 
    			@<unsignedInt>  OR 
    			@<Quantity>  ?;  # Maximum Allowed Value (for some 
                                            # types) 
    fhir:maxLength @<integer>?;             # Max length for string type data
    fhir:condition @<OneOrMore_id>?;        # Reference to invariant about 
                                            # presence 
    fhir:constraint @<OneOrMore_Element>?;  # Condition that must evaluate to 
                                            # true 
    fhir:mustHaveValue @<boolean>?;         # For primitives, that a value must 
                                            # be present - not replaced by an 
                                            # extension 
    fhir:valueAlternatives @<OneOrMore_canonical>?;  # Extensions that are allowed to 
                                            # replace a primitive value 
    fhir:mustSupport @<boolean>?;           # If the element must be supported 
                                            # (discouraged - see obligations) 
    fhir:isModifier @<boolean>?;            # If this modifies the meaning of 
                                            # other elements 
    fhir:isModifierReason @<string>?;       # Reason that this element is marked 
                                            # as a modifier 
    fhir:isSummary @<boolean>?;             # Include when _summary = true?
    fhir:binding @<Element>?;               # ValueSet details if this is coded
    fhir:mapping @<OneOrMore_Element>?;     # Map element to another set of 
                                            # definitions 
}  

# Element values that are used to distinguish the slices
<ElementDefinition.slicing.discriminator> EXTENDS @<Element> CLOSED {   
    fhir:type @<code> AND
    	{fhir:v @fhirvs:discriminator-type};  # value | exists | type | profile | 
                                            # position 
    fhir:path @<string>;                    # Path to element value
}  

# Data type and Profile for this element
<ElementDefinition.type> EXTENDS @<Element> CLOSED {   
    fhir:code @<uri>;                       # Data type or Resource (reference 
                                            # to definition) 
    fhir:profile @<OneOrMore_canonical>?;   # Profiles (StructureDefinition or 
                                            # IG) - one must apply 
    fhir:targetProfile @<OneOrMore_canonical>?;  # Profile (StructureDefinition or 
                                            # IG) on the Reference/canonical 
                                            # target - one must apply 
    fhir:aggregation @<OneOrMore_code> AND
    	{fhir:v @fhirvs:resource-aggregation-mode}?;  # contained | referenced | bundled - 
                                            # how aggregated 
    fhir:versioning @<code> AND
    	{fhir:v @fhirvs:reference-version-rules}?;  # either | independent | specific
}  

# Base definition information for tools
<ElementDefinition.base> EXTENDS @<Element> CLOSED {   
    fhir:path @<string>;                    # Path that identifies the base 
                                            # element 
    fhir:min @<unsignedInt>;                # Min cardinality of the base element
    fhir:max @<string>;                     # Max cardinality of the base element
}  

# ValueSet details if this is coded
<ElementDefinition.binding> EXTENDS @<Element> CLOSED {   
    fhir:strength @<code> AND
    	{fhir:v @fhirvs:binding-strength};  # required | extensible | preferred 
                                            # | example 
    fhir:description @<markdown>?;          # Intended use of codes in the bound 
                                            # value set 
    fhir:valueSet @<canonical>?;            # Source of value set
    fhir:additional @<OneOrMore_Element>?;  # Additional Bindings - more rules 
                                            # about the binding 
}  

# Map element to another set of definitions
<ElementDefinition.mapping> EXTENDS @<Element> CLOSED {   
    fhir:identity @<id>;                    # Reference to mapping declaration
    fhir:language @<code> AND
    	{fhir:v @fhirvs:mimetypes}?;  # Computable language of mapping
    fhir:map @<string>;                     # Details of the mapping
    fhir:comment @<markdown>?;              # Comments about the mapping or its 
                                            # use 
}  

# This element is sliced - slices follow
<ElementDefinition.slicing> EXTENDS @<Element> CLOSED {   
    fhir:discriminator @<OneOrMore_Element>?;  # Element values that are used to 
                                            # distinguish the slices 
    fhir:description @<string>?;            # Text description of how slicing 
                                            # works (or not) 
    fhir:ordered @<boolean>?;               # If elements must be in same order 
                                            # as slices 
    fhir:rules @<code> AND
    	{fhir:v @fhirvs:resource-slicing-rules};  # closed | open | openAtEnd
}  

# Additional Bindings - more rules about the binding
<ElementDefinition.binding.additional> EXTENDS @<Element> CLOSED {   
    fhir:purpose @<code> AND
    	{fhir:v @fhirvs:additional-binding-purpose};  # maximum | minimum | required | 
                                            # extensible | candidate | current | 
                                            # preferred | ui | starter | 
                                            # component 
    fhir:valueSet @<canonical>;             # The value set for the additional 
                                            # binding 
    fhir:documentation @<markdown>?;        # Documentation of the purpose of 
                                            # use of the binding 
    fhir:shortDoco @<string>?;              # Concise documentation - for 
                                            # summary tables 
    fhir:usage @<OneOrMore_UsageContext>?;  # Qualifies the usage - 
                                            # jurisdiction, gender, workflow 
                                            # status etc. 
    fhir:any @<boolean>?;                   # Whether binding can applies to all 
                                            # repeats, or just one 
}  

# Example value (as defined for type)
<ElementDefinition.example> EXTENDS @<Element> CLOSED {   
    fhir:label @<string>;                   # Describes the purpose of this 
                                            # example 
    fhir:value @<base64Binary>  OR 
    			@<boolean>  OR 
    			@<canonical>  OR 
    			@<code>  OR 
    			@<date>  OR 
    			@<dateTime>  OR 
    			@<decimal>  OR 
    			@<id>  OR 
    			@<instant>  OR 
    			@<integer>  OR 
    			@<integer64>  OR 
    			@<markdown>  OR 
    			@<oid>  OR 
    			@<positiveInt>  OR 
    			@<string>  OR 
    			@<time>  OR 
    			@<unsignedInt>  OR 
    			@<uri>  OR 
    			@<url>  OR 
    			@<uuid>  OR 
    			@<Address>  OR 
    			@<Age>  OR 
    			@<Annotation>  OR 
    			@<Attachment>  OR 
    			@<CodeableConcept>  OR 
    			@<CodeableReference>  OR 
    			@<Coding>  OR 
    			@<ContactPoint>  OR 
    			@<Count>  OR 
    			@<Distance>  OR 
    			@<Duration>  OR 
    			@<HumanName>  OR 
    			@<Identifier>  OR 
    			@<Money>  OR 
    			@<Period>  OR 
    			@<Quantity>  OR 
    			@<Range>  OR 
    			@<Ratio>  OR 
    			@<RatioRange>  OR 
    			@<Reference>  OR 
    			@<SampledData>  OR 
    			@<Signature>  OR 
    			@<Timing>  OR 
    			@<ContactDetail>  OR 
    			@<DataRequirement>  OR 
    			@<Expression>  OR 
    			@<ParameterDefinition>  OR 
    			@<RelatedArtifact>  OR 
    			@<TriggerDefinition>  OR 
    			@<UsageContext>  OR 
    			@<Availability>  OR 
    			@<ExtendedContactDetail>  OR 
    			@<Dosage>  OR 
    			@<Meta>  ;  # Value of Example (one of allowed 
                                            # types) 
}  

# Condition that must evaluate to true
<ElementDefinition.constraint> EXTENDS @<Element> CLOSED {   
    fhir:key @<id>;                         # Target of 'condition' reference 
                                            # above 
    fhir:requirements @<markdown>?;         # Why this constraint is necessary 
                                            # or appropriate 
    fhir:severity @<code> AND
    	{fhir:v @fhirvs:constraint-severity};  # error | warning
    fhir:suppress @<boolean>?;              # Suppress warning or hint in profile
    fhir:human @<string>;                   # Human description of constraint
    fhir:expression @<string>?;             # FHIRPath expression of constraint
    fhir:source @<canonical>?;              # Reference to original source of 
                                            # constraint 
}  

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

<OneOrMore_code> CLOSED {
    rdf:first @<code>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_code> 
}

<OneOrMore_Coding> CLOSED {
    rdf:first @<Coding>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Coding> 
}

<OneOrMore_string> CLOSED {
    rdf:first @<string>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_string> 
}

<OneOrMore_Element> CLOSED {
    rdf:first @<Element>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Element> 
}

<OneOrMore_id> CLOSED {
    rdf:first @<id>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_id> 
}

<OneOrMore_canonical> CLOSED {
    rdf:first @<canonical>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_canonical> 
}

<OneOrMore_UsageContext> CLOSED {
    rdf:first @<UsageContext>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_UsageContext> 
}

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

# Additional Binding Purpose
fhirvs:additional-binding-purpose ["maximum" "minimum" "required" "extensible" "candidate" "current" "preferred" "ui" "starter" "component"]

# Indication of the degree of conformance expectations associated with a binding.
fhirvs:binding-strength ["required" "extensible" "preferred" "example"]

# SHALL applications comply with this constraint?
fhirvs:constraint-severity ["error" "warning"]

# How an element value is interpreted when discrimination is evaluated.
fhirvs:discriminator-type ["value" "exists" "pattern" "type" "profile" "position"]

# This value set includes all possible codes from BCP-13 (see http://tools.ietf.org/html/bcp13)
fhirvs:mimetypes xsd:string #EXTERNAL

# How a property is represented when serialized.
fhirvs:property-representation ["xmlAttr" "xmlText" "typeAttr" "cdaText" "xhtml"]

# Whether a reference needs to be version specific or version independent, or whether either can be used.
fhirvs:reference-version-rules ["either" "independent" "specific"]

# How resource references can be aggregated.
fhirvs:resource-aggregation-mode ["contained" "referenced" "bundled"]

# How slices are interpreted when evaluating an instance.
fhirvs:resource-slicing-rules ["closed" "open" "openAtEnd"]


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.