<?xml version="1.0" encoding="UTF-8"?>
<!--
  for SGML validation, use this first line instead:
  <!DOCTYPE grammar PUBLIC "-//thaiopensource//DTD RNG 20010705//EN" "">
 -->

<grammar
  xmlns="http://relaxng.org/ns/structure/1.0"
  xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">

  <a:documentation>
    EPNML 1.1 without subnets - RELAX NG implementation
    version: $Id: basic.rng 1474 2007-10-18 19:07:36Z rp $
    (c) 2003-2004, Technische Universiteit Eindhoven
        JMEM van der Werf, jmw@petriweb.org
        some editing by R. Post, rp@petriweb.org
     human-readable documentation:
        EPNML 1.1 - an XML format for Petri nets
        http://www.petriweb.org/specs/epnml-1.1/pnmldef.pdf
  </a:documentation>

  <a:documentation>
    We use basic PNML, with some extensions. So we include this document:
  </a:documentation>
  <include href="http://www.informatik.hu-berlin.de/top/pnml/1.3.2/basicPNML.rng"/>

  <define name="anyElement" combine="choice">
    <a:documentation>
      Slightly changed from the included definition
      to avoid data typing conflicts in attributes.
    </a:documentation>
      <element>
        <anyName />
        <zeroOrMore>
          <choice>
            <attribute>
              <anyName>
                <except>
                  <nsName/>
                </except>
              </anyName>
            </attribute>
            <text />
            <ref name="anyElement"/>
          </choice>
        </zeroOrMore>
      </element>
    </define>

  <a:documentation>
    Use our own conventions:
  </a:documentation>
  <include href="conv.rng"/>

  <define name="nettype.uri" combine="choice">
    <a:documentation>
      We define our own net type: epnml-1.1 -> EPNML 1.1
    </a:documentation>
    <value>http://www.petriweb.org/specs/epnml-1.1</value>
  </define>
  
  <define name="net.labels" combine="interleave">
    <a:documentation>
      A net has common attributes.
      See [1], section 4
    </a:documentation>
    <optional>
      <ref name="common.labels"/>
    </optional>
  </define>


  <define name="place.labels" combine="interleave">
    <a:documentation>
      A place has the common attributes and a type.
      See [1], section 5
    </a:documentation>
    <interleave>
      <optional>
        <ref name="common.labels"/>
      </optional>
      <optional>
        <ref name="place.type"/>
      </optional>
      <optional>
        <ref name="PTMarking"/>
      </optional>
    </interleave>
  </define>


  <define name="transition.labels" combine="interleave">
    <a:documentation>
      A transition has common attributes, a type and a transformation.
      See [1], section 6
    </a:documentation>
    <interleave>
      <optional>
        <ref name="common.labels"/>
      </optional>
      <optional>
        <ref name="transition.type"/>
      </optional>
      <optional>
        <ref name="Transformation"/>
      </optional>
    </interleave>
  </define>


  <define name="arc.labels" combine="interleave">
    <a:documentation>
      An arc has common elements, a type and an inscription.
      See [1], section 7
    </a:documentation>
    <interleave>
      <optional>
        <ref name="common.labels"/>
      </optional>
      <optional>
        <ref name="arc.type"/>
      </optional>
      <optional>
        <ref name="ArcInscription"/>
      </optional>
    </interleave>
  </define>
</grammar>

