<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="AggregationTestProfile" />
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-category">
    <valueString value="Foundation.Other" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category">
    <valueCode value="not-classified" />
  </extension>
  <url value="http://gefyra.de/fhir/gematik-test/StructureDefinition/AggregationTestProfile" />
  <version value="0.1.0" />
  <name value="AggregationTestProfile" />
  <status value="active" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="cda" />
    <uri value="http://hl7.org/v3/cda" />
    <name value="CDA (R2)" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Bundle" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Bundle" />
  <derivation value="constraint" />
  <differential>
    <element id="Bundle">
      <path value="Bundle" />
      <constraint>
        <key value="Alex" />
        <severity value="warning" />
        <human value="Alex sagt: Das Bundle ist unvollständig" />
        <expression value="Bundle.entry.descendants().reference.distinct().all($this in %context.entry.fullUrl.select($this.toString().substring('http://example.org/fhir/'.length())))" />
        <source value="http://gefyra.de/fhir/gematik-test/StructureDefinition/AggregationTestProfile" />
      </constraint>
      <constraint>
        <key value="Simone" />
        <severity value="warning" />
        <human value="Simone sagt: Das Bundle ist unvollständig" />
        <expression value="Bundle.entry.resource.descendants().reference.where($this.startsWith('#').not()).all((%resource.entry.fullUrl.join('|') + '|').contains($this + '|'))" />
        <source value="http://gefyra.de/fhir/gematik-test/StructureDefinition/AggregationTestProfile" />
      </constraint>
    </element>
    <element id="Bundle.type">
      <path value="Bundle.type" />
      <patternCode value="collection" />
    </element>
  </differential>
</StructureDefinition>