FHIR CI-Build

This is the Continuous Integration Build of FHIR (will be incorrect/inconsistent at times).
See the Directory of published versions

Structuremap.shex

Responsible Owner: FHIR Infrastructure Work GroupStandards Status: InformativeCompartments: No defined compartments

Raw ShEx

ShEx statement for structuremap

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#> 

# ShEx Version 2.2
IMPORT <Id.shex>
IMPORT <Uri.shex>
IMPORT <Code.shex>
IMPORT <Date.shex>
IMPORT <Time.shex>
IMPORT <String.shex>
IMPORT <Coding.shex>
IMPORT <Boolean.shex>
IMPORT <Integer.shex>
IMPORT <Decimal.shex>
IMPORT <DateTime.shex>
IMPORT <Markdown.shex>
IMPORT <Canonical.shex>
IMPORT <Identifier.shex>
IMPORT <UnsignedInt.shex>
IMPORT <UsageContext.shex>
IMPORT <ContactDetail.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>

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

# A Map of relationships between 2 structures that can be used to transform data
<StructureMap> EXTENDS @<DomainResource> CLOSED {   
    a [fhir:StructureMap]?;fhir:nodeRole [fhir:treeRoot]?;

    fhir:url @<Uri>;                        # Canonical identifier for this 
                                            # structure map, represented as a 
                                            # URI (globally unique) 
    fhir:identifier @<OneOrMore_Identifier>?;  # Additional identifier for the 
                                            # structure map 
    fhir:version @<String>?;                # Business version of the structure 
                                            # map 
    fhir:versionAlgorithm @<String>  OR 
    			@<Coding>  ?;  # How to compare versions
    fhir:name @<String>;                    # Name for this structure map 
                                            # (computer friendly) 
    fhir:title @<String>?;                  # Name for this structure map (human 
                                            # friendly) 
    fhir:status @<Code> AND
    	{fhir:v @fhirvs:publication-status};  # draft | active | retired | unknown
    fhir:experimental @<Boolean>?;          # For testing only - never for real 
                                            # usage 
    fhir:date @<DateTime>?;                 # Date last changed
    fhir:publisher @<String>?;              # Name of the publisher/steward 
                                            # (organization or individual) 
    fhir:contact @<OneOrMore_ContactDetail>?;  # Contact details for the publisher
    fhir:description @<Markdown>?;          # Natural language description of 
                                            # the structure map 
    fhir:useContext @<OneOrMore_UsageContext>?;  # The context that the content is 
                                            # intended to support 
    fhir:jurisdiction @<OneOrMore_CodeableConcept>?;  # Jurisdiction of the authority that 
                                            # maintains the structure map (if 
                                            # applicable) 
    fhir:purpose @<Markdown>?;              # Why this structure map is defined
    fhir:copyright @<Markdown>?;            # Notice about intellectual property 
                                            # ownership, can include 
                                            # restrictions on use 
    fhir:copyrightLabel @<String>?;         # Copyright holder and year(s)
    fhir:structure @<OneOrMore_StructureMap.structure>?;  # Structure Definition used by this 
                                            # map 
    fhir:import @<OneOrMore_Canonical>?;    # Other maps used by this map 
                                            # (canonical URLs) 
    fhir:const @<OneOrMore_StructureMap.const>?;  # Definition of the constant value 
                                            # used in the map rules 
    fhir:group @<OneOrMore_StructureMap.group>;  # Named sections for reader 
                                            # convenience 
}  

# Named sections for reader convenience
<StructureMap.group> EXTENDS @<BackboneElement> CLOSED {   
    fhir:name @<Id>;                        # Human-readable label
    fhir:extends @<Id>?;                    # Another group that this group adds 
                                            # rules to 
    fhir:typeMode @<Code> AND
    	{fhir:v @fhirvs:map-group-type-mode}?;  # types | type-and-types
    fhir:documentation @<String>?;          # Additional description/explanation 
                                            # for group 
    fhir:input @<OneOrMore_StructureMap.group.input>;  # Named instance provided when 
                                            # invoking the map 
    fhir:rule @<OneOrMore_StructureMap.group.rule>?;  # Transform Rule from source to 
                                            # target 
}  

# Parameters to the transform
<StructureMap.group.rule.target.parameter> EXTENDS @<BackboneElement> CLOSED {   
    fhir:value @<Id>  OR 
    			@<String>  OR 
    			@<Boolean>  OR 
    			@<Integer>  OR 
    			@<Decimal>  OR 
    			@<Date>  OR 
    			@<Time>  OR 
    			@<DateTime>  ;  # Parameter value - variable or 
                                            # literal 
}  

# Source inputs to the mapping
<StructureMap.group.rule.source> EXTENDS @<BackboneElement> CLOSED {   
    fhir:context @<Id>;                     # Type or variable this rule applies 
                                            # to 
    fhir:min @<UnsignedInt>?;               # Specified minimum cardinality
    fhir:max @<String>?;                    # Specified maximum cardinality 
                                            # (number or *) 
    fhir:type @<String>?;                   # Rule only applies if source has 
                                            # this type 
    fhir:defaultValue @<String>?;           # Default value if no value exists
    fhir:element @<String>?;                # Optional field for this source
    fhir:listMode @<Code> AND
    	{fhir:v @fhirvs:map-source-list-mode}?;  # first | not_first | last | 
                                            # not_last | only_one 
    fhir:variable @<Id>?;                   # Named context for field, if a 
                                            # field is specified 
    fhir:condition @<String>?;              # FHIRPath expression  - must be 
                                            # true or the rule does not apply 
    fhir:check @<String>?;                  # FHIRPath expression  - must be 
                                            # true or the mapping engine throws 
                                            # an error instead of completing 
    fhir:logMessage @<String>?;             # Message to put in log if source 
                                            # exists (FHIRPath) 
}  

# Definition of the constant value used in the map rules
<StructureMap.const> EXTENDS @<BackboneElement> CLOSED {   
    fhir:name @<Id>?;                       # Constant name
    fhir:value @<String>?;                  # FHIRPath exression - value of the 
                                            # constant 
}  

# Rules contained in this rule
<StructureMap.group.rule.rulenull> CLOSED {   
}  

# Content to create because of this mapping rule
<StructureMap.group.rule.target> EXTENDS @<BackboneElement> CLOSED {   
    fhir:context @<String>?;                # Variable this rule applies to
    fhir:element @<String>?;                # Field to create in the context
    fhir:variable @<Id>?;                   # Named context for field, if 
                                            # desired, and a field is specified 
    fhir:listMode @<OneOrMore_Code> AND
    	{fhir:v @fhirvs:map-target-list-mode}?;  # first | share | last | single
    fhir:listRuleId @<Id>?;                 # Internal rule reference for shared 
                                            # list items 
    fhir:transform @<Code> AND
    	{fhir:v @fhirvs:map-transform}?;  # create | copy +
    fhir:parameter @<OneOrMore_StructureMap.group.rule.target.parameter>?;  # Parameters to the transform
}  

# Named instance provided when invoking the map
<StructureMap.group.input> EXTENDS @<BackboneElement> CLOSED {   
    fhir:name @<Id>;                        # Name for this instance of data
    fhir:type @<String>?;                   # Type for this instance of data
    fhir:mode @<Code> AND
    	{fhir:v @fhirvs:map-input-mode};  # source | target
    fhir:documentation @<String>?;          # Documentation for this instance of 
                                            # data 
}  

# Structure Definition used by this map
<StructureMap.structure> EXTENDS @<BackboneElement> CLOSED {   
    fhir:url @<Canonical>;                  # Canonical reference to structure 
                                            # definition 
    fhir:mode @<Code> AND
    	{fhir:v @fhirvs:map-model-mode};  # source | queried | target | 
                                            # produced 
    fhir:alias @<String>?;                  # Name for type in this map
    fhir:documentation @<String>?;          # Documentation on use of structure
}  

# Transform Rule from source to target
<StructureMap.group.rule> EXTENDS @<BackboneElement> CLOSED {   
    fhir:name @<Id>?;                       # Name of the rule for internal 
                                            # references 
    fhir:source @<OneOrMore_StructureMap.group.rule.source>;  # Source inputs to the mapping
    fhir:target @<OneOrMore_StructureMap.group.rule.target>?;  # Content to create because of this 
                                            # mapping rule 
    fhir:rule @<OneOrMore_StructureMap.group.rule>?;  # Rules contained in this rule
    fhir:dependent @<OneOrMore_StructureMap.group.rule.dependent>?;  # Which other rules to apply in the 
                                            # context of this rule 
    fhir:documentation @<String>?;          # Documentation for this instance of 
                                            # data 
}  

# Which other rules to apply in the context of this rule
<StructureMap.group.rule.dependent> EXTENDS @<BackboneElement> CLOSED {   
    fhir:name @<Id>;                        # Name of a rule or group to apply
    fhir:parameter @<OneOrMore_StructureMap.group.rule.target.parameter>;  # Parameter to pass to the rule or 
                                            # group 
}  

#---------------------- Cardinality Types (OneOrMore) -------------------
<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}
<OneOrMore_ContactDetail> CLOSED {
    rdf:first @<ContactDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ContactDetail> 
}
<OneOrMore_UsageContext> CLOSED {
    rdf:first @<UsageContext>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_UsageContext> 
}
<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}
<OneOrMore_StructureMap.structure> CLOSED {
    rdf:first @<StructureMap.structure>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.structure> 
}
<OneOrMore_Canonical> CLOSED {
    rdf:first @<Canonical>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Canonical> 
}
<OneOrMore_StructureMap.const> CLOSED {
    rdf:first @<StructureMap.const>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.const> 
}
<OneOrMore_StructureMap.group> CLOSED {
    rdf:first @<StructureMap.group>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.group> 
}
<OneOrMore_StructureMap.group.input> CLOSED {
    rdf:first @<StructureMap.group.input>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.group.input> 
}
<OneOrMore_StructureMap.group.rule> CLOSED {
    rdf:first @<StructureMap.group.rule>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.group.rule> 
}
<OneOrMore_Code> CLOSED {
    rdf:first @<Code>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Code> 
}
<OneOrMore_StructureMap.group.rule.target.parameter> CLOSED {
    rdf:first @<StructureMap.group.rule.target.parameter>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.group.rule.target.parameter> 
}
<OneOrMore_StructureMap.group.rule.source> CLOSED {
    rdf:first @<StructureMap.group.rule.source>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.group.rule.source> 
}
<OneOrMore_StructureMap.group.rule.target> CLOSED {
    rdf:first @<StructureMap.group.rule.target>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.group.rule.target> 
}
<OneOrMore_StructureMap.group.rule.dependent> CLOSED {
    rdf:first @<StructureMap.group.rule.dependent>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_StructureMap.group.rule.dependent> 
}

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

# If this is the default rule set to apply for the source type, or this combination of types.
fhirvs:map-group-type-mode ["types" "type-and-types"]

# Mode for this instance of data.
fhirvs:map-input-mode ["source" "target"]

# How the referenced structure is used in this mapping.
fhirvs:map-model-mode ["source" "queried" "target" "produced"]

# If field is a list, how to manage the source.
fhirvs:map-source-list-mode ["first" "not_first" "last" "not_last" "only_one"]

# If field is a list, how to manage the production.
fhirvs:map-target-list-mode ["first" "share" "last" "single"]

# How data is copied/created.
fhirvs:map-transform ["create" "copy" "truncate" "escape" "cast" "append" "translate" "reference" "dateOp" "uuid" "pointer" "evaluate" "cc" "c" "qty" "id" "cp"]

# The lifecycle status of an artifact.
fhirvs:publication-status ["draft" "active" "retired" "unknown"]


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.