Skip to content

Commit

Permalink
Updating constraints and schema for hand
Browse files Browse the repository at this point in the history
  • Loading branch information
joeytakeda committed Feb 20, 2025
1 parent e79f88d commit 6e6c6c7
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 81 deletions.
41 changes: 11 additions & 30 deletions schema/lim.full.odd
Original file line number Diff line number Diff line change
Expand Up @@ -328,28 +328,9 @@
<prefixDef ident="g" matchPattern="(.+)" replacementPattern="lim.odd#char_$1">
<p>Resolves links to a glyph.</p>
</prefixDef>
<prefixDef ident="hand" matchPattern="(.+)" replacementPattern="lim.odd#hand_$1">
<p>Resolves link to a particular hand.</p>
</prefixDef>

</listPrefixDef>
</encodingDesc>
<profileDesc>
<particDesc>
<listPerson>
<person xml:id="Forbes">
<persName>Forbes</persName>
</person>
<person xml:id="Chambers">
<persName>Chambers</persName>
</person>
</listPerson>
</particDesc>
<handNotes>
<handNote xml:id="hand_Forbes" medium="ink" scope="major" scribeRef="#Forbes">Forbes' hand</handNote>
<handNote xml:id="hand_Chambers" medium="pencil" scope="minor" scribeRef="#Chambers">Chambers' hand, written in pencil</handNote>
<handNote xml:id="hand_unknown">An unknown hand that is neither Chambers or Forbes.</handNote>
</handNotes>
</profileDesc>
</teiHeader>
<text>
<front>
Expand Down Expand Up @@ -2851,20 +2832,20 @@
<attDef ident="subtype" mode="delete"/>
</attList>
</classSpec><classSpec ident="att.written" module="tei" type="atts" mode="change">
<constraintSpec scheme="schematron" ident="hand.ForbesOnlyIfImmediateHandIsnt">
<desc>The use of Forbes' hand makes no sense unless the hand is someone else's.</desc>
<constraintSpec ident="hand.mustUseLocalPointer" mode="add" scheme="schematron">
<desc>All <att>hand</att> attributes should point
to a locally defined hand.</desc>
<constraint>
<sch:rule context="tei:*[@hand = 'hand:Forbes']">
<sch:let name="ancHand" value="ancestor::*[1][@hand]/@hand"/>
<sch:assert test="exists($ancHand) and not($ancHand = 'hand:Forbes')">ERROR: Specifying hand:Forbes rarely makes sense since his is the implied hand in all cases; the value hand:Forbes should only be used when the hand has switched from Forbes to another hand and then back to Forbes.</sch:assert>
<sch:rule context="tei:*[@hand]">
<sch:let name="hand" value="@hand"/>
<sch:let name="ptrs" value="tokenize($hand,'\s+')"/>
<sch:let name="handNotes" value="ancestor::tei:TEI//tei:handNote"/>
<sch:let name="unmatched" value="for $p in $ptrs return if ($handNotes[@xml:id = substring-after($p,'#')]) then () else $p"/>
<sch:assert test="every $p in $ptrs satisfies starts-with($p,'#')">ERROR: All @hand values must start with a # to point to a locally defined handNote.</sch:assert>
<sch:assert test="empty($unmatched)">ERROR: Cannot find associated handNotes for <sch:value-of select="string-join($unmatched, ' ')"/></sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<attList>
<attDef ident="hand" mode="change">

<valList type="closed" mode="add"><valItem ident="hand:Forbes"><gloss>Forbes</gloss><desc>Forbes' hand</desc></valItem><valItem ident="hand:Chambers"><gloss>Chambers</gloss><desc>Chambers' hand, written in pencil</desc></valItem><valItem ident="hand:unknown"><gloss>unknown</gloss><desc>An unknown hand that is neither Chambers or Forbes.</desc></valItem></valList></attDef>
</attList>
</classSpec><dataSpec module="tei" ident="teidata.language" mode="change">
<content>
<alternate>
Expand Down
23 changes: 1 addition & 22 deletions schema/lim.odd
Original file line number Diff line number Diff line change
Expand Up @@ -343,30 +343,9 @@
<prefixDef ident="g" matchPattern="(.+)" replacementPattern="lim.odd#char_$1">
<p>Resolves links to a glyph.</p>
</prefixDef>
<prefixDef ident="hand" matchPattern="(.+)" replacementPattern="lim.odd#hand_$1">
<p>Resolves link to a particular hand.</p>
</prefixDef>

</listPrefixDef>
</encodingDesc>
<profileDesc>
<particDesc>
<listPerson>
<person xml:id="Forbes">
<persName>Forbes</persName>
</person>
<person xml:id="Chambers">
<persName>Chambers</persName>
</person>
</listPerson>
</particDesc>
<handNotes>
<handNote xml:id="hand_Forbes" medium="ink" scope="major"
scribeRef="#Forbes">Forbes' hand</handNote>
<handNote xml:id="hand_Chambers" medium="pencil" scope="minor"
scribeRef="#Chambers">Chambers' hand, written in pencil</handNote>
<handNote xml:id="hand_unknown">An unknown hand that is neither Chambers or Forbes.</handNote>
</handNotes>
</profileDesc>
</teiHeader>
<text>
<front>
Expand Down
32 changes: 16 additions & 16 deletions schema/lim.rng
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xlink="http://www.w3.org/1999/xlink" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://www.tei-c.org/ns/1.0"><!--
Schema generated from ODD source 2025-02-20T04:34:10Z. .
Schema generated from ODD source 2025-02-20T05:22:35Z. .
TEI Edition: P5 Version 4.7.0. Last updated on 16th November 2023, revision e5dd73ed0
TEI Edition Location: https://www.tei-c.org/Vault/P5/4.7.0/
Expand Down Expand Up @@ -344,21 +344,21 @@ Sample values include: 1] all; 2] most; 3] range</a:documentation>
<optional>
<attribute name="hand">
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">points to a <code xmlns="http://www.w3.org/1999/xhtml" xmlns:rng="http://relaxng.org/ns/structure/1.0">&lt;handNote&gt;</code> element describing the hand considered responsible for the content of the element concerned.</a:documentation>
<choice>
<value>hand:Forbes</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">(Forbes) Forbes' hand</a:documentation>
<value>hand:Chambers</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">(Chambers) Chambers' hand, written in pencil</a:documentation>
<value>hand:unknown</value>
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">(unknown) An unknown hand that is neither Chambers or Forbes.</a:documentation>
</choice>
<data type="anyURI">
<param name="pattern">\S+</param>
</data>
</attribute>
</optional>
</define>
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" id="lim-att.written-hand.ForbesOnlyIfImmediateHandIsnt-constraint-rule-1">
<sch:rule xmlns="http://www.tei-c.org/ns/1.0" xmlns:lim="https://dhil.lib.sfu.ca/lyoninmourning" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xi="http://www.w3.org/2001/XInclude" context="tei:*[@hand = 'hand:Forbes']">
<sch:let name="ancHand" value="ancestor::*[1][@hand]/@hand"/>
<sch:assert test="exists($ancHand) and not($ancHand = 'hand:Forbes')">ERROR: Specifying hand:Forbes rarely makes sense since his is the implied hand in all cases; the value hand:Forbes should only be used when the hand has switched from Forbes to another hand and then back to Forbes.</sch:assert>
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" id="lim-att.written-hand.mustUseLocalPointer-constraint-rule-1">
<sch:rule xmlns="http://www.tei-c.org/ns/1.0" xmlns:lim="https://dhil.lib.sfu.ca/lyoninmourning" xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xi="http://www.w3.org/2001/XInclude" context="tei:*[@hand]">
<sch:let name="hand" value="@hand"/>
<sch:let name="ptrs" value="tokenize($hand,'\s+')"/>
<sch:let name="handNotes" value="ancestor::tei:TEI//tei:handNote"/>
<sch:let name="unmatched" value="for $p in $ptrs return if ($handNotes[@xml:id = substring-after($p,'#')]) then () else $p"/>
<sch:assert test="every $p in $ptrs satisfies starts-with($p,'#')">ERROR: All @hand values must start with a # to point to a locally defined handNote.</sch:assert>
<sch:assert test="empty($unmatched)">ERROR: Cannot find associated handNotes for <sch:value-of select="string-join($unmatched, ' ')"/>
</sch:assert>
</sch:rule>
</pattern>
<define name="att.damaged.attributes">
Expand Down Expand Up @@ -4649,7 +4649,7 @@ Sample values include: 1] main; 2] sub (subordinate); 3] alt (alternate); 4] sho
</zeroOrMore>
</zeroOrMore>
</group>
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0" id="lim-lg-atleast1oflggapl-constraint-assert-65">
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0" id="lim-lg-atleast1oflggapl-constraint-assert-66">
<rule context="tei:lg">
<sch:assert xmlns="http://www.tei-c.org/ns/1.0" xmlns:lim="https://dhil.lib.sfu.ca/lyoninmourning" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" test="count(descendant::tei:lg|descendant::tei:l|descendant::tei:gap) &gt; 0">An lg element
must contain at least one child l, lg, or gap element.</sch:assert>
Expand Down Expand Up @@ -6034,7 +6034,7 @@ Suggested values include: 1] 1.0.1; 2] 1.1; 3] 2.0; 4] 2.1; 5] 3.0; 6] 3.1; 7] 3
</sch:assert>
</sch:rule>
</sch:pattern>
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0" id="lim-standOff-nested_standOff_should_be_typed-constraint-assert-94">
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0" id="lim-standOff-nested_standOff_should_be_typed-constraint-assert-95">
<rule context="tei:standOff">
<sch:assert xmlns="http://www.tei-c.org/ns/1.0" xmlns:lim="https://dhil.lib.sfu.ca/lyoninmourning" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xi="http://www.w3.org/2001/XInclude" test="@type or not(ancestor::tei:standOff)">This
<sch:name/> element must have a @type attribute, since it is
Expand Down Expand Up @@ -8595,7 +8595,7 @@ Sample values include: 1] glued; 2] pinned; 3] sewn</a:documentation>
<ref name="model.milestoneLike"/>
</choice>
</oneOrMore>
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0" id="lim-subst-substContents1-constraint-assert-140">
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0" id="lim-subst-substContents1-constraint-assert-141">
<rule context="tei:subst">
<assert xmlns:lim="https://dhil.lib.sfu.ca/lyoninmourning" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xi="http://www.w3.org/2001/XInclude" test="child::tei:add and (child::tei:del or child::tei:surplus)">
<name/> must have at least one child add and at least one child del or surplus</assert>
Expand Down
33 changes: 20 additions & 13 deletions schema/modules/tei.xml
Original file line number Diff line number Diff line change
Expand Up @@ -331,23 +331,30 @@
</attList>
</classSpec>
<!--att.written-->
<classSpec ident="att.written" module="tei" type="atts" mode="change">
<constraintSpec scheme="schematron" ident="hand.ForbesOnlyIfImmediateHandIsnt">
<desc>The use of Forbes' hand makes no sense unless the hand is someone else's.</desc>
<classSpec ident="att.written"
module="tei" type="atts" mode="change">
<constraintSpec ident="hand.mustUseLocalPointer"
mode="add" scheme="schematron">
<desc>All <att>hand</att> attributes should point
to a locally defined hand.</desc>
<constraint>
<sch:rule context="tei:*[@hand = 'hand:Forbes']">
<sch:let name="ancHand" value="ancestor::*[1][@hand]/@hand"/>
<sch:assert test="exists($ancHand) and not($ancHand = 'hand:Forbes')">ERROR: Specifying hand:Forbes rarely makes sense since his is the implied hand in all cases; the value hand:Forbes should only be used when the hand has switched from Forbes to another hand and then back to Forbes.</sch:assert>
<sch:rule context="tei:*[@hand]">
<sch:let name="hand" value="@hand"/>
<sch:let name="ptrs" value="tokenize($hand,'\s+')"/>
<sch:let name="handNotes"
value="ancestor::tei:TEI//tei:handNote"/>
<sch:let name="unmatched"
value="for $p in $ptrs
return
if
($handNotes[@xml:id = substring-after($p,'#')])
then ()
else $p"/>
<sch:assert test="every $p in $ptrs satisfies starts-with($p,'#')">ERROR: All @hand values must start with a # to point to a locally defined handNote.</sch:assert>
<sch:assert test="empty($unmatched)">ERROR: Cannot find associated handNotes for <sch:value-of select="string-join($unmatched, ' ')"/></sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<attList>
<attDef ident="hand" mode="change">
<valList mode="add" type="closed">

</valList>
</attDef>
</attList>
</classSpec>
<!--teidata.language-->
<dataSpec module="tei" ident="teidata.language" mode="change">
Expand Down

0 comments on commit 6e6c6c7

Please sign in to comment.