<!--  hamnosysml11.dtd

      Development trail, working backwards:

      2004-08-10  RE.
      - baseshift_size, repetition_incrdecr_size, and
        baseshift_incrdecr_size attributes added to the set of
        repetition attributes;

      2004-03-13  RE.
      - introduction of modifier flag attributes (ham_fast, etc.)
        for simplemovements (supported by animgen for SiGML for
        a little while already);

      2003-03-06  RE.
      - HamNoSysML 1.1  -  introduced to match SiGML 1.1;
      - non-manual module is now separated out, so that it can be
        used in the <hns_sign> element of SiGML 1.1.

      2001-12-08  RE.
      - changes for (restricted version of) HNS 4 non-manuals;

      2001-08-20 to 2001-08-29  RE.
      - various changes for HamNoSys 4;

      2001-07-28  RE.
      - eliminate <extfidir0>, putting its content and
        attributes directly into <extfidir1>;

      2001-07-25  RE.
      - HamNoSys4ML, starts at v1.01;
      - changes to accommodate parser changes for HamNoSys 4;

      2001-06-28
      HamNoSysML v1.01:
      - rename "thumbspecials" as "thumbspecial";
      - remove all references to "wristpos" (obsolete);
      - more liberal content model for "levelhand";
      - various name changes for UH HamNoSys 4 compatability;

      2001-04-07 (?)  RE.
      - HamNoSysML v1.00 introduced (was "SiGML-A");

      - sigmlARev2001-03.dtd (2001-03-25) AND sigmlA2001-03-28RK.dtd
      - gml20000803.dtd;
-->


<!--
This is, approximately, HamNoSys 4 as XML.
It should allow a superset of legal HamNoSys 4 to be expressed.
-->


<!--
Incorporate Non-Manual HNS DTD.
-->

<!ENTITY % hnsnonmanual SYSTEM "hnsnonmanual.dtd">
%hnsnonmanual;


<!--
Main hamnosysml element.
-->

<!ELEMENT hamnosysml (avatar?, sign*)>

<!ELEMENT avatar EMPTY>
<!ATTLIST avatar
    id ID #IMPLIED
    url CDATA #REQUIRED
    width CDATA #IMPLIED
    height CDATA #IMPLIED
    alt CDATA ""
>

<!ELEMENT sign (hamnosys_nonmanual?, hamnosys_sign?)>
<!ATTLIST sign
    gloss CDATA #IMPLIED
>

<!--
DTD-type grammar definition from Thomas Hanke, 14 May 2000.
HamNoSys 4 defined in ViSiCAST deliverable D5-1, March 2001.
-->

<!--
TH:
This grammar fragment describes the syntax of sign notations in
HamNoSys. The start symbol for the grammar is sign.
Labels ending with 2 allow split description for both hands, those
ending with 1 do not.
Action labels with a t after the digit allow for target locations.

Sign notations consist of an initial configuration plus a number of actions.
The initial configuration consists of handshape, extended finger direction,
palm orientation, and optional location.
It may be preceded by a list of nonmanual actions specifying which
nonmanual pose to use for the inital configuration.
-->

<!ENTITY % boolfalse
    '(true | false) "false"'
>

<!ENTITY % the26directions
    " direction_u
    | direction_ur
    | direction_r
    | direction_dr
    | direction_d
    | direction_dl
    | direction_l
    | direction_ul
    | direction_ol
    | direction_o
    | direction_or
    | direction_il
    | direction_i
    | direction_ir
    | direction_uo
    | direction_do
    | direction_di
    | direction_ui
    | direction_uol
    | direction_dol
    | direction_dil
    | direction_uil
    | direction_uor
    | direction_dor
    | direction_dir
    | direction_uir"
>

<!ENTITY % palmor
    " ham_palm_u
    | ham_palm_ur
    | ham_palm_r
    | ham_palm_dr
    | ham_palm_d
    | ham_palm_dl
    | ham_palm_l
    | ham_palm_ul"
>

<!ENTITY % handpart
    " ham_wristback
    | ham_wristpulse
    | ham_thumbball
    | ham_palm
    | ham_handback
    | ham_thumbside
    | ham_pinkyside"
>

<!ENTITY % clock
    " ham_clock_u
    | ham_clock_ul
    | ham_clock_l
    | ham_clock_dl
    | ham_clock_d
    | ham_clock_dr
    | ham_clock_r
    | ham_clock_ur"
>

<!ENTITY % ellipsedirection
    " ham_ellipse_h
    | ham_ellipse_ur
    | ham_ellipse_v
    | ham_ellipse_ul"
>

<!ENTITY % size
    " small
    | large"
>

<!ENTITY % movementarrow
    " ham_move_u
    | ham_move_ur
    | ham_move_r
    | ham_move_dr
    | ham_move_d
    | ham_move_dl
    | ham_move_l
    | ham_move_ul
    | ham_move_ol
    | ham_move_o
    | ham_move_or
    | ham_move_il
    | ham_move_i
    | ham_move_ir
    | ham_move_ui
    | ham_move_di
    | ham_move_do
    | ham_move_uo"
>

<!ENTITY % movementcircle
    " ham_circle_o
    | ham_circle_i
    | ham_circle_d
    | ham_circle_u
    | ham_circle_l
    | ham_circle_r
    | ham_circle_ul
    | ham_circle_dr
    | ham_circle_ur
    | ham_circle_dl
    | ham_circle_ol
    | ham_circle_ir
    | ham_circle_or
    | ham_circle_il
    | ham_circle_ui
    | ham_circle_do
    | ham_circle_di
    | ham_circle_uo"
>

<!ENTITY % movementcross
    " ham_move_cross
    | ham_move_x"
>

<!ENTITY % wristmovement
    " ham_wrist_nodding
    | ham_wrist_swinging
    | ham_wrist_twisting
    | ham_wrist_stircw
    | ham_wrist_stirccw"
>

<!ENTITY % modifier
    " ham_fast
    | ham_slow
    | ham_tense
    | ham_rest
    | ham_halt"
>

<!ENTITY % incrdecr
    " ham_increasing
    | ham_decreasing"
>

<!ENTITY % repetition
    " ham_repeat_fromstart
    | ham_repeat_fromstartseveral
    | ham_repeat_tofroto
    | ham_repeat_unspecified
    | ham_repeat_continue
    | ham_repeat_continueseveral
    | ham_repeat_reverse
    | ham_repeat_swap"
>

<!ENTITY % modifier_flag_attribs
    "ham_fast %boolfalse;
    ham_slow  %boolfalse;
    ham_tense %boolfalse;
    ham_rest  %boolfalse;
    ham_halt  %boolfalse;"
>

<!ENTITY % repetition_attribs
    "repetition ( %repetition; ) #IMPLIED
    second_repetition ( %repetition; ) #IMPLIED
    repetition_incrdecr ( %incrdecr; ) #IMPLIED
    repetition_incrdecr_size ( %size; ) #IMPLIED
    repetition_baseshift ( %movementarrow; ) #IMPLIED
    baseshift_size ( %size; ) #IMPLIED
    baseshift_incrdecr ( %incrdecr; ) #IMPLIED
    baseshift_incrdecr_size ( %size; ) #IMPLIED
    alternating  %boolfalse;
    second_alternating  %boolfalse;"
>

<!ENTITY % dynamicsize_attribs
    " incrdecr ( %incrdecr; ) #IMPLIED
      incrdecr_size ( %size; ) #IMPLIED"
>

<!ENTITY % arc
    " ham_arc_l
    | ham_arc_u
    | ham_arc_d
    | ham_arc_r
    | ham_arc_ul
    | ham_arc_ur
    | ham_arc_dl
    | ham_arc_dr"
>

<!ENTITY % locbody
    " ham_head
    | ham_headtop
    | ham_forehead
    | ham_eyebrows
    | ham_eyes
    | ham_uppereyelid
    | ham_lowereyelid
    | ham_nose
    | ham_nostrils
    | ham_lips
    | ham_upperlip
    | ham_lowerlip
    | ham_tongue
    | ham_teeth
    | ham_upperteeth
    | ham_lowerteeth
    | ham_chin
    | ham_underchin
    | ham_neck
    | ham_shouldertop
    | ham_shoulders
    | ham_chest
    | ham_stomach
    | ham_belowstomach
    | ham_ear
    | ham_earlobe
    | ham_cheek"
>

<!ENTITY % locarm
    " ham_upperarm
    | ham_elbow
    | ham_elbowinside
    | ham_lowerarm"
>

<!ENTITY % side
    " ham_left_beside
    | ham_left_at
    | ham_right_at
    | ham_right_beside
    | ham_front
    | ham_back
    | ham_radial
    | ham_ulnar"
>

<!ENTITY % dorsalpalmar_attrib
    "dorsal_or_palmar (dorsal | palmar) #IMPLIED"
>

<!ENTITY % pcontact
    " ham_touch
    | ham_close"
>

<!ENTITY % ccontact
    " ham_interlock
    | ham_cross"
>

<!ENTITY % locname
    "( loc1 | loc2 | loc3 | loc4 | loc5 )"

>
<!ENTITY % loc_attribs
    "side (%side;) #IMPLIED
     approx_loc %boolfalse;"
>

<!ENTITY % thumbpos
    " ham_thumb_out
    | ham_thumb_across
    | ham_thumb_open"
>

<!--
N.B. Renamings with change from HamNoSys 3 to HamNoSys 4:
    old straight    ==  new bent    [== 400]
    old bend        ==  new round   [== 222]
(and note especially the potential for confusion between
bend and bent!)
halfbent has no corresponding modifier in HamNoSys, where it
is expressed as the in-between combination of no bending (the
default) and the new bent resulting in the encoding 200.
-->

<!ENTITY % fingerbending
    " ham_finger_straight
    | ham_finger_bend
    | ham_finger_bent
    | ham_finger_round
    | ham_finger_hooked
    | ham_finger_halfbent
    | ham_finger_dblbent
    | ham_finger_dblhooked"
>

<!ENTITY % handshapeclass
    " ham_fist
    | ham_flathand
    | ham_finger2
    | ham_finger23
    | ham_finger23spread
    | ham_finger2345
    | ham_pinch12
    | ham_pinchall
    | ham_pinch12open
    | ham_cee12
    | ham_ceeall
    | ham_cee12open"
>

<!ENTITY % thumb
    " ham_digit_1"
>

<!ENTITY % fingernothumb
    " ham_digit_2
    | ham_digit_3
    | ham_digit_4
    | ham_digit_5"
>

<!ENTITY % finger
    " %thumb;
    | %fingernothumb;"
>

<!ENTITY % fingerpart
    " ham_finger_tip
    | ham_finger_nail
    | ham_finger_pad
    | ham_finger_midjoint
    | ham_finger_base
    | ham_finger_side"
>


<!--
=================================
end of ENTITYs, start of ELEMENTs
=================================
-->


<!ELEMENT hamnosys_sign ((sign2 | sign1)*)>

<!--
See %hnsnonmanual; for definition of hamnosys_nonmanual element.

2004-06
The minitialconfig1 sub-option and the holdover attribute below have been
introduced to provide a way of getting a SiGML <sign_manual> with its
holdover attribute set.
-->

<!ELEMENT sign2
    (
      (nminitialconfig?, (minitialconfig2 | minitialconfig1), action1t*)
      |
      (symmoperator, nminitialconfig?, minitialconfig2, action2t*)
    )
>
<!ATTLIST sign2
    nondominant %boolfalse;
    holdover    %boolfalse;
>

<!ELEMENT sign1
    (nminitialconfig?, minitialconfig1, action1t*)
>
<!ATTLIST sign1
    which_hand ( nondominant ) #IMPLIED
>

<!ELEMENT symmoperator EMPTY>
<!ATTLIST symmoperator
    att_par_or_lr (hamsymmpar | hamsymmlr) #REQUIRED
    attrib_oi_symm (hamfingerbent) #IMPLIED
    attrib_ud_symm (hamlargemod) #IMPLIED
    outofphase %boolfalse;
    nonipsi    %boolfalse;
>

<!ELEMENT initialconfig2 (nminitialconfig?, minitialconfig2)>

<!ELEMENT nminitialconfig (((levelbody | levelarm), action1)+)>

<!ELEMENT minitialconfig2 (handconfig2, location2?)>

<!ELEMENT minitialconfig1 (handconfig1, location1?)>

<!--
2003-08-30: introduce the second option below, enabling HNS
handconfig2 to be more permissive.
-->
<!ELEMENT handconfig2
    (
      (handshape2, extfidir2?, palmor2?)
    |
      (handconfig1, handconfig1)
    )
>

<!ELEMENT handconfig1 (handshape1, extfidir1?, palmor1?)>

<!ELEMENT handshape2 (handshape1, handshape1?)>

<!ELEMENT handshape1 (
    fingernothumb*, fingershape*, fingercrossing*, thumbspecial?
)>
<!ATTLIST handshape1
    handshapeclass (%handshapeclass;) #REQUIRED
    fingerbending (%fingerbending;) #IMPLIED
    thumbpos (%thumbpos;) #IMPLIED
    second_handshapeclass (%handshapeclass;) #IMPLIED
    second_fingerbending (%fingerbending;) #IMPLIED
    second_thumbpos (%thumbpos;) #IMPLIED
    approx_shape %boolfalse;
>

<!ELEMENT fingershape (finger?)>
<!ATTLIST fingershape
    fingerbending (%fingerbending;) #REQUIRED
>

<!ELEMENT fingercrossing (finger, fingerpart, finger)>

<!ELEMENT thumbspecial (
    (fingernothumb, fingernothumb)
    | hambetween
    | thumb
    | fingerpart
)>

<!ELEMENT extfidir2 (extfidir1, extfidir1?)>

<!ELEMENT extfidir1 EMPTY>
<!ATTLIST extfidir1
    extfidir (%the26directions;) #REQUIRED
    second_extfidir (%the26directions;) #IMPLIED
    approx_extfidir %boolfalse;
    abs_extfidir %boolfalse;
    rel_extfidir %boolfalse;
>

<!ELEMENT palmor2 (palmor1, palmor1?)>

<!ELEMENT palmor1 EMPTY>
<!ATTLIST palmor1
    palmor (%palmor;) #REQUIRED
    second_palmor (%palmor;) #IMPLIED
    approx_palmor %boolfalse;
    abs_palmor %boolfalse;
    rel_palmor %boolfalse;
>

<!ELEMENT location2
    (
      (location1, location1?)
      |
      (handconstellation, (locationbody | hamneutral)?)
    )
>

<!ELEMENT location1 (locationbodyarm | locationhand | use_locname)>

<!ELEMENT use_locname EMPTY>
<!ATTLIST use_locname
    use_locname %locname; #REQUIRED
>

<!ELEMENT locationbodyarm (locationbody | locationarm | hamneutral)>

<!ELEMENT locationbody (levelcomplexbody, hambehind?, contactbody?)>

<!ELEMENT locationhand (levelcomplexhand, contacthand?)>

<!ELEMENT locationarm (levelcomplexarm, hambehind?, contactbody?)>

<!ELEMENT levelcomplexbody (levelbody, levelbody?)>

<!ELEMENT levelcomplexhand (levelhand, levelhand?)>

<!ELEMENT levelcomplexarm (levelarm, levelarm?)>

<!ELEMENT levelbody EMPTY>
<!ATTLIST levelbody
    locbody (%locbody;) #REQUIRED
    %loc_attribs;
>

<!ELEMENT levelhand
    (
        handpart |
        ( fingerpart, finger* ) |
        ( finger, ( finger* | fingerpart+ ) )
    )
>
<!ATTLIST levelhand
    %loc_attribs;
    %dorsalpalmar_attrib;
>

<!ELEMENT levelarm EMPTY>
<!ATTLIST levelarm
    locarm (%locarm;) #REQUIRED
    %loc_attribs;
    %dorsalpalmar_attrib;
>

<!-- RE  July-August 2000
The final option of contactbody has been expanded to include a pcontact
and has been transferred to contacthand; this option is now an element
in its own right, contacthandhand.
In the wake of this change, contacthand itself has been reinstated as
an element, instead of being an entity/attribute at point of use;
ccontact has also been promoted from entity to element.
These changes are motivated by the desire to match some examples in the
hamnosys test file, e.g. AN11B, AN11C.
-->
<!--
t.b.checked: does contactbody really need its contactofhand option?
-->

<!ELEMENT contactbody (pcontact | hamarmextended | contactofhand)>

<!ELEMENT contacthand (pcontact | ccontact | contactofhand)>

<!--
2003-08-26
Allow levelcomplexarm as alternative to levelcomplexhand here.
-->
<!ELEMENT contactofhand
    (
        (pcontact | ccontact),
        (levelcomplexhand | levelcomplexarm)
    )
>

<!ELEMENT handconstellation ((locationhand, locationhand)?, contacthand)>

<!--
2003-08-23
(Nested) action2t added, to allow for nested repetition attributes.
-->
<!ELEMENT action2t
    (
      (action1t, action1t?) |
      (action2, location2) |
      (action1, location2) |
      action2t |
      par_action2t |
      seq_action2t      
    )
>
<!ATTLIST action2t
    %repetition_attribs;
>

<!ELEMENT par_action2t ( action2t, ( action2t )+ )>
<!ELEMENT seq_action2t ( action2t, ( action2t )+ )>
<!ATTLIST seq_action2t
    fused  %boolfalse;
>

<!--
2003-08-23
(Nested) action1t added, to allow for nested repetition attributes.
-->
<!ELEMENT action1t
    (
      hamnomotion |
      (action1, (location1 | handconstellation)?) |
      ((levelbody | levelarm), action1) |
      action1t |
      par_action1t |
      seq_action1t
    )
>
<!ATTLIST action1t
    %repetition_attribs;
>

<!ELEMENT par_action1t ( action1t, ( action1t )+ )>
<!ELEMENT seq_action1t ( action1t, ( action1t )+ )>
<!ATTLIST seq_action1t
    fused  %boolfalse;
>

<!ELEMENT action2 (action1, action1?)>

<!ELEMENT action1 (
    hamnomotion | simplemovement | par_action1 | seq_action1
)>
<!ATTLIST action1
    bouncing %boolfalse;
>

<!ELEMENT par_action1 ( action1, ( action1 )+ )>
<!ELEMENT seq_action1 ( action1, ( action1 )+ )>
<!ATTLIST seq_action1
    fused  %boolfalse;
>

<!--
The optional location1 in simplemovement is for brushing contact.
(RE, 2001-08)
-->
<!ELEMENT simplemovement
    (
        (
          straightmovement |
          circularmovement |
          wristmovement |
          movementcross |
          replacement |
          hamfingerplay
        ),
        location1?
    )
>
<!ATTLIST simplemovement
    modifier (%modifier;) #IMPLIED
    %modifier_flag_attribs;
    def_locname %locname; #IMPLIED
    abs_motion %boolfalse;
>

<!ELEMENT straightmovement EMPTY>
<!ATTLIST straightmovement
    movement (%movementarrow;) #REQUIRED
    size (%size;) #IMPLIED
    second_movement (%movementarrow;) #IMPLIED
    second_size (%size;) #IMPLIED

    arc (%arc;) #IMPLIED
    arc_size (%size;) #IMPLIED

    zigzagstyle (ham_zigzag | ham_wavy) #IMPLIED
    zigzag_size (%size;) #IMPLIED
    ellipsedirection (%ellipsedirection;) #IMPLIED
    %dynamicsize_attribs;
>

<!ELEMENT circularmovement (ellipse?)>
<!ATTLIST circularmovement
    movement (%movementcircle;) #REQUIRED
    size (%size;) #IMPLIED
    second_movement (%movementcircle;) #IMPLIED
    second_size (%size;) #IMPLIED
    redundant_size (%size;) #IMPLIED

    start (%clock;) #IMPLIED
    clockfull %boolfalse;
    second_clockfull %boolfalse;
    end (%clock;) #IMPLIED

    zigzagstyle (ham_zigzag | ham_wavy) #IMPLIED

    %dynamicsize_attribs;
>

<!ELEMENT wristmovement EMPTY>
<!ATTLIST wristmovement
    movement ( %wristmovement; ) #REQUIRED
    size (%size;) #IMPLIED
>

<!ELEMENT ellipse EMPTY>
<!ATTLIST ellipse
    ellipsedirection (%ellipsedirection;) #REQUIRED
    size (%size;) #IMPLIED
>

<!--
t.b.d. review/tidy this latest replacement definition.
-->
<!ELEMENT replacement
    (handshape1?, ((extfidir1?, palmor1?) | splitreplacetail?))>
<!ATTLIST replacement
    %dynamicsize_attribs;
>

<!ELEMENT splitreplacetail (replacetail1, replacetail1?)>

<!ELEMENT replacetail1 (extfidir1?, palmor1?)>


<!--
=================
Preterminal rules
=================
-->

<!ELEMENT fingerpart EMPTY>
<!ATTLIST fingerpart
    fingerpart (%fingerpart;) #REQUIRED
>

<!ELEMENT handpart EMPTY>
<!ATTLIST handpart
    handpart (%handpart;) #REQUIRED
>

<!ELEMENT movementcross EMPTY>
<!ATTLIST movementcross
    movementcross (%movementcross;) #REQUIRED
    size (%size;) #IMPLIED
>

<!ELEMENT finger EMPTY>
<!ATTLIST finger
    fingerid (%finger;) #REQUIRED
>

<!ELEMENT fingernothumb EMPTY>
<!ATTLIST fingernothumb
    fingerid (%fingernothumb;) #REQUIRED
    thumbopp %boolfalse;
>

<!ELEMENT thumb EMPTY>
<!ATTLIST thumb
    fingerid (%thumb;) #IMPLIED
>

<!ELEMENT pcontact EMPTY>
<!ATTLIST pcontact
    where (%pcontact;) #REQUIRED
>

<!ELEMENT ccontact EMPTY>
<!ATTLIST ccontact
    crosskind (%ccontact;) #REQUIRED
>

<!ELEMENT hamnomotion EMPTY>

<!ELEMENT hambehind EMPTY>

<!ELEMENT hambetween EMPTY>

<!ELEMENT hamarmextended EMPTY>

<!ELEMENT hamneutral EMPTY>
<!ATTLIST hamneutral
    armextended %boolfalse;
>

<!ELEMENT hamfingerplay EMPTY>


<!-- End of HamNoSysML 1.1 DTD -->
