<?xml version="1.0" encoding="ISO-8859-1" ?>

<!-- NARVAL BASICS DTD

    This DTD defines all the basic XML elements that Narval manipulates
    and knows of, that is memory, recipe, plan, action

    Others will have to be defined in other DTDs.

    Read the fine manual to get a feel of what all this is about.

    TODO : 

      * see if we can constrain some more the contents of an argument and a
      condition 

-->

<!-- *********************** -->
<!-- MEMORY:

     Memory contains everything else.
-->

<!ELEMENT al:memory ANY>
<!ATTLIST al:memory xmlns:al CDATA #FIXED "http://www.logilab.org/namespaces/Narval/1.2" > 

<!-- *********************** -->
<!-- RECIPE:

     A recipe is made of steps and transitions.
-->
<!ELEMENT al:recipe (al:description?,(al:step|al:transition)*)>
    
<!ATTLIST al:recipe name       CDATA #REQUIRED>
<!ATTLIST al:recipe group      CDATA #REQUIRED>
<!ATTLIST al:recipe al:eid     CDATA #IMPLIED>
<!ATTLIST al:recipe restart    (yes|no) "no">
<!ATTLIST al:recipe decay      CDATA #IMPLIED>

<!-- *********************** -->
<!-- Step -->

<!ELEMENT al:step (al:label*,al:description?,al:input*,al:output*,al:arguments?)> 
<!ATTLIST al:step id      CDATA    #REQUIRED> <!-- unique within a recipe -->
<!ATTLIST al:step type    (al:recipe|al:action) #REQUIRED>
<!ATTLIST al:step target  CDATA #REQUIRED>
<!ATTLIST al:step state   (todo|ready|running|end|done|history|impossible|failed|error) #IMPLIED>
<!ATTLIST al:step foreach CDATA #IMPLIED>

<!ELEMENT al:label (#PCDATA)>
<!ATTLIST al:label lang CDATA #REQUIRED>

<!ELEMENT al:arguments ANY>


<!-- *********************** -->
<!-- Transition -->

<!ELEMENT al:transition (al:in+,al:out+,al:time*,al:condition*,al:description?)>
<!ATTLIST al:transition id       CDATA #REQUIRED> <!-- unique within a recipe -->
<!ATTLIST al:transition priority CDATA #IMPLIED>
<!ATTLIST al:transition state (wait-step|wait-time|wait-condition|fireable|fired|fail|impossible) #IMPLIED>

<!ELEMENT al:in EMPTY>
<!ATTLIST al:in idref   CDATA #REQUIRED> <!-- refers to a step id attribute -->
<!ATTLIST al:in onError (yes|no) "no">

<!ELEMENT al:out EMPTY>
<!ATTLIST al:out idref CDATA #REQUIRED> <!-- refers to a step id attribute -->

<!ELEMENT al:time EMPTY>
<!-- 
   the values of the attributes are comma separated values.
   val1-val2 means the range from val1 to val2 (inclusive)
   * means min-max, where min and max depend on the attribute
-->
<!ATTLIST al:time seconds   CDATA '*'>  <!-- min = 0 max = 59 -->
<!ATTLIST al:time minutes   CDATA '*'>  <!-- min = 0 max = 59 -->
<!ATTLIST al:time hours     CDATA '*'>  <!-- min = 0 max = 23 -->
<!ATTLIST al:time monthdays CDATA '*'>  <!-- min = 1 max = 31 -->
<!ATTLIST al:time months    CDATA '*'>  <!-- min = 1 max = 12 -->
<!ATTLIST al:time years     CDATA '*'>  <!-- min = ? max = ?  -->
<!ATTLIST al:time yeardays  CDATA '*'>  <!-- min = 1 max = 366 -->
<!ATTLIST al:time weekdays  CDATA '*'>  <!-- min = 0 max = 6 (0 is monday) -->

<!ELEMENT al:condition (al:match+,al:description?)>
<!ATTLIST al:condition use (yes|no) "no">
<!ATTLIST al:condition list (yes|no) "no">
<!ATTLIST al:condition from_context (step|plan|parent_plan|memory) #IMPLIED>
<!ATTLIST al:condition to_context (step|plan|parent_plan|memory) #IMPLIED>


<!-- *********************** -->
<!-- PLAN:

     A plan is like a recipe, but has some control stuff added.
-->

<!ELEMENT al:plan (author?,(al:step|al:transition)*)>
<!ATTLIST al:plan state (ready|running|fireable|failed|end|failed-end|done) #REQUIRED>
<!ATTLIST al:plan decay       CDATA #REQUIRED>
<!ATTLIST al:plan name        CDATA #REQUIRED>
<!ATTLIST al:plan group       CDATA #REQUIRED>
<!ATTLIST al:plan al:eid      CDATA #IMPLIED>
<!ATTLIST al:plan parent_plan CDATA #IMPLIED>
<!ATTLIST al:plan parent_step CDATA #IMPLIED>
<!ATTLIST al:plan restart    (yes|no) "no">



<!-- *********************** -->
<!-- OTHERS -->

<!-- COOKBOOK: set of recipes -->
<!ELEMENT al:cookbook (al:recipe*)>
<!ATTLIST al:cookbook xmlns:al CDATA #FIXED "http://www.logilab.org/namespaces/Narval/1.2" > 

<!-- *********************** -->
<!-- MODULE:

     A module holds a set of actions
-->
<!ELEMENT al:module (al:action*)>
<!ATTLIST al:module xmlns:al CDATA #FIXED "http://www.logilab.org/namespaces/Narval/1.2" > 

<!-- *********************** -->
<!-- ACTION:

     An action is more or less like a function
-->
<!ELEMENT al:action (al:description?,al:input*,al:output*)>
<!ATTLIST al:action name CDATA #REQUIRED>
<!ATTLIST al:action group CDATA #REQUIRED>
<!ATTLIST al:action func CDATA #REQUIRED>
<!ATTLIST al:action eid  CDATA #IMPLIED>

<!ELEMENT al:input (al:match*, al:description?)>
<!ATTLIST al:input id        CDATA   #REQUIRED> 
<!ATTLIST al:input optional (yes|no) "no">
<!ATTLIST al:input use      (yes|no) "no">
<!ATTLIST al:input list     (yes|no) "no">
<!ATTLIST al:input from_context (step|memory|plan|parent_plan) #IMPLIED>
<!ATTLIST al:input to_context (step|memory|plan|parent_plan) #IMPLIED>

<!ELEMENT al:output (al:match*, al:description?)>
<!ATTLIST al:output id       CDATA    #REQUIRED>
<!ATTLIST al:output optional (yes|no) "no">
<!ATTLIST al:output list     (yes|no) "no">
<!ATTLIST al:output outdates CDATA    #IMPLIED>


<!ELEMENT al:prototype (al:description?,al:input*,al:output*)>

<!-- *********************** -->
<!-- shared elements 

-->

<!ELEMENT al:description (#PCDATA)>
<!ATTLIST al:description lang CDATA #REQUIRED>

<!ELEMENT al:match (#PCDATA)>

<!-- *********************** -->
<!-- MESSAGE:

     A message is sent to/received from other agents
-->

<!ELEMENT message (headers|body)>
<!ATTLIST message type CDATA #REQUIRED>

<!ELEMENT headers (to|from)>
<!ELEMENT to   (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT body ANY>
