<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title type="main">TEI by Example</title>
        <title type="sub">Module 8: Customising TEI, ODD, Roma</title>
        <author xml:id="RvdB">Ron Van den Branden</author>
        <editor xml:id="EV">Edward Vanhoutte</editor>
        <editor xml:id="MT">Melissa Terras</editor>
        <sponsor>Association for Literary and Linguistic Computing (ALLC)</sponsor>
        <sponsor>Centre for Data, Culture and Society, University of Edinburgh, UK</sponsor> 
        <sponsor>Centre for Digital Humanities (CDH), University College London, UK</sponsor>
        <sponsor>Centre for Computing in the Humanities (CCH), King’s College London, UK</sponsor>
        <sponsor>Centre for Scholarly Editing and Document Studies (CTB) , Royal Academy of Dutch Language and Literature, Belgium</sponsor>
        <funder>
          <address>
            <addrLine>Centre for Scholarly Editing and Document Studies (CTB)</addrLine>
            <addrLine>Royal Academy of Dutch Language and Literature</addrLine>
            <addrLine>Koningstraat 18</addrLine>
            <addrLine>9000 Gent</addrLine>
            <addrLine>Belgium</addrLine>
          </address>
          <email>ctb@kantl.be</email>
        </funder>
        <principal>Edward Vanhoutte</principal>
        <principal>Melissa Terras</principal>
      </titleStmt>
      <publicationStmt>
        <publisher>Centre for Scholarly Editing and Document Studies (CTB) , Royal Academy of Dutch Language and Literature, Belgium</publisher>
        <distributor>Centre for Scholarly Editing and Document Studies (CTB) , Royal Academy of Dutch Language and Literature, Belgium</distributor>
        <pubPlace>Gent</pubPlace>
        <address>
          <addrLine>Centre for Scholarly Editing and Document Studies (CTB)</addrLine>
          <addrLine>Royal Academy of Dutch Language and Literature</addrLine>
          <addrLine>Koningstraat 18</addrLine>
          <addrLine>9000 Gent</addrLine>
          <addrLine>Belgium</addrLine>
        </address>
        <availability status="free">
          <p>Licensed under a <ref target="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution ShareAlike 3.0 License</ref>
                    </p>
        </availability>
        <date when="2010-07-09">9 July 2010</date>
      </publicationStmt>
      <seriesStmt>
        <title>TEI By Example.</title>
        <editor>Edward Vanhoutte</editor>
        <editor>Ron Van den Branden</editor>
        <editor>Melissa Terras</editor>
      </seriesStmt>
      <sourceDesc>
        <p>Digitally born</p>
      </sourceDesc>
    </fileDesc>
    <encodingDesc>
      <projectDesc>
        <p>TEI By Example offers a series of freely available online tutorials walking individuals through the different stages in marking up a document in TEI (Text Encoding Initiative). Besides a general introduction to text encoding, step-by-step tutorial modules provide example-based introductions to eight different aspects of electronic text markup for the humanities. Each tutorial module is accompanied with a dedicated examples section, illustrating actual TEI encoding practise with real-life examples. The theory of the tutorial modules can be tested in interactive tests and exercises.</p>
      </projectDesc>
    </encodingDesc>
    <profileDesc>
      <langUsage>
        <language ident="en-GB">en-GB</language>
      </langUsage>
    </profileDesc>
    <revisionDesc>
      <change when="2020-06-15" who="#RvdB">proofing corrections</change>
      <change when="2020-06-11" who="#RvdB">revision</change>
      <change when="2020-04-30" who="#RvdB">updated to Pure ODD + RomaJS</change>
      <change when="2010-07-13" who="#RvdB">
        <list>
          <item>added distinction <gi>gi</gi> — <tag>gi scheme="..."</tag> — <gi>tag</gi>
                    </item>
          <item>final spellcheck</item>
        </list>
      </change>
      <change when="2010-07-09" who="#RvdB">release</change>
      <change when="2008-11-05" who="#RvdB">
        <list>
          <item>updated to TEI P5-1.2.0 + Roma 3.5 (04/11/2008)</item>
          <item>corrected errors + typos</item>
        </list>
      </change>
      <change when="2008-08-21" who="#RvdB">
        <list>
          <item>corrected typos</item>
          <item>elaborated on didactic motivations for some choices in the tutorial</item>
        </list>
      </change>
      <change when="2008-08-19" who="#RvdB">replaced <title level="m">Alice’s Adventures Under Ground</title> example with <title level="m">Alice’s Adventures in Wonderland</title> due to copyright concerns with the images</change>
      <change when="2008-08-01" who="#RvdB">revisions</change>    
      <change when="2008-07-15" who="#RvdB">creation</change>
    </revisionDesc>
  </teiHeader>
  <text xml:id="TBED08v00" type="tutorials">
    <body>
            <div xml:id="selecting">
        <head>Selecting and Restricting the TEI Model</head>
        <p>Back to <title level="m">Alice</title>! As we have discussed, our minimal TEI customisation now includes 10 TEI elements, just enough to be able to create TEI-conformant documents. But does this suffice for encoding our <title level="m">Alice</title> example? Not really, since we’re still lacking a bunch of TEI elements to encode the textual phenomena we identified during our document analysis:
          <list rend="bulleted">
            <item>The title page: <gi>titlePage</gi>, <gi>docAuthor</gi>, <gi>byline</gi>, <gi>docImprint</gi>, <gi>publisher</gi>, <gi>docDate</gi>.</item>
            <item>Document structure: <gi>div</gi>, <gi>lg</gi>, <gi>l</gi>.</item>
            <item>Text elements: <gi>emph</gi>, <gi>q</gi>, <gi>pb</gi>, <gi>figure</gi>, <gi>graphic</gi>, <gi>figDesc</gi>, <gi>fw</gi>.</item>
            <item>Semantic units: <gi>name</gi>.</item>
          </list>
        </p>
        <p>Back to the drawing board of our TEI customisation, back to Roma!</p>
<!-- [RvdB] keep this (somewhere)?         
                        <note>In fact, all elements described in this TBE tutorial module belong to the TEI <ident>tagdocs</ident> module, documented in <ref target="http://www.tei-c.org/release/doc/tei-p5-doc/en/html/TD.html">chapter 22</ref> of the TEI Guidelines.</note>
-->                        
        <div xml:id="modulesElements">
          <head>Selecting Modules and Elements</head>
          <p>In order to encode the textual phenomena we’d identified for our example text, a number of TEI elements have to be included in our TEI customisation. This can be done easily in Roma by ticking the corresponding boxes in the <q>Elements</q> tab.
            <figure xml:id="figure10">
              <graphic url="../../../images/tutorials/TBED08v00/romaElements.png"/>
              <head type="legend">The <q>Elements</q> tab in Roma.</head>
            </figure>
          </p>
          <p>Notice how the right-hand column in Roma informs you for any element which module it belongs to. A convenient way to include or exclude all elements from a module at once, is by selecting or de-selecting that module. In order to do so, you can click the module name. For example, let’s select the <ident type="module">figures</ident> module by clicking the plus sign next to that module name: <graphic url="../../../images/tutorials/TBED08v00/romaSelectModule.png"/>
                    </p>
          <p>If we order the elements by module (by clicking the <q>by module</q> button at the top right of the Roma screen) and scroll down to the <ident type="module">figures</ident> module, you’ll see that all of its elements now have been included in your customisation. This includes some elements we didn’t identify in the document analysis for our document; if we are absolutely certain we only have to encode images, but no tables, formulas, or music notations, these elements can quickly be deselected by unticking the element name in the left-hand column:
          <figure xml:id="figure11">
            <graphic url="../../../images/tutorials/TBED08v00/romaDeselectElements.png"/>
            <head type="legend">De/selecting elements in Roma.</head>
          </figure>
          </p>
          <p>Did you notice how the <gi>graphic</gi> element is part of the <ident type="module">core</ident> module, and not of <ident type="module">figures</ident>? If you want to include the images themselves in your transcription of <title level="m">Alice</title>, you’ll have to include the <gi>graphic</gi> element as well. Hint: you can quickly look up an element by entering its name in the search box at the top right of the Roma screen:
            <figure xml:id="figure12">
              <graphic url="../../../images/tutorials/TBED08v00/romaFilter.png"/>
              <head type="legend">Filtering element names in Roma.</head>
            </figure>
          </p>
          <p>That’s all there is to including and excluding existing TEI elements with Roma! You can also remove an entire module at once, with the caveat that this will remove all its members (and possible modifications you’ve made to them) from your customisation. Since you might run the risk of losing work here, Roma issues a warning in order to prevent unwanted mistakes:
            <figure xml:id="figure13">
              <graphic url="../../../images/tutorials/TBED08v00/romaRemoveModule.png"/>
              <head type="legend">Warning when removing an entire module in Roma.</head>
            </figure>
          </p>
          <p>Now, save your customisation as an ODD file (click the <q>Download</q> &gt; <q>Customization as ODD</q> button at the top right of the Roma screen). Its <gi>schemaSpec</gi> element will be updated to:
            <figure xml:id="example2">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <schemaSpec ident="TBEcustom" start="TEI" prefix="tei_" targetLang="en" docLang="en">
                  <moduleRef key="figures" include="figDesc figure"/>
                  <moduleRef key="header" include="teiHeader fileDesc titleStmt publicationStmt sourceDesc"/>
                  <moduleRef key="core" include="p title graphic emph lg l pb pubPlace publisher q quote name"/>
                  <moduleRef key="textstructure" include="TEI text body titlePage docTitle docImprint docDate docAuthor byline"/>
                  <moduleRef key="tei"/>
                </schemaSpec>
              </egXML>
              <head type="legend">A minimal TEI customisation with more TEI elements added (<ref target="../download/TBEcustom-2-selectElements.odd">download</ref>).</head>
            </figure>
          </p>
          <note>Because all further changes to the ODD file in this TBE tutorial module will affect only its <gi>schemaSpec</gi> part, the example fragments will focus on this element.</note>
<!-- [RvdB] not relevant here, perhaps later?
            <p>A first thing of notice is the addition of our extra module <ident>figures</ident> with a <gi>moduleRef</gi> element, followed by an exclusion of the table and formula related elements from the <ident>figures</ident> module. This is done in an  <gi>elementSpec</gi> element specification for each element, documenting the structure, content, and purpose of a single element.  Each <gi>elementSpec</gi> must identify the element it specifies in an <att>ident</att> attribute. Since all TEI elements are part of TEI modules, this module should be identified in the <gi>module</gi> attribute. A third attribute, <att>mode</att>, describes the operation to be performed. This attribute can occur on other elements in a schema specification, with one of four values:
            <list type="gloss">
              <item><label>add</label> the current specification is added to the schema</item> 
              <item><label>delete</label> the current specification is deleted from the schema</item>
              <item><label>change</label> the current specification changes the declaration of an item with the same name in a schema</item>
              <item><label>replace</label> the current specification replaces the declaration of an item with the same name in a schema</item>
            </list>
          </p>-->
          <p>When we generate a TEI schema from this customisation (via the <q>Download</q> button at the top right of the Roma screen), this allows us to validate a transcription of a typical page of the document (the third image from the <title level="m">Alice</title> scans above) as follows:
            <egXML xmlns="http://www.tei-c.org/ns/Examples">
              <!-- ... -->                                
              <div type="chapter">
                <!-- ... -->
                <pb n="157"/>
                <figure>
                  <graphic url="images/lobster.jpg"/>
                  <figDesc>The lobster sugaring its hair.</figDesc>
                </figure>
                <p>
                  <q who="#alice">"How the creatures order one about, and make one repeat lessons!"</q> thought <name type="person">Alice</name>, <q who="#alice">"I might just as well be at school at once."</q> However, she got up, and began to repeat it, but her head was so full of the <title type="song">
                                        <name type="animal">Lobster</name>-Quadrille</title>, that she hardly knew what she was saying, and the words came very queer indeed:—</p>
                <q rend="blockquote" who="#alice">
                  <lg>
                    <l>"'Tis the voice of the <name type="animal">lobster</name>; I heard him declare,</l>
                    <l>
                                            <q who="#lobster">'You have baked me too brown, I must sugar my hair.'</q>
                                        </l>
                    <l>As a duck with its eyelids, so he with his nose</l>
                    <l>Trims his belt and his buttons, and turns out his toes."</l>
                  </lg>
                </q>
                <p>
                  <q who="#gryphon">"That's different from what <emph>I</emph> used to say when I was a child,"</q> said the <name type="animal">Gryphon</name>.</p>
                <pb n="158"/>
                <p>
                  <q who="#mockTurtle">"Well, I never heard it before,"</q> said the <name type="animal">Mock Turtle</name>; <q who="#mockTurtle">"but it sounds uncommon nonsense."</q>
                                </p>
                <p>
                                    <name type="person">Alice</name> said nothing; she had sat down with her face in her hands, wondering if anything would <emph>ever</emph> happen in a natural way again.</p>
                <p>
                                    <q who="#mockTurtle">"I should like to have it explained,"</q> said the <name type="animal">Mock Turtle</name>.</p>
                <p>
                                    <q who="#gryphon">"She can't explain it,"</q> said the <name type="animal">Gryphon</name> hastily. <q who="#gryphon">"Go on with the next verse."</q>
                                </p>
                <p>
                                    <q who="#mockTurtle">"But about his toes?"</q> the <name type="animal">Mock Turtle</name> persisted. <q who="#mockTurtle">"How <emph>could</emph> he turn them out with his nose, you know?"</q>
                                </p>
                <p>
                                    <q who="#aliceI">"It's the first position in dancing."</q> <name type="person">Alice</name> said; but she was dreadfully puzzled by the whole thing, and longed to change the subject.</p>
                <p>
                                    <q who="#gryphon">"Go on with the next verse,"</q> the <name type="animal">Gryphon</name> repeated impatiently: <q who="#gryphon">"it begins <quote>'I passed by his garden.'</quote>"</q>
                                </p>
                <p>
                                    <name type="person">Alice</name> did not dare to disobey, though she felt sure it would all come wrong, and she went on in a trembling voice:—</p>
                <pb n="159"/>
                <!-- ... -->
              </div>
              <!-- ... -->                                
            </egXML>
          </p>
          <p>So far for selecting modules and elements. The obvious counterpart, adding <emph>new</emph> elements, will be dealt with later in this tutorial (see <ptr target="#extending" type="crossref"/>). First we will focus on attributes.</p>
          <note type="summary">Modules can be selected simply by referencing them with a <gi>moduleRef</gi> element, whose <att>key</att> attribute must be used to identify the desired TEI module. By default, all elements of a module are selected for inclusion in the schema. If an <att>include</att> attribute is present, only those elements that are being enumerated will be included in the customisation, and all others won’t. If you want to exclude only a couple of elements from a module, but include all others, this can conveniently be done by enumerating the ones you don’t want in an <att>except</att> attribute. You can’t use both at the same time. <!--
            
            
            Deleting unneeded elements can be done simply with an <gi>elementSpec</gi> element, with an <att>ident</att> attribute indicating the existing name of the TEI element whose declaration is to be altered. The module to which the element belongs must be named in the <att>module</att> attribute. In order to specify that these elements should be deleted, the <att>mode</att> attribute should state <val>delete</val>.-->
                    </note>
        </div>
        <div xml:id="attributes">
          <head>Changing Attributes</head>
          <div xml:id="singleAttributes">
            <head>Changing Individual Attributes</head>
            <p>As shown in the previous encoding snippet, the <gi>name</gi> element definition (from the <ident type="module">core</ident> module) comes with a <att>type</att> attribute. By providing a keyword for this attribute, we can specify what type of name is being identified with the <gi>name</gi> element. By default, the <att>type</att> attribute can contain any single keyword from an unspecified list: anything goes as long as it conforms to some syntactic rules, specified in the <ident type="datatype">teidata.enumerated</ident> datatype (basically, only a few punctuation marks are allowed, and it should start with a letter). Apart from that, there is no limit on possible values for the <att>type</att> attribute. However, to improve consistency in our <title level="m">Alice</title> encoding project, we would like to trim down these possibilities for the <att>type</att> attribute of <gi>name</gi>. We’re only interested in the categories <val>person</val>, <val>place</val>, and <val>animal</val>. This can be done in Roma, by navigating to the definition of the <gi>name</gi> element. In order to do so: 
              <list rend="ordered">
                <item>load the <ident type="file">TBEcustom</ident> customisation again in Roma if you haven’t done so already, and click the <q>Customize ODD</q> button,</item>
                <item>move to the <q>Elements</q> tab and scroll down to the definition of <gi>name</gi>.</item>
              </list>
            </p>
            <p>In order to edit its attributes, just click the <q>name</q> element in the list (make sure it is selected, before you can click it):
              <figure xml:id="figure14">
                <graphic url="../../../images/tutorials/TBED08v00/romaClickElement.png"/>
                <head type="legend">Navigating to an element definition by clicking its name in Roma.</head>
              </figure>
            </p>
            <p>Clicking an element in Roma opens an <soCalled>edit</soCalled> screen, where some aspects can be changed:
              <list rend="bulleted">
                <item>
                                    <q>Documentation</q> here you can change the description of an element</item>
                <item>
                                    <q>Attributes</q> here you can change the attributes of an element</item>
                <item>
                                    <q>Class Membership &amp; Content Model</q> here you can change the classes an element belongs to, and the elements or element classes it can contain</item>
              </list>
              <figure xml:id="figure15">
                <graphic url="../../../images/tutorials/TBED08v00/romaEditElement.png"/>
                <head type="legend">Element editing screen in Roma.</head>
              </figure>
            </p>
            <p>Since we want to restrict the values allowed for the <att>type</att> attribute of <gi>name</gi>, hit the <q>Attributes</q> button. This produces an overview of all attributes defined for the <gi>name</gi> element, organised per attribute class from which they are inherited: 
              <figure xml:id="figure16">
                <graphic url="../../../images/tutorials/TBED08v00/romaEditElementAttributes.png"/>
                <head type="legend">Display of an element’s attributes in Roma.</head>
              </figure>
            </p>
            <p>Scroll down to the bottom, where you will find the <att>type</att> attribute listed (in the <ident type="class">att.typed</ident> attribute class). Left of each attribute name, you’ll find a pencil icon for editing the attribute, and a cross icon for removing the attribute. Since we want to restrict the values for the <att>type</att> attribute, just click the pencil icon next to it. This will show the current definition of that attribute. There you can determine whether the attribute should be mandatory or optional, what the datatype of its value(s) should be, and what kind of values it allows. The <q>Values</q> section is where we can restrict the possible values for the <att>type</att> attribute for names to a closed list. In order to do so:
              <list rend="ordered">
                <item>Click the drop-down box in the <q>Values</q> field, and change it to <q>Closed</q>.</item>
                <item>For each value we want to allow for this attribute (<val>place</val>, <val>person</val>, and <val>animal</val>), enter the value in the text box below, and click the <q>+</q> sign next to it.</item>
                <item>For each new value, a description can be provided by clicking the <q>+</q> sign next to <q>Description</q>.</item>
              </list>
              <figure xml:id="figure17">
                <graphic url="../../../images/tutorials/TBED08v00/romaEditElementAttributeValues.png"/>
                <head type="legend">Changing the attributes for an element in Roma.</head>
              </figure>
            </p>
            <p>The changes are being recorded immediately in Roma. Clicking the <q>Attributes</q> button in the top menu of the Roma screen brings us back to the attributes list for the <gi>name</gi> element. Now, let’s remove some attributes we don’t need in our encoding project. With Roma, it’s possible to remove entire attribute classes at once by clicking the <q>X</q> sign next to the attribute class names in the list. Let’s do so for <ident type="class">att.datable</ident>, <ident type="class">att.editLike</ident>, <ident type="class">att.global.responsibility</ident>, <ident type="class">att.global.source</ident>, <ident type="class">att.naming</ident>, and <ident type="class">att.personal</ident>. Also, the <att>subtype</att> and <att>nymRef</att> attributes can go, just click the <q>X</q> sign next to the attribute name.              
              <!-- 
              If you scroll down to <att>type</att> again, you'll notice that its description now reads <q>type (changed for this element)</q>, which is what we wanted.</p>
            <p>The list of attributes for <gi>name</gi> still is impressive. Roma makes it easy to trim down this list to only those attributes you want to allow in your customisation. In order to remove them, just click the cross icon next to the attributes, or attribute classes you want to remove for that element. For this customization, we’re only interested in the <gi>name</gi> attributes from the <ident type="class">att.global</ident>, <ident type="class">att.global.rendition</ident>, and <ident type="class">att.type</ident> modules, so you can remove the others. Also, since <att>subtype</att> is not relevant for our encoding of names in <title>Alice</title>, we can remove that attribute, too. -->
            </p>
            <p>If we save the customisation at this stage (by clicking the <q>Download</q> &gt; <q>Customization as ODD</q> button), the ODD file gets updated to:
              <figure xml:id="example3">
                <egXML xmlns="http://www.tei-c.org/ns/Examples">
                  <schemaSpec ident="TBEcustom" start="TEI" prefix="tei_" targetLang="en" docLang="en">
                    <moduleRef key="figures" include="figDesc figure"/>
                    <moduleRef key="header" include="teiHeader fileDesc titleStmt publicationStmt sourceDesc"/>
                    <moduleRef key="core" include="p title emph lg l pb pubPlace publisher q quote name graphic"/>
                    <moduleRef key="textstructure" include="TEI text body titlePage docTitle docImprint docDate docAuthor byline div"/>
                    <moduleRef key="tei"/>
                    <elementSpec ident="name" mode="change">
                      <classes mode="change">
                        <memberOf key="att.datable" mode="delete"/>
                        <memberOf key="att.editLike" mode="delete"/>
                        <memberOf key="att.personal" mode="delete"/>
                      </classes>
                      <attList>
                        <attDef ident="subtype" mode="delete"/>
                        <attDef ident="nymRef" mode="delete"/>
                        <attDef ident="type" mode="change">
                          <valList type="closed" mode="change">
                            <valItem mode="add" ident="place">
                              <desc versionDate="2020-04-23" xml:lang="en">used for place names</desc>
                            </valItem>
                            <valItem mode="add" ident="person">
                              <desc versionDate="2020-04-23" xml:lang="en">used for person names</desc>
                            </valItem>
                            <valItem mode="add" ident="animal">
                              <desc versionDate="2020-04-23" xml:lang="en">used for animal names</desc>
                            </valItem>
                          </valList>
                        </attDef>
                        <attDef ident="cert" mode="delete"/>
                        <attDef ident="resp" mode="delete"/>
                        <attDef ident="source" mode="delete"/>
                      </attList>
                    </elementSpec>
                  </schemaSpec>
                </egXML>
                <head type="legend">Attribute classes removed and attribute values changed for the <gi>name</gi> element (<ref target="../download/TBEcustom-3-editNameAttributes.odd">download</ref>).</head>
              </figure>
            </p>
            <p>Notice how a new element is introduced: <gi>elementSpec</gi>. In a schema specification, this is where elements are being defined. It has a mandatory <att>ident</att> attribute, which names the element. In this case, the <val>name</val> value tells us that this element specification defines a <gi>name</gi> element. Although this could be specified further by adding a <att>module</att> attribute with value <val>core</val>, this is not mandatory, since element names are unique across all TEI modules.</p>
            <p>Defining a TEI element that already exists might seem a bit weird at first sight. Notice, however, the <att>change</att> attribute with the value <val>change</val>, which is expressing that this existing TEI element is being changed in this customisation. This is an important mechanism: via the <att>mode</att> attribute, ODD lets you specify a number of actions on the declaration of elements and attributes (and many of their components):
              <list type="gloss"> 
                <label>
                                    <val>add</val>
                                </label>
                <item>a new declaration is added to the current definitions</item>
                <label>
                                    <val>delete</val>
                                </label>
                <item>an existing declaration is removed</item>
                <label>
                                    <val>change</val>
                                </label>
                <item>an existing declaration is changed partly: only the customised parts are changed; all other parts are copied from their TEI definition</item>
                <label>
                                    <val>replace</val>
                                </label>
                <item>an existing declaration is changed completely: only the customised parts are copied; all existing TEI definitions are ignored</item>
              </list>
            </p>
            <p>In our ODD file, the <tag>elementSpec ident="name" mode="change"</tag> element is telling that the existing declaration of <gi>name</gi> (in the <ident type="module">core</ident> module) should be copied, except for the components that are overridden in this customisation. In this case, there are both class-related changes, that are grouped in a <gi>classes</gi> element, and attribute-related changes, that are grouped in an <gi>attList</gi> element. The <gi>classes</gi> element groups class membership declarations in <gi>memberOf</gi> elements. In this case, three class memberships are deleted: each <gi>memberOf</gi> element refers to the class with the value of a <att>key</att> attribute, and next states that this membership should be removed, by the <val>delete</val> value for the <att>mode</att> attribute. It’s interesting to notice that, even though we removed the <ident type="class">att.canonical</ident> class in Roma, this is not reflected in a separate <tag type="empty">memberOf key="att.canonical" mode="delete</tag> element in the ODD file. This is not strictly needed, since <ident type="class">att.canonical</ident> is a member of <ident type="class">att.personal</ident>, so removal of the latter superclass automatically implies that the subclass(es) are removed as well.</p> 
            <p>Apart from class deletions, the <gi>elementSpec</gi> element with the definition of the customised <gi>name</gi> element groups attribute declaration in an <gi>attList</gi> element. Each attribute is declared in an <gi>attDef</gi> element. Here, too, the attribute is identified with an <att>ident</att> attribute, and the customisation action is given in <att>mode</att>. Four attributes are deleted: <att>subtype</att>, <att>nymRef</att>, <att>cert</att> and <att>resp</att> (from the <ident type="class">att.global.responsibility</ident> attribute class), and <att>source</att> (from the <ident type="class">att.global.source</ident> attribute class). It’s interesting to notice that Roma doesn’t just remove these classes via a <gi>memberOf</gi> element, as with the other attribute classes we had deleted, but instead removes their attributes individually. While both ways of removing attributes in ODD are equivalent, Roma probably opts to remove <soCalled>standalone</soCalled> classes as such, while members of <soCalled>inherited</soCalled> classes are removed individually.</p>
            <p>The definition for the <att>type</att> attribute, has the value <val>change</val> for its <att>mode</att> attribute, meaning that its contents should override the existing definitions. Since we restricted the list of possible values to a closed vocabulary, a <gi>valList</gi> re-defines the value list of this <att>type</att> attribute. Its <att>type</att> attribute with value <val>closed</val>, indicates that the attribute value list is a closed list. In order to indicate that only the parts defined in our customisation should be changed, a <att>mode</att>=<val>change</val> attribute is given on <gi>valList</gi>. The different values of this closed list are defined in a series of <gi>valItem</gi> elements, with the value of the attribute given in an <gi>ident</gi> attribute (in this case: <val>place</val>, <val>person</val>, and <val>animal</val>, respectively). Inside <gi>valItem</gi>, the description of the attribute value is given in a <gi>desc</gi> element. Notice that, since these attribute values are new, the <att>mode</att> attribute on each <gi>valItem</gi> element has the value <val>add</val>, to tell the ODD processor that they should be added to the existing definition of the <att>type</att> attribute. All other parts of the existing TEI definition of the <att>type</att> attribute are being copied when transforming this ODD file to a schema or documentation.<note>Notice, however, that a full attribute definition consists of more fields, like a description, declarations of datatype and occurrence indicators. These are discussed later in this module (<ptr type="crossref" target="#addAttributes"/>).</note>
            </p>
            <note type="summary">Elements are defined in an ODD file with the <gi>elementSpec</gi> element. The element must be identified in an <att>ident</att> attribute, and the processing mode should be stated in a <att>mode</att> attribute. Inside an element declaration, entire attribute classes can be removed by removing their membership of an attribute class. This is done inside a <gi>classes</gi> section, where each class membership is declared in a <gi>memberOf</gi> element. The value <val>delete</val> for the <att>mode</att> attribute indicates that a class membership should be removed. Declarations for individual attributes are grouped in an <gi>attList</gi> element inside <gi>elementSpec</gi>. Each single attribute is given its own definition inside an <gi>attDef</gi> element. This element, too, carries the <att>ident</att> and <att>mode</att> attributes, respectively for identifying the attribute, and specifying the status of the declaration. To delete attributes, indicating the <att>mode</att> as <val>delete</val> suffices. Changing attributes requires a <val>change</val> mode. Value lists for an attribute can be defined in a <gi>valList</gi> element, whose <att>type</att> attribute indicates whether the value list is open-ended (<val>open</val>) or closed (<val>closed</val>). The <att>mode</att> attribute can specify whether a <gi>valList</gi> declaration merely contains some changes to the existing TEI declaration (<val>change</val>), or replaces the original definition (<val>replace</val>). A value list declares each separate value for an attribute in a <gi>valItem</gi> element, with the value given in an <att>ident</att> attribute. The attribute value can be described in a <gi>desc</gi> element.</note>
          </div>
          <div xml:id="attributeClasses">
            <head>Changing Attribute Classes</head>
            <p>As mentioned before, TEI modules group attribute definitions into <term>attribute classes</term>. This facilitates the definition of elements that share the same attributes, by declaring them as members of an attribute class. For example, all TEI elements are declared members of the <ident type="class">att.global</ident> attribute class, which defines the global attributes <att>xml:id</att>, <att>n</att>, <att>xml:lang</att>, <att>rend</att>, <att>rendition</att>, and <att>xml:base</att>.</p>
            <p>As it happens, the <att>nymRef</att> attribute we have deleted from the definition of the <gi>name</gi> element in the previous section, is defined in such an attribute class, namely <ident type="class">att.naming</ident>, of which <gi>name</gi> is declared a member. This information may seem disparate, but is actually easy to find in Roma. Actually, we’ve been there before: 
              <list rend="ordered">
                <item>load the <ident type="file">TBEcustom</ident> customisation again in Roma if you haven’t done so already, and click the <q>Customize ODD</q> button,</item>
                <item>move to the <q>Elements</q> tab and scroll down to the definition of <gi>name</gi>.</item>
              </list>
              Remember how the attributes for <gi>name</gi> were grouped per attribute class? Those attribute class names are clickable in Roma. One way of accessing the <ident type="class">att.naming</ident> attribute class definition in Roma, is by clicking the link with the label <ident type="class">att.naming</ident> in the attributes list:
              <figure xml:id="figure18">
                <graphic url="../../../images/tutorials/TBED08v00/romaElementAttributeClasses.png"/>
                <head type="legend">Accessing the definition of an attribute class via the attributes list of an element in Roma.</head>
              </figure>
            </p>
            <p>Another way of navigating to the attribute classes, is by selecting the <q>Attribute Classes</q> tab at the top left of the Roma screen. As with the <q>Elements</q> tab, you’ll get a list of all attribute classes, with an indication of those that have been included in the current customisation, and an indication of the TEI module that defines them. 
              <figure xml:id="figure19">
                <graphic url="../../../images/tutorials/TBED08v00/romaAttributeClasses.png"/>
                <head type="legend">The <q>Attribute Classes</q> tab in Roma.</head>
              </figure>
            </p>
            <p>Clicking the link with the label <ident type="class">att.naming</ident> attribute class here, will take you to the definition of this attribute class:
              <figure xml:id="figure20">
                <graphic url="../../../images/tutorials/TBED08v00/romaAttributeClass.png"/>
                <head type="legend">Attribute class editing screen in Roma.</head>
              </figure>
            </p>
            <p>The <q>Attributes</q> button will take us to the definition of the attributes inside this class:
              <figure xml:id="figure21">
                <graphic url="../../../images/tutorials/TBED08v00/romaEditAttributeClass.png"/>
                <head type="legend">Display of the attributes in an attribute class in Roma.</head>
              </figure>
            </p>
            <p>The attribute class contains a number of sections: <q>Class Attributes</q> define the attributes of this class, in this case <att>nymRef</att> and <att>role</att>. In <q>Class Membership</q>, a superclass can be given; here, the <ident type="class">att.naming</ident> attribute class is declared as a member of the <ident type="class">att.canonical</ident> attribute class. This means that elements declaring themselves as member of (the subclass) <ident type="class">att.naming</ident>, will also inherit the attributes defined in (the superclass) <ident type="class">att.canonical</ident>, namely <att>key</att> and <att>ref</att>. Finally, the section <q>Member Classes</q> names attribute classes that are defined as subclass of <ident type="class">att.naming</ident>, in this case <ident type="class">att.personal</ident>.</p>
            <p>Now, instead of removing the <att>nymRef</att> attribute only from the <gi>name</gi> element as we did in the previous section, we could as well delete it globally from all elements that are member of the <ident type="class">att.naming</ident> attribute class. This can be done simply by clicking the <q>X</q> sign next to the <att>nymRef</att> attribute name.</p>
            <p>If we save the customisation again (by clicking the <q>Download</q> &gt; <q>Customization as ODD</q> button at the top right of the Roma screen), this produces following ODD file:
              <figure xml:id="example4">
                <egXML xmlns="http://www.tei-c.org/ns/Examples">
                  <schemaSpec ident="TBEcustom" start="TEI" prefix="tei_" targetLang="en" docLang="en">
                    <moduleRef key="figures" include="figDesc figure"/>
                    <moduleRef key="header" include="teiHeader fileDesc titleStmt publicationStmt sourceDesc"/>
                    <moduleRef key="core" include="p title emph lg l pb pubPlace publisher q quote name graphic"/>
                    <moduleRef key="textstructure" include="TEI text body titlePage docTitle docImprint docDate docAuthor byline div"/>
                    <moduleRef key="tei"/>
                    <elementSpec ident="name" mode="change">
                      <classes mode="change">
                        <memberOf key="att.datable" mode="delete"/>
                        <memberOf key="att.editLike" mode="delete"/>
                        <memberOf key="att.personal" mode="delete"/>
                      </classes>
                      <attList>
                        <attDef ident="cert" mode="delete"/>
                        <attDef ident="resp" mode="delete"/>
                        <attDef ident="source" mode="delete"/>
                      </attList>
                    </elementSpec>
                    
                    <elementSpec ident="name" mode="change">
                      <classes mode="change">
                        <memberOf key="att.datable" mode="delete"/>
                        <memberOf key="att.editLike" mode="delete"/>
                        <memberOf key="att.personal" mode="delete"/>
                      </classes>
                      <attList>
                        <attDef ident="subtype" mode="delete"/>
                        <attDef ident="nymRef" mode="delete"/>
                        <attDef ident="type" mode="change">
                          <valList type="closed" mode="change">
                            <valItem mode="add" ident="place">
                              <desc versionDate="2020-04-23" xml:lang="en">used for place names</desc>
                            </valItem>
                            <valItem mode="add" ident="person">
                              <desc versionDate="2020-04-23" xml:lang="en">used for person names</desc>
                            </valItem>
                            <valItem mode="add" ident="animal">
                              <desc versionDate="2020-04-23" xml:lang="en">used for animal names</desc>
                            </valItem>
                          </valList>
                        </attDef>
                        <attDef ident="cert" mode="delete"/>
                        <attDef ident="resp" mode="delete"/>
                        <attDef ident="source" mode="delete"/>
                      </attList>
                    </elementSpec>
                    <classSpec ident="att.naming" type="atts" mode="change">
                      <attList>
                        <attDef ident="nymRef" mode="delete"/>
                      </attList>
                    </classSpec>
                  </schemaSpec>
                </egXML>
                <head type="legend">Changed attribute class (<ref target="../download/TBEcustom-4-editAttNaming.odd">download</ref>).</head>
              </figure>
            </p>
            <p>Now, the <gi>schemaSpec</gi> element in our customisation ODD file contains another element, besides <gi>elementSpec</gi>: <gi>classSpec</gi>. This is where classes are being declared. As with element and attribute definitions, the name of the class is given in an <att>ident</att> attribute, and a <att>mode</att> attribute indicates the processing mode. There is an extra, mandatory, attribute, though: <att>type</att>, which indicates what kind of class is being defined. Possible values are:  
              <list type="gloss">
                <label>
                                    <val>atts</val>
                                </label> 
                <item>for the definition of an attribute class, which defines a number of common attributes</item>
                <label>
                                    <val>model</val>
                                </label> 
                <item>for the definition of a model class, which groups elements that can occur in the same context in a TEI document</item>
              </list>
            </p>
            <p>The content of this class specification looks familiar: an <gi>attList</gi> element groups all attribute declarations defined by the (attribute) class. Since the <ident type="class">att.naming</ident> class is being processed in <val>change</val> mode, it suffices to just redefine the <att>nymRef</att> attribute of this class: all other attributes of the class are being copied unmodified in our customisation. Hence, all it takes to remove <att>nymRef</att> from the <ident type="class">att.naming</ident> class, is an <gi>attDef</gi> element with <att>ident</att>=<val>nymRef</val>, and <att>mode</att>=<val>delete</val>.</p>
            <p>Actually, the deletion of the <att>nymRef</att> attribute from the <ident type="class">att.naming</ident> attribute class obsoletes our earlier deletion of the same attribute from the <gi>name</gi> attribute. However, it does no harm to have this deletion on both <gi>elementSpec</gi> and <gi>classSpec</gi> levels (they don’t contradict each other). The effect of this customisation can be seen by generating a TEI schema (via one of the schema output formats in the <q>Download</q> button at the top right of the Roma screen): this will only validate documents whose name-like elements don’t have a <att>nymRef</att> attribute.</p>
            <note>Be careful, though, when changing class definitions, as this can have wide ranging (and sometimes unforeseen) effects! Always make sure to study the relevant parts of the TEI Guidelines. And make sure you can trace back when anything unexpected happens: save early, save often!</note>
            <note type="summary">Attributes that are defined in an attribute class can be changed globally by changing the class specification in a <gi>classSpec</gi> element. This element must identify the name of the class in an <att>ident</att> attribute, and the type of class in a <att>type</att> attribute. As with other schema specification elements, the mode of operation should be stated in a <att>mode</att> attribute. Inside the <gi>classSpec</gi> declaration of an attribute class, all attribute definitions are grouped in an <gi>attList</gi> element, with an <gi>attDef</gi> declaration for each separate attribute.</note>
          </div>
        </div>
      </div>
        </body>
  </text>
  <!-- 
      $Date: 2020-11-16 12:33:38 +0100 (Mon, 16 Nov 2020) $
      $Id: TBED08v00.xml 460 2020-11-16 11:33:38Z ron.vandenbranden $  -->
</TEI>