<?xml version="1.0" encoding="UTF-8"?>
<grammar
	xmlns="http://relaxng.org/ns/structure/1.0"
	xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
	xmlns:w="http://www.wulfila.be/namespaces/legacy"
	datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
	<a:documentation>Schema for the lemmas data file.</a:documentation>
	<!-- 
	Revision history:
	[2026-05-19] First draft.
	[2026-05-20] First full version.
	[2026-05-24] Finished documentation.
	
	Tom De Herdt
	https://www.wulfila.be/
	-->
	
	<include href="common.rng">
		<start>
			<ref name="root"/>
		</start>
	</include>
	
	<define name="root">
		<element name="lemmas">
			<oneOrMore>
				<ref name="lemma"/>
			</oneOrMore>
		</element>
	</define>
	
	<define name="lemma">
		<element name="lemma">
			<attribute name="id">
				<a:documentation>Lemma identifier.</a:documentation>
				<data type="positiveInteger"/>
			</attribute>
			<optional>
				<attribute name="parent">
					<a:documentation>Foreign key: identifier of another lemma that this lemma refers to, because it is a link or related lemma.</a:documentation>
					<data type="positiveInteger"/>
				</attribute>
			</optional>
			<optional>
				<attribute name="problematic">
					<a:documentation>Lemma does not fit neatly into the schema, or is otherwise problematic. See internal note in &lt;meta&gt;.</a:documentation>
					<ref name="boolean.attribute.true"/>
				</attribute>
			</optional>
			<attribute name="type">
				<a:documentation>Lemma type.</a:documentation>
				<ref name="list.lemma.type"/>
			</attribute>
			<optional>
				<attribute name="verified">
					<a:documentation>Last verification date. (The dictionary has been checked twice.)</a:documentation>
					<data type="dateTime"/>
				</attribute>
			</optional>
			<element name="form">
				<a:documentation>Orthographical form of the lemma or headword.</a:documentation>
				<optional>
					<attribute name="conjecture">
						<a:documentation>Lemma is a conjecture.</a:documentation>
						<ref name="boolean.attribute.true"/>
					</attribute>
				</optional>
				<optional>
					<attribute name="inflected">
						<a:documentation>Lemma is an inflected form (a headword cannot be reconstructed with certainty).</a:documentation>
						<ref name="boolean.attribute.true"/>
					</attribute>
				</optional>
				<optional>
					<attribute name="reconstruction">
						<a:documentation>Lemma is a reconstruction that leaves some room for doubt (marked with * in Streitberg).</a:documentation>
						<ref name="boolean.attribute.true"/>
					</attribute>
				</optional>
				<optional>
					<attribute name="suspect">
						<a:documentation>Lemma is a dubious or suspect reading (marked with dagger in Streitberg).</a:documentation>
						<ref name="boolean.attribute.true"/>
					</attribute>
				</optional>
				<text/>
			</element>
			<element name="pos">
				<a:documentation>Foreign key: identifier of a part-of-speech tag defined in the grammar data file.</a:documentation>
				<data type="unsignedByte"/>
			</element>
			<element name="inflection">
				<attribute name="class">
					<a:documentation>Foreign key: identifier of an inflection class defined the grammar data file.</a:documentation>
					<data type="unsignedByte"/>
				</attribute>
				<optional>
					<attribute name="irregular">
						<a:documentation>Lemma has irregular inflection.</a:documentation>
						<ref name="boolean.attribute.true"/>
					</attribute>
				</optional>
				<optional>
					<attribute name="uncertain">
						<a:documentation>The assigned inflection class is not certain (Streitberg's label contains a question mark or other indication of uncertainty).</a:documentation>
						<ref name="boolean.attribute.true"/>
					</attribute>
				</optional>
				<zeroOrMore>
					<element name="param">
						<a:documentation>Gomorphv2 parameter.</a:documentation>
						<attribute name="name">
							<a:documentation>Parameter name.</a:documentation>
							<data type="NCName"/>
						</attribute>
						<optional>
							<attribute name="type">
								<a:documentation>Parameter type.</a:documentation>
								<choice>
									<value>info</value><a:documentation>Temporary or informational parameter, not passed on to Gomorphv2.</a:documentation>
								</choice>
							</attribute>
						</optional>
						<choice>
							<text/>
							<ref name="null"/>
						</choice>
					</element>
				</zeroOrMore>
				<zeroOrMore>
					<element name="override">
						<a:documentation>Gomorphv2 override rule.</a:documentation>
						<attribute name="variable">
							<a:documentation>Name of the Gomorph variable that will be overridden.</a:documentation>
							<data type="NCName"/>
						</attribute>
						<attribute name="operator">
							<a:documentation>Gomorphv2 operator: assign, add or remove.</a:documentation>
							<choice>
								<value>assign</value>
								<value>add</value>
								<value>remove</value>
							</choice>
						</attribute>
						<optional>
							<attribute name="range">
								<a:documentation>Gomorphv2 range expression (regular expression applied to the set of inflectional tags). When missing, all tags are selected.</a:documentation>
							</attribute>
						</optional>
						<choice>
							<text/>
							<ref name="null"/>
						</choice>
					</element>
				</zeroOrMore>
			</element>
			<optional>
				<ref name="streitberg"/>
			</optional>
			<optional>
				<element name="note">
					<a:documentation>Public note about the lemma.</a:documentation>
					<text/>
				</element>
			</optional>
			<optional>
				<element name="meta">
					<a:documentation>Internal note about the lemma or its encoding, in Dutch.</a:documentation>
					<text/>
				</element>
			</optional>
		</element>
	</define>
		
	<define name="streitberg">
		<element name="streitberg">
			<a:documentation>Information on the lemma as it appears in Wilhelm Streitberg's dictionary (1910).</a:documentation>
			<attribute name="page">
				<a:documentation>Page number in Streitberg 1910.</a:documentation>
				<data type="positiveInteger"/>
			</attribute>
			<attribute name="position">
				<a:documentation>Position of the headword on the page.</a:documentation>
				<data type="positiveInteger"/>
			</attribute>
			<attribute name="letter">
				<a:documentation>Letter under which the lemma is filed (not necessarily initial letter: compound verbs are sorted on stem).</a:documentation>
				<data type="string">
					<param name="pattern">[A-ZǶÞ]</param>
				</data>
			</attribute>
			<optional>
				<attribute name="n">
					<a:documentation>Index number used by Streitberg to differentiate homonyms, e.g. “1. gabaur (Na)” and “2. gabaur* (Ma)”. Lemmas with type ‘homograph’ are grouped and numbered under a single headword in the dictionary; otherwise headwords are repeated, with a number before the boldfaced lemma.</a:documentation>
					<data type="positiveInteger"/>
				</attribute>
			</optional>
			<optional>
				<attribute name="conjecture">
					<a:documentation>Lemma is a conjecture, in square brackets. Streitberg: “Durch Konjektur entstandene Formen stehn in eckigen Klammern [].”</a:documentation>
					<ref name="boolean.attribute.true"/>
				</attribute>
			</optional>
			<optional>
				<attribute name="reconstruction">
					<a:documentation>Lemma is a reconstruction, marked with asterisk. Streitberg: <span xml:lang="de">“ein Stern (*) nach einer Form [deutet an], daß die zitierte Form in unserer Überlieferung zufällig fehlt, ihre Erschließung aber aus irgendeinem Grund dem Zweifel Raum läßt.”</span></a:documentation>
					<ref name="boolean.attribute.true"/>
				</attribute>
			</optional>
			<optional>
				<attribute name="suspect">
					<a:documentation>Lemma is a dubious reading, marked with dagger. Streitberg: “ein Kreuz (†) vor einer Form charakterisiert die handschriftliche Überlieferung als besserungsbedürftig.”</a:documentation>
					<ref name="boolean.attribute.true"/>
				</attribute>
			</optional>
			
			<optional>
				<element name="form">
					<a:documentation>Orthographical form used by Streitberg, when it differs from the lemma form used in this data file.</a:documentation>
					<text/>
				</element>
			</optional>
			
			<optional>
				<element name="formInfo">
					<a:documentation>Information following the lemma in Streitberg's lexicon, mostly on spelling, phonology or grammar, with references to Streitberg's Gotisches Elementarbuch (1920).</a:documentation>
					<text/>
				</element>
			</optional>
			
			<optional>
				<element name="grammar">
					<a:documentation>Grammar/morphology label used by Streitberg.</a:documentation>
					<optional>
						<attribute name="implied">
							<a:documentation>Streitberg's label is implied, i.e. omitted in the dictionary because the lemma is a compound; only the root lemma mentions the class.</a:documentation>
							<ref name="boolean.attribute.true"/>
						</attribute>
					</optional>
					<optional>
						<attribute name="base">
							<a:documentation>Normalized, corrected or general class label (used elsewhere by Streitberg), to facilitate grouping and searching.</a:documentation>
						</attribute>
						<attribute name="type">
							<a:documentation>Specifies the relation between @base and the label used by Streitberg.</a:documentation>
							<choice>
								<value>variation</value>
								<a:documentation>Alternate spelling or wording, e.g. ‘Akk.Pl.’ for ‘Akk.Plur.’.</a:documentation>
								
								<value>subclass</value>
								<a:documentation>Subset of the generic class, e.g. ‘st.Adj.a’ for ‘Adj.a’.</a:documentation>
								
								<value>uncertain</value>
								<a:documentation>Hypothesis, e.g. ‘M?a’ or ‘M(i)’.</a:documentation>
								
								<value>irregular</value>
								<a:documentation>Irregular instance of the generic class, e.g. ‘unreg.abl.V.1’.</a:documentation>
								
								<value>error</value>
								<a:documentation>Obvious error, e.g. spillon ‘sw.V.1’ for ‘sw.V.2’.</a:documentation>
							</choice>
						</attribute>
					</optional>
					<text/>
				</element>
			</optional>
			
			<optional>
				<element name="grammarInfo">
					<a:documentation>Information that follows the class label in Streitberg's lexicon, mostly on morphology.</a:documentation>
					<text/>
				</element>
			</optional>
		
			<optional>
				<element name="sense">
					<a:documentation>German translation by Streitberg. Incomplete and no longer updated: see XML transcription of the dictionary.</a:documentation>
					<text/>
				</element>
			</optional>
		</element>
	</define>
	
	<define name="null">
		<element name="null">
			<a:documentation>Gomorphv2 NULL value.</a:documentation>
			<empty/>
		</element>
	</define>
	
	<define name="list.lemma.type">
		<choice>
			<value>normal</value>
			<a:documentation w:id="1" w:streitberg="true" w:generate="true">Normal lemma.</a:documentation>
			
			<value>link-spelling</value>
			<a:documentation w:id="2" w:streitberg="true" w:generate="false">Reference to another lemma (@parent), for which it has an alternative spelling. Streitberg only, not linked to tokens.</a:documentation>
			
			<value>link-hyphen</value>
			<a:documentation w:id="3" w:streitberg="true" w:generate="false">Reference to another, identical lemma (@parent), the only difference being the use of a hyphen to separate root and prefix. Streitberg only, not linked to tokens.</a:documentation>
			
			<value>link-derived</value>
			<a:documentation w:id="4" w:streitberg="true" w:generate="false">Inflected form of another lemma, listed as a separate lemma with reference to the main lemma (@parent), e.g. ‘wait’ linked to ‘witan’. Streitberg only, not linked to tokens.</a:documentation>
			
			<value>link-suppletion</value>
			<a:documentation w:id="5" w:streitberg="true" w:generate="true">Suppletive form listed as a separate lemma, e.g. ‘batiza’ linked to ‘goþs’.</a:documentation>
			
			<value>link-spelling-combined</value>
			<a:documentation w:id="6" w:streitberg="true" w:generate="false">Combined spelling variants referring to multiple main lemmas, e.g. ‘leikeis, leikeinassus s. lekeis etc.’ Streitberg only, not linked to tokens.</a:documentation>
			
			<value>link-conjecture</value>
			<a:documentation w:id="7" w:streitberg="true" w:generate="false">Form marked as ‘besserungsbedürftig’ (with dagger), referring to a corresponding conjecture (or the other way round).</a:documentation>
			
			<value>homograph</value>
			<a:documentation w:id="9" w:streitberg="true" w:generate="true">One lemma out of a set of homographs that is treated as one entry in Streitberg's lexicon (cf. TEI &lt;hom&gt;).</a:documentation>
			
			<value>sublemma</value>
			<a:documentation w:id="10" w:streitberg="true" w:generate="true">Lemma mentioned as a related or derived lemma in Streitberg's lexicon (cf. TEI &lt;re&gt;). Attribute @parent refers to the main lemma.</a:documentation>
			
			<value>component</value>
			<a:documentation w:id="11" w:streitberg="true" w:generate="false">Clitic (e.g. ‘-hun’) or root form (e.g. ‘-kunnan’).</a:documentation>
			
			<value>alternative</value>
			<a:documentation w:id="12" w:streitberg="false" w:generate="false">Alternative reconstruction for the lemma specified by @parent. Not listed as a separate lemma in Streitberg.</a:documentation>
			
			<value>extra</value>
			<a:documentation w:id="13" w:streitberg="false" w:generate="true">Lemma not in Streitberg, either because it is accidentally missing, or because it refers to words in a recently discovered fragment.</a:documentation>
		</choice>
	</define>

</grammar>