<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <sch:ns prefix="f" uri="http://hl7.org/fhir"/>
  <sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
  <!-- 
    This file contains just the constraints for the profile MedicationKnowledge
    It includes the base constraints for the resource as well.
    Because of the way that schematrons and containment work, 
    you may need to use this schematron fragment to build a, 
    single schematron that validates contained resources (if you have any) 
  -->
  <sch:pattern>
    <sch:title>f:MedicationKnowledge</sch:title>
    <sch:rule context="f:MedicationKnowledge">
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.manufacturer|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.manufacturer|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.doseForm|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.doseForm|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.amount|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.amount|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:MedicationKnowledge/f:status</sch:title>
    <sch:rule context="f:MedicationKnowledge/f:status">
      <sch:assert test="count(f:id) &lt;= 1">id: maximum cardinality of 'id' is 1</sch:assert>
      <sch:assert test="count(f:value) &lt;= 1">value: maximum cardinality of 'value' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:MedicationKnowledge/f:indicationGuideline</sch:title>
    <sch:rule context="f:MedicationKnowledge/f:indicationGuideline">
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.administrationGuidelines.indication|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.administrationGuidelines.indication|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:MedicationKnowledge/f:indicationGuideline/f:dosingGuideline</sch:title>
    <sch:rule context="f:MedicationKnowledge/f:indicationGuideline/f:dosingGuideline">
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.administrationGuidelines.patientCharacteristics.characteristic|0.1.0']) &gt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.administrationGuidelines.patientCharacteristics.characteristic|0.1.0': minimum cardinality of 'extension' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.administrationGuidelines.patientCharacteristics.characteristic|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.administrationGuidelines.patientCharacteristics.characteristic|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:MedicationKnowledge/f:packaging</sch:title>
    <sch:rule context="f:MedicationKnowledge/f:packaging">
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.packaging.type|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.packaging.type|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.packaging.quantity|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.packaging.quantity|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:MedicationKnowledge/f:regulatory/f:schedule</sch:title>
    <sch:rule context="f:MedicationKnowledge/f:regulatory/f:schedule">
      <sch:assert test="count(f:id) &lt;= 1">id: maximum cardinality of 'id' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.regulatory.schedule.schedule|0.1.0']) &gt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.regulatory.schedule.schedule|0.1.0': minimum cardinality of 'extension' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.regulatory.schedule.schedule|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.regulatory.schedule.schedule|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
      <sch:assert test="count(f:text) &lt;= 1">text: maximum cardinality of 'text' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:MedicationKnowledge/f:definitional</sch:title>
    <sch:rule context="f:MedicationKnowledge/f:definitional">
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.drugCharacteristic.value|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationKnowledge.drugCharacteristic.value|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
</sch:schema>
