FHIR Cross-Version Mapping Pack
0.1.0 - Ballot for Release 5.1.0 International flag

FHIR Cross-Version Mapping Pack, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-cross-version/ and changes regularly. See the Directory of published versions

: Provenance Transforms: R4 to R3 - XML Representation

Page standards status: Draft Maturity Level: 1

Raw xml | Download



<StructureMap xmlns="http://hl7.org/fhir">
  <id value="Provenance4to3"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><pre class="fml">
<span style="color: #cc00cc">/// <b>url</b> = </span><span style="color: blue">'http://hl7.org/fhir/StructureMap/Provenance4to3'</span>
<span style="color: #cc00cc">/// <b>name</b> = </span><span style="color: blue">'Provenance4to3'</span>
<span style="color: #cc00cc">/// <b>title</b> = </span><span style="color: blue">'Provenance Transforms: R4 to R3'</span>
<span style="color: #cc00cc">/// <b>status</b> = </span><span style="color: blue">'active'</span>

<b>uses</b><span style="color: navy"> &quot;</span>http://hl7.org/fhir/4.0/Provenance<span style="color: navy">&quot; </span><b>alias </b>Provenance <b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span>http://hl7.org/fhir/3.0/Provenance<span style="color: navy">&quot; </span><b>alias </b>ProvenanceR3 <b>as </b><b>target</b>

<b>imports</b><span style="color: navy"> &quot;</span>http://hl7.org/fhir/StructureMap/*4to3<span style="color: navy">&quot;
</span>
<b>group </b>Provenance<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>Provenance, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>ProvenanceR3<span style="color: navy">)</span><b> extends </b>DomainResource<b> &lt;&lt;type+&gt;&gt;</b><span style="color: navy"> {
</span>  src.target<span style="color: navy"><b> -&gt; </b></span>tgt.target<span style="color: navy">;</span>
  src.occurred<span style="color: navy"> : </span>Period<b> as </b><span style="color: maroon">vs0</span><span style="color: navy"><b> -&gt; </b></span>tgt.period<b> as </b><span style="color: maroon">vt0</span><b> then </b>Period<span style="color: navy">(</span><span style="color: maroon">vs0</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span> <i>&quot;period&quot;</i><span style="color: navy">;</span>
  src.occurred<span style="color: navy"> : </span>dateTime<b> as </b><span style="color: maroon">vs0</span><span style="color: navy"><b> -&gt; </b></span> tgt.period<b> as </b><span style="color: maroon">vt0</span><span style="color: navy">, </span> vt0.start = <span style="color: maroon">vs0</span><span style="color: navy">, </span> vt0.end = <span style="color: maroon">vs0</span> <i>&quot;period&quot;</i><span style="color: navy">;</span>
  src.recorded<span style="color: navy"><b> -&gt; </b></span>tgt.recorded<span style="color: navy">;</span>
  src.policy<span style="color: navy"><b> -&gt; </b></span>tgt.policy<span style="color: navy">;</span>
  src.location<span style="color: navy"><b> -&gt; </b></span>tgt.location<span style="color: navy">;</span>
  src.reason<span style="color: navy"><b> -&gt; </b></span>tgt.reason<span style="color: navy">;</span>
  src.activity<span style="color: navy"><b> -&gt; </b></span>tgt.activity<span style="color: navy">;</span>
  src.agent<b> as </b><span style="color: maroon">vs0</span><span style="color: navy"><b> -&gt; </b></span>tgt.agent<b> as </b><span style="color: maroon">vt0</span><b> then </b>agent<span style="color: navy">(</span><span style="color: maroon">vs0</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  src.entity<b> as </b><span style="color: maroon">vs0</span><span style="color: navy"><b> -&gt; </b></span>tgt.entity<b> as </b><span style="color: maroon">vt0</span><b> then </b>entity<span style="color: navy">(</span><span style="color: maroon">vs0</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  src.signature<span style="color: navy"><b> -&gt; </b></span>tgt.signature<span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>agent<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>ProvenanceR3, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>Provenance<span style="color: navy">)</span><b> extends </b>BackboneElement<span style="color: navy"> {
</span>  src.role<span style="color: navy"><b> -&gt; </b></span>tgt.role<span style="color: navy">;</span>
  src.who<b> as </b><span style="color: maroon">vs0</span><b> where </b>extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty()<span style="color: navy"><b> -&gt; </b></span>tgt.who = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt0</span><b> then </b>Reference<span style="color: navy">(</span><span style="color: maroon">vs0</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  src.who<b> as </b><span style="color: maroon">vs0</span><b> where </b>extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists()<span style="color: navy"><b> -&gt; </b></span>tgt.who = <b>create</b><span style="color: navy">(</span><span style="color: blue">'uri'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt0</span><b> then</b><span style="color: navy"> {
</span>    vs0.reference<b> as </b><span style="color: maroon">vs1</span><b> then </b>uri<span style="color: navy">(</span><span style="color: maroon">vs1</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  <span style="color: navy">}</span><span style="color: navy">;</span>
  src.onBehalfOf<b> as </b><span style="color: maroon">vs0</span><b> where </b>extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty()<span style="color: navy"><b> -&gt; </b></span>tgt.onBehalfOf = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt0</span><b> then </b>Reference<span style="color: navy">(</span><span style="color: maroon">vs0</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  src.onBehalfOf<b> as </b><span style="color: maroon">vs0</span><b> where </b>extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists()<span style="color: navy"><b> -&gt; </b></span>tgt.onBehalfOf = <b>create</b><span style="color: navy">(</span><span style="color: blue">'uri'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt0</span><b> then</b><span style="color: navy"> {
</span>    vs0.reference<b> as </b><span style="color: maroon">vs1</span><b> then </b>uri<span style="color: navy">(</span><span style="color: maroon">vs1</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  <span style="color: navy">}</span><span style="color: navy">;</span>
  src.type<span style="color: navy"><b> -&gt; </b></span>tgt.relatedAgentType<span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>entity<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>ProvenanceR3, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>Provenance<span style="color: navy">)</span><b> extends </b>BackboneElement<span style="color: navy"> {
</span>  src.role<span style="color: navy"><b> -&gt; </b></span>tgt.role<span style="color: navy">;</span>
  src.what<b> as </b><span style="color: maroon">vs0</span><b> where </b>extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty() and identifier.empty()<span style="color: navy"><b> -&gt; </b></span>tgt.what = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt0</span><b> then </b>Reference<span style="color: navy">(</span><span style="color: maroon">vs0</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  src.what<b> as </b><span style="color: maroon">vs0</span><b> where </b>extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists()<span style="color: navy"><b> -&gt; </b></span>tgt.what = <b>create</b><span style="color: navy">(</span><span style="color: blue">'uri'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt0</span><b> then</b><span style="color: navy"> {
</span>    vs0.reference<b> as </b><span style="color: maroon">vs1</span><b> then </b>uri<span style="color: navy">(</span><span style="color: maroon">vs1</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  <span style="color: navy">}</span><span style="color: navy">;</span>
  src.what<b> as </b><span style="color: maroon">vs0</span><b> where </b>identifier.exists()<span style="color: navy"><b> -&gt; </b></span>tgt.what = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Identifier'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt0</span><b> then </b>Reference2Identifier<span style="color: navy">(</span><span style="color: maroon">vs0</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
  src.agent<b> as </b><span style="color: maroon">vs0</span><span style="color: navy"><b> -&gt; </b></span>tgt.agent<b> as </b><span style="color: maroon">vt0</span><b> then </b>agent<span style="color: navy">(</span><span style="color: maroon">vs0</span><span style="color: navy">, </span><span style="color: maroon">vt0</span><span style="color: navy">)</span><span style="color: navy">;</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="fhir"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="1">
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom">
        <valueCanonical
                        value="http://hl7.org/fhir/extensions/ImplementationGuide/hl7.fhir.uv.xver"/>
      </extension>
    </valueInteger>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="draft">
      <extension
                 url="http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom">
        <valueCanonical
                        value="http://hl7.org/fhir/extensions/ImplementationGuide/hl7.fhir.uv.xver"/>
      </extension>
    </valueCode>
  </extension>
  <url value="http://hl7.org/fhir/StructureMap/Provenance4to3"/>
  <version value="0.1.0"/>
  <name value="Provenance4to3"/>
  <title value="Provenance Transforms: R4 to R3"/>
  <status value="active"/>
  <date value="2024-02-22T03:16:50+00:00"/>
  <publisher value="HL7 International / FHIR Infrastructure"/>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/fiwg"/>
    </telecom>
  </contact>
  <description value="ProvenanceTransformsR4toR3"/>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
    </coding>
  </jurisdiction>
  <structure>
    <url value="http://hl7.org/fhir/4.0/Provenance"/>
    <mode value="source"/>
    <alias value="Provenance"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/3.0/Provenance"/>
    <mode value="target"/>
    <alias value="ProvenanceR3"/>
  </structure>
  <import value="http://hl7.org/fhir/StructureMap/*4to3"/>
  <group>
    <name value="Provenance"/>
    <extends value="DomainResource"/>
    <typeMode value="type-and-types"/>
    <input>
      <name value="src"/>
      <type value="Provenance"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <type value="ProvenanceR3"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="target"/>
      <source>
        <context value="src"/>
        <element value="target"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="target"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="period"/>
      <source>
        <context value="src"/>
        <type value="Period"/>
        <element value="occurred"/>
        <variable value="vs0"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="period"/>
        <variable value="vt0"/>
      </target>
      <dependent>
        <name value="Period"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
        <parameter>
          <valueId value="vt0"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="period"/>
      <source>
        <context value="src"/>
        <type value="dateTime"/>
        <element value="occurred"/>
        <variable value="vs0"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="period"/>
        <variable value="vt0"/>
      </target>
      <target>
        <context value="vt0"/>
        <element value="start"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
      </target>
      <target>
        <context value="vt0"/>
        <element value="end"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="recorded"/>
      <source>
        <context value="src"/>
        <element value="recorded"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="recorded"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="policy"/>
      <source>
        <context value="src"/>
        <element value="policy"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="policy"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="location"/>
      <source>
        <context value="src"/>
        <element value="location"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="location"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="reason"/>
      <source>
        <context value="src"/>
        <element value="reason"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="reason"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="activity"/>
      <source>
        <context value="src"/>
        <element value="activity"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="activity"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="agent"/>
      <source>
        <context value="src"/>
        <element value="agent"/>
        <variable value="vs0"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="agent"/>
        <variable value="vt0"/>
      </target>
      <dependent>
        <name value="agent"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
        <parameter>
          <valueId value="vt0"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="entity"/>
      <source>
        <context value="src"/>
        <element value="entity"/>
        <variable value="vs0"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="entity"/>
        <variable value="vt0"/>
      </target>
      <dependent>
        <name value="entity"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
        <parameter>
          <valueId value="vt0"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="signature"/>
      <source>
        <context value="src"/>
        <element value="signature"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="signature"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
  </group>
  <group>
    <name value="agent"/>
    <extends value="BackboneElement"/>
    <input>
      <name value="src"/>
      <type value="ProvenanceR3"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <type value="Provenance"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="role"/>
      <source>
        <context value="src"/>
        <element value="role"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="role"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="who"/>
      <source>
        <context value="src"/>
        <element value="who"/>
        <variable value="vs0"/>
        <condition
                   value="extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty()"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="who"/>
        <variable value="vt0"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <dependent>
        <name value="Reference"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
        <parameter>
          <valueId value="vt0"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="who"/>
      <source>
        <context value="src"/>
        <element value="who"/>
        <variable value="vs0"/>
        <condition
                   value="extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists()"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="who"/>
        <variable value="vt0"/>
        <transform value="create"/>
        <parameter>
          <valueString value="uri"/>
        </parameter>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="vs0"/>
          <element value="reference"/>
          <variable value="vs1"/>
        </source>
        <dependent>
          <name value="uri"/>
          <parameter>
            <valueId value="vs1"/>
          </parameter>
          <parameter>
            <valueId value="vt0"/>
          </parameter>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="onBehalfOf"/>
      <source>
        <context value="src"/>
        <element value="onBehalfOf"/>
        <variable value="vs0"/>
        <condition
                   value="extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty()"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="onBehalfOf"/>
        <variable value="vt0"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <dependent>
        <name value="Reference"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
        <parameter>
          <valueId value="vt0"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="onBehalfOf"/>
      <source>
        <context value="src"/>
        <element value="onBehalfOf"/>
        <variable value="vs0"/>
        <condition
                   value="extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists()"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="onBehalfOf"/>
        <variable value="vt0"/>
        <transform value="create"/>
        <parameter>
          <valueString value="uri"/>
        </parameter>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="vs0"/>
          <element value="reference"/>
          <variable value="vs1"/>
        </source>
        <dependent>
          <name value="uri"/>
          <parameter>
            <valueId value="vs1"/>
          </parameter>
          <parameter>
            <valueId value="vt0"/>
          </parameter>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="type"/>
      <source>
        <context value="src"/>
        <element value="type"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="relatedAgentType"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
  </group>
  <group>
    <name value="entity"/>
    <extends value="BackboneElement"/>
    <input>
      <name value="src"/>
      <type value="ProvenanceR3"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <type value="Provenance"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="role"/>
      <source>
        <context value="src"/>
        <element value="role"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="role"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <dependent>
        <name value="DefaultMappingGroupAnonymousAlias"/>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
        <parameter>
          <valueId value="vvv"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="what"/>
      <source>
        <context value="src"/>
        <element value="what"/>
        <variable value="vs0"/>
        <condition
                   value="extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty() and identifier.empty()"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="what"/>
        <variable value="vt0"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <dependent>
        <name value="Reference"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
        <parameter>
          <valueId value="vt0"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="what"/>
      <source>
        <context value="src"/>
        <element value="what"/>
        <variable value="vs0"/>
        <condition
                   value="extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists()"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="what"/>
        <variable value="vt0"/>
        <transform value="create"/>
        <parameter>
          <valueString value="uri"/>
        </parameter>
      </target>
      <rule>
        <name value="reference"/>
        <source>
          <context value="vs0"/>
          <element value="reference"/>
          <variable value="vs1"/>
        </source>
        <dependent>
          <name value="uri"/>
          <parameter>
            <valueId value="vs1"/>
          </parameter>
          <parameter>
            <valueId value="vt0"/>
          </parameter>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="what"/>
      <source>
        <context value="src"/>
        <element value="what"/>
        <variable value="vs0"/>
        <condition value="identifier.exists()"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="what"/>
        <variable value="vt0"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Identifier"/>
        </parameter>
      </target>
      <dependent>
        <name value="Reference2Identifier"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
        <parameter>
          <valueId value="vt0"/>
        </parameter>
      </dependent>
    </rule>
    <rule>
      <name value="agent"/>
      <source>
        <context value="src"/>
        <element value="agent"/>
        <variable value="vs0"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="agent"/>
        <variable value="vt0"/>
      </target>
      <dependent>
        <name value="agent"/>
        <parameter>
          <valueId value="vs0"/>
        </parameter>
        <parameter>
          <valueId value="vt0"/>
        </parameter>
      </dependent>
    </rule>
  </group>
</StructureMap>