<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
   
    <pattern id="PODVer1_1">
        <rule context="/PODVer1_1">
           <assert test="."> You are missing the root element</assert>
       </rule>
   </pattern>
   
    <pattern id="type">
        <rule context="/PODVer1_1/type">
         <assert test=".= 'dcat:Dataset'"> The value for the type element should be dcat:Dataset</assert>
     </rule>
    </pattern>
    
    <pattern>
        <rule context="/PODVer1_1/contactPoint/hasEmail">
            <assert test=". ='geo.geography@census.gov'"> The value for the hasEmail element is geo.geography@census.gov</assert>
        </rule>
    </pattern>
  
  <pattern>
      <rule context="/PODVer1_1/accessLevel">
          <assert test="/PODVer1_1/accessLevel">The accessLevel element is missing</assert>
          <assert test=".='public'"> The value for the accessLevel is 'public'</assert>
      </rule>
  </pattern>
    
    <pattern>
        <rule context="/PODVer1_1/bureauCode">
            <assert test=".='006:07'">The bureauCode for all Census products is always 006:07</assert>
        </rule>
    </pattern>
    
    <pattern>
        <rule context="/PODVer1_1/spatial">
            <assert test="./spatialType='type'"> The value of spatialType is always 'type'</assert>
            <assert test="./Polygon='Polygon'">The value for the polygon element is always 'polygon'</assert>
            <assert test="./coordinates[1]='coordinates'">The value for the coordinates element is always 'coordinates'</assert>
            
            <assert test="./pair1/north >0">The value for the north element must be greater than zero </assert>
            <assert test="./pair2/south >0">The value for the south element must be greater than zero </assert>
            <assert test="./pair3/north >0">The value for the north element must be greater than zero </assert>
            <assert test="./pair4/south >0">The value for the south element must be greater than zero </assert>
            <assert test="./pair5/north >0">The value for the north element must be greater than zero </assert>
        </rule>
    </pattern>
    
    <pattern>
        <rule context="/PODVer1_1/temporal">
            <assert test="string-length(./begin) >=4 ">Dates must contain at least 4 characters</assert>
            <assert test="string-length(./begin) &lt;= 8">Dates can only have a maximum of 8 characters</assert>
            <assert test="string-length(./end) >=4 ">Dates must contain at least 4 characters</assert>
        </rule>
    </pattern>
    
    <pattern>
        <rule context="/PODVer1_1/distribution">
            <assert test="./type='dcat:Distribution'">The value for the type element is 'dcat:Distribution'</assert>
            <assert test="./mediaType ='PK-ZIP, version 1.93A or higher'">The value for the mediaType is 'PK-ZIP, version 1.93A or higher'</assert>
        </rule>
    </pattern>
    
    <pattern>
        <rule context="/PODVer1_1/language">
            <assert test=". = 'en-US'">The value for the language element is 'en-US'.</assert>
        </rule>
    </pattern>
  
</schema>