Parsing XML-TEI

Note: ⚠ Be aware: this section is under development.

For the interpretation, which is the last section for suggesting a hermeneutics of action:

Reminder: computation is done within two sections in the XML-TEI file ‘doc’:
  1. Within transcription section: transcription with primary data and objective variables to compute verbs for each or all animated entities (very useful for the agency) .
  2. Interpretation section: interpretation with primary data, objective variables and subjective variables, more specifically the “R” <span> element :
    <interp xml:id="ktu1-3_ii_l5b_6a_int" ana="#ktu1.3_ii_5b-6a"> 
       <desc>
          <ref ana="#whatAction #ktu1-3_ii_l5b-6a_tmtḫṣ #verb.competition #contend">competition verb: contend (mḫṣ, Gt: to fight)</ref> 
          <castList> 
            <castItem>
              <persName ana="#whatCharacter #ANT #Female" type="character" ><state ana="#whatRole #active"/>ʾAnatu</persName>
              <persName cert="low" ana="#UNK #Unknown" type="character"><state ana="#passive"/>People from Qaratu</persName>
            </castItem>                                                                 
          </castList>
            <view>
              <placeName ana="#whatContext #battle">battle<location ana="#whatSphere #outside"/>outside her household<geo>valley</geo></placeName>
            </view> 
            <stage ana="whatBehavior">
              <span ana="#toDestroy #free #rage #veryHight">Voluntary intentionality, to destroy of her free will, with rage (level five).</span>
              <span ana="#affectEntity_and_other">The result of action has an impact on ʾAnatu and others</span>
            </stage>
       </desc>  
    </interp>

Two functions are essentially used: getNodeSet and length. The latter is used to compute nodes.

Four steps for parsing a file, doc: (1) define PATH, (2) elements, (3) select nodes (, attributes, and values), (4) pourcentage from lenght.XMLNode.
  1. Define https://www.w3.org/TR/xpath/#axes path: i.e. // (any descendants), descendant:: (children, grandchildren, etc.)
  2. Select the elements according to namespace ns:element (* when <element> is not specified = search within all doc).
  3. Select nodes to match relevant criteria (@attributes and its ‘values’) within /PATH/ns:element: for analyzing an action:
    • According to the question, attributes nodes: @ana, @type 'verb'; function getNodeSet:
      nodes=getNodeSet(doc,"PATH[contains(@ATTRIBUTE, 'VALUE')]", ns)
      • Within transcription section (primary data and objective variables), ns:w (= namespace <w>) for counting verb's occurrences:
        • i.e previous example: @type 'verb' from semantic verbal: @ana '#verb.competition'(= taxonomy, TAXO) and its subtaxonomy (subTAXO: #contend)
        • Optional: specify an animated entity's name (#Character 'value'), i.e.ʿAnatu @ana '#ANT' ObjVar.html#verbSem01 @ana

        Question @ana values /PATH/ns R
        Occurences: verbs ➞ taxo verb.competition #verb.competition //ns:w
        contains(@ana,'#verb.competition') and contains(@type,'verb')
        Occurences: verbs ➞ taxo verb.competition ➞ subTAXO contend #verb.competition ➞ #subTAXO VALUE #contend //ns:w
        contains(@ana,'#verb.competition') and contains(@ana,'#contend') 
        and contains(@type,'verb')
        ʿAnatu's occurences: verbs ➞ taxo verb.competition #ANT and #verb.competition ➞ #subTAXO VALUE #contend //ns:w
        contains(@ana,'#ANT') and contains(@type,'#verb.competition') 
        and contains(@type,'verb')
        ʿAnatu's occurences: verbs ➞ taxo verb.competition ➞ subTAXO contend #ANT and #verb.competition ➞ #subTAXO VALUE #contend //ns:w
        contains(@ana,'#ANT') and contains(@ana,'#verb.competition') 
        and contains(@type,'#contend') and contains(@type,'verb')
        Occurences without ʿAnatu: verbs ➞ taxo verb.competition #verb.competition, and not #ANT //ns:w
        contains(@ana,'#verb.competition') and not(contains(@ana, '#ANT') 
        and contains(@type,'verb') 

      • Within Data mining section (primary data, objective and subjectives variables):
        • From semantic category: @ana i.e. '#verb.competition'(= taxonomy, TAXO) and its subtaxonomy (subTAXO: i.e. #contend)
        • Specify other @ana objective variables' value-s, one or several: SPHERE #value (#outside/#inside), ROLE #value (#active/#passive), Genetic sex #value (#Female, #Male)
        • Specify an animated entity's name (#CHARACTER 'value'), i.e.ʿAnatu @ana '#ANT' @ana
        • @type 'character', ns:persName(= namespace <persName>) :
          • To count number of animated entities for pourcentage's purpose.

          Question @ana values /PATH/ns R
          Amout of time ANT: TAXO ➞ subTAXO ➞ what SPHERE #ANT and TAXO #value ➞ subTAXO #value ➞ SPHERE #value //ns:span
          contains(@ana,'#ANT') and contains(@ana,'#TAXO') and 
          contains(@ana,'#SPHERE')
          Amout of time ANT: TAXO ➞ subTAXO ➞ what SPHERE, which ROLE #ANT and TAXO #value ➞ subTAXO #value ➞ SPHERE #value, ROLE #value //ns:span
          contains(@ana,'#ANT') and contains(@ana,'#TAXO') and
          contains(@ana,'#SPHERE') and contains(@ana,'#ROLE') 
          Total AE (Character) CHARACTER #value //ns:persName
          contains(@ana,'#CHARACTER') and contains(@type, 'character')

    • Pourcentage:
      1. assign variables, example for ʿAnatu's competition's verb, variable 'verbComp_anatu':
        nodes=getNodeSet(doc,"//*[contains(@ana,'#verb.competition') and contains(@ana,'#ANT')]", ns)
                     verbComp_anatu=length(nodes)
                     verbComp_anatu
Example :
nodes=getNodeSet(doc,"//*[contains(@ana,'#verb.competition') and contains(#ana,'#contend') contains(@type,'verb')]", ns)
Meaning: find all animated entities (Character) who perform a competition's verb, type 'contend' within transcription subsection.

➤ Shorly other examples for multiple requests.