<?xml version="1.0"?>
<!-- this is not RNG, but Schematron!  -->
<schema xmlns="http://www.ascc.net/xml/schematron">
  <pattern name="arc sources">
    <rule context="arc[@source]">
      <assert test="../*[name() = 'place' or name() = 'transition' or name() = 'referencePlace']/@id=current()/@source">The source of every <name/> must be a sibling place or transition.
       </assert>
    </rule>
  </pattern>
  <pattern name="arc targets">
    <rule context="arc[@target]">
      <assert test="../*[name() = 'place' or name() = 'transition' or name() = 'referencePlace']/@id=current()/@target">The target of every <name/> must be a sibling place or transition.
      </assert>
    </rule>
  </pattern>
  <pattern name="pin references">
    <rule context="referencePlace[@ref]">
      <assert test="../../*[name() = 'place' or name() = 'referencePlace']/@id=current()/@ref">The reference of every <name/>
	 must be a sibling (reference) place of its containing page.
      </assert>
    </rule>
  </pattern>
  <pattern name="store arcs connect to stores">
<!-- QQQ unfinished -->
    <rule context="arc">
      <assert test="./type/text = 'C' and ../place[@id=current()/@source and ./type/text = 'store']">Every place a C/R/U/D arc connects to is a store.
      </assert>
    </rule>
  </pattern>
</schema>

