<?xml version="1.0" encoding="UTF-8"?>
<!--
  A worked CS-Local 1.0 fragment. Not the real Sherborn code: it is short on purpose and exists
  so the schema has something concrete to point at and so `convert/downgrade_akn.py` has
  something to reduce.

  It shows the five things the fork exists for, side by side in one file:
    - two instruments of different kinds in the same code, a bylaw and a board regulation
    - the adopting body, its role, and the statute the board makes rules under
    - typed apparatus: editorial note, source credit, general references
    - a provision that is on the books but not in force
    - normative schedules: a use schedule with a typed legend whose rows bind to defined
      terms, and a dimensional schedule transcribed from a PDF attachment, both keyed on
      the declared entity registry, which also carries two overlays and their text
-->
<local:code xmlns:local="https://code.communityscale.io/ns/local/1.0"
           xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0">

  <local:jurisdiction>
    <local:place gnis="0619426" state="MA" type="town">Sherborn</local:place>
    <local:enablingFramework>/us-ma/act/mgl</local:enablingFramework>
  </local:jurisdiction>

  <!-- The house style, declared. Everything downstream reads this instead of assuming. -->
  <local:profile citation="chapter-article-section"
                enumeration="eastern-bracket"
                containers="chapter-article"/>

  <references source="#communityscale">
    <TLCOrganization eId="org_town_meeting" href="/ontology/organization/town-meeting"
                     showAs="Town Meeting"/>
    <TLCOrganization eId="org_planning_board" href="/ontology/organization/planning-board"
                     showAs="Planning Board"/>
    <TLCOrganization eId="org_board_of_appeals" href="/ontology/organization/board-of-appeals"
                     showAs="Board of Appeals"/>
  </references>

  <!-- The entity registry: the one declaration the schedule columns, the prose names and
       the map's polygon attribute all resolve through. @kind is "district" here because
       this is a zoning chapter; a stormwater chapter declares kind="watershed" and
       everything below works unchanged. @map is the geometry layer's key, present only
       when a layer exists; the Flood Plain District has none, and saying so is the point.
       @governedBy is the entity's substantive text, which for an overlay is the whole
       answer: § 240-2.1 creates the Flood Plain District in a line, § 240-5.5 is what it
       requires. On downgrade each entity becomes a plain TLCConcept. -->
  <local:entities kind="district" established="#sec_240-2.1">
    <local:entity eId="dist_ra"  code="RA"  class="residential" map="RA"
                  governedBy="#sec_240-3.2 #sec_240-4.2" showAs="Residence District A"/>
    <local:entity eId="dist_b-g" code="B-G" class="business" map="B-G"
                  governedBy="#sec_240-3.2 #sec_240-4.2" showAs="Business District G"/>

    <!-- Established by the code, absent from the map, and restrictive rather than
         permissive: it constrains whatever district lies under it. -->
    <local:entity eId="dist_fp"  code="FP"  class="overlay" relation="restricts"
                  over="#dist_ra #dist_b-g" governedBy="#sec_240-5.5"
                  showAs="Flood Plain District"/>
    <!-- The other kind of overlay: it grants what the base district does not. -->
    <local:entity eId="dist_mod" code="MOD" class="overlay" relation="supplements"
                  map="MODSherborn" governedBy="#sec_240-5.7"
                  showAs="Multi-Family Overlay District"/>
  </local:entities>

  <!-- 1. A bylaw. Town Meeting adopted it; only Town Meeting can change it. -->
  <local:instrument type="bylaw" eId="chp_240">
    <local:adoption>
      <local:body role="legislative" refersTo="#org_town_meeting">Town Meeting</local:body>
      <local:procedure amendedBy="town-meeting-article" hearing="required" majority="two-thirds"
                      review="ma-attorney-general"/>
      <local:date date="1969-03-10" type="adoption"/>
    </local:adoption>
    <meta>
      <identification source="#communityscale">
        <FRBRWork>
          <FRBRthis value="/us-ma/sherborn/bylaw/zoning/!main"/>
          <FRBRuri value="/us-ma/sherborn/bylaw/zoning"/>
          <FRBRdate date="1969-03-10" name="adoption"/>
          <FRBRauthor href="#org_town_meeting" as="#author"/>
          <FRBRcountry value="us-ma"/>
          <FRBRsubtype value="bylaw"/>
        </FRBRWork>
        <FRBRExpression>
          <FRBRthis value="/us-ma/sherborn/bylaw/zoning/eng@2026-04-23/!main"/>
          <FRBRuri value="/us-ma/sherborn/bylaw/zoning/eng@2026-04-23"/>
          <FRBRdate date="2026-04-23" name="codeDate"/>
          <FRBRauthor href="#communityscale" as="#editor"/>
          <FRBRlanguage language="eng"/>
        </FRBRExpression>
      </identification>
      <proprietary source="#communityscale">
        <local:sourceSystem customer="SH4020" id="38073564"
                            codeDate="2026-04-23" captured="2026-08-05"/>
      </proprietary>
    </meta>

    <num>240</num>
    <heading>Zoning</heading>

    <local:generalReferences>
      <p>Building construction, see Ch. 105. Subdivision of land, see Ch. A676.</p>
    </local:generalReferences>

    <body>
      <article eId="chp_240__art_I">
        <num>I</num>
        <heading>General provisions</heading>

        <section eId="sec_240-1.4">
          <num>240-1.4</num>
          <heading>Applicability</heading>
          <local:sourceCredit>
            <local:asPublished>[Amended 4-25-2023 ATM by Art. 23]</local:asPublished>
            <local:event date="2023-04-25" type="amendment" by="#org_town_meeting" instrument="Art. 23"/>
          </local:sourceCredit>

          <subsection eId="sec_240-1.4__subsec_a">
            <num>A.</num>
            <content>
              <p>No building shall be erected in <ref href="#dist_ra" refersTo="#dist_ra">Residence
              District A</ref> except in conformity with this chapter.</p>
            </content>
          </subsection>

          <!-- On the books, not in force. A reader chasing an old citation has to land here. -->
          <subsection eId="sec_240-1.4__subsec_e" local:inForce="false" local:disposition="deleted">
            <num>E.</num>
            <content>
              <p>[Deleted 1994; see <ref href="#sec_240-5.5__subsec_b__para_2">§ 240-5.5B(2)</ref>.]</p>
            </content>
          </subsection>
        </section>

        <section eId="sec_240-1.5">
          <num>240-1.5</num>
          <heading>Definitions</heading>
          <local:editorialNote>
            <p>Terms defined elsewhere in this chapter for a limited purpose govern within the
            section that defines them.</p>
          </local:editorialNote>
          <hcontainer name="definition" eId="sec_240-1.5__def_structure">
            <content>
              <p><def refersTo="#term_240-1.5_structure">STRUCTURE</def> — A combination of
              materials assembled at a fixed location to give support or shelter.</p>
            </content>
          </hcontainer>
          <!-- The term § 240-3.2's first use row binds to. Note the schedule calls it
               "Single-family home" and the glossary calls it this; the row's refersTo is
               what joins them, and no string comparison would. -->
          <hcontainer name="definition" eId="sec_240-1.5__def_dwelling_sf">
            <content>
              <p><def refersTo="#term_240-1.5_dwelling_sf">DWELLING, SINGLE-FAMILY</def> — A
              detached building containing one dwelling unit.</p>
            </content>
          </hcontainer>
        </section>
      </article>

      <article eId="chp_240__art_III">
        <num>III</num>
        <heading>Use regulations</heading>

        <!-- A table that states rules gets a schedule beside it. The legend is this
             schedule's own: the symbols are opaque strings, the @outcome vocabulary is
             closed, and the discretionary outcome names the body that grants it. -->
        <section eId="sec_240-3.2">
          <num>240-3.2</num>
          <heading>Schedule of Use Regulations</heading>
          <content>
            <p>No building or land shall be used except as set forth in the accompanying
            Schedule of Use Regulations.</p>
            <!-- The published table stays exactly as adopted: it is what the law *is*, and
                 the schedule below is structure beside it, not a replacement. This is the
                 inline mode, 25% of the corpus; § 240-4.2 shows the attachment mode. -->
            <table eId="tbl_240-3.2">
              <tr><th><p>Use</p></th><th><p>RA</p></th><th><p>B-G</p></th></tr>
              <tr><td><p>1) Single-family home</p></td><td><p>P</p></td><td><p>P</p></td></tr>
              <tr><td><p>14) Retail store</p></td><td><p>X</p></td><td><p>A*</p></td></tr>
            </table>
          </content>
          <local:schedule eId="schd_240-3.2" type="use" source="#sec_240-3.2">
            <!-- The schedule is versioned whole. The redline against the proposed
                 expression is computed by comparing the two, not stored per cell. -->
            <local:sourceCredit>
              <local:asPublished>[Amended 4-29-2025 ATM by Art. 17]</local:asPublished>
              <local:event date="2025-04-29" type="amendment" by="#org_town_meeting"
                           instrument="Art. 17"/>
            </local:sourceCredit>
            <local:legend>
              <local:symbol code="P" outcome="permitted">Permitted</local:symbol>
              <local:symbol code="A" outcome="approval" approver="#org_board_of_appeals"
                            procedure="special-permit">Allowable on special permit</local:symbol>
              <local:symbol code="X" outcome="prohibited">Prohibited</local:symbol>
            </local:legend>
            <local:group heading="Residential uses">
              <!-- @subject is the schedule's own wording; @refersTo is the defined term.
                   They differ on purpose: the table says "Single-family home" and the
                   glossary says DWELLING, SINGLE-FAMILY. Binding by identity is what
                   keeps them joined when either string is edited. -->
              <local:row eId="schd_240-3.2__use_1" num="1" subject="Single-family home"
                         refersTo="#term_240-1.5_dwelling_sf">
                <!-- One published cell merged across two columns stays one cell. -->
                <local:cell entity="#dist_ra #dist_b-g" symbol="P"/>
              </local:row>
            </local:group>
            <local:group heading="Business uses">
              <!-- No definition for this one, which is a legitimate state and not an
                   error: plenty of use rows name things the code never defines. -->
              <local:row eId="schd_240-3.2__use_14" num="14" subject="Retail store">
                <local:cell entity="#dist_ra" symbol="X"/>
                <local:cell entity="#dist_b-g" symbol="A" footnote="*" see="#sec_240-5.3"/>
              </local:row>
            </local:group>
            <!-- The footnote is typed like the legend: declared once, referenced by
                 marker, and @effect says what it does to the cells it marks. A P with a
                 conditions footnote is never presented as an unconditional yes.

                 Note this schedule's "*" and § 240-4.2's "*" are different footnotes with
                 different effects. A footnote belongs to its schedule and a marker resolves
                 nowhere else, because codes reuse markers across their tables as a matter
                 of course: 93% of codes with two or more footnoted matrices do it, and
                 Santa Clarita puts "b" on 91 different tables. Identity is the eId
                 (schd_240-3.2__fn_ast), not the printed marker. -->
            <local:footnote marker="*" effect="conditions" eId="schd_240-3.2__fn_ast">Subject
              to site plan review under § 240-5.3.</local:footnote>
          </local:schedule>
        </section>
      </article>

      <article eId="chp_240__art_IV">
        <num>IV</num>
        <heading>Dimensional regulations</heading>

        <!-- The attachment-only mode, which is 22% of the corpus: the section's text points
             at a PDF, so the schedule is a transcription and declares its provenance. -->
        <section eId="sec_240-4.2">
          <num>240-4.2</num>
          <heading>Schedule of Dimensional Requirements</heading>
          <content>
            <p>Dimensional requirements are as set forth in the Schedule of Dimensional
            Requirements included as an attachment to this chapter.</p>
          </content>
          <local:schedule eId="schd_240-4.2" type="dimensional" source="#sec_240-4.2">
            <local:provenance>
              <local:transcribedFrom
                  href="/attachment/333628/SH4020-240a Schedule of Dimensional Requirements.pdf"
                  supplement="Supp 3, Aug 2025" verified="2026-08-05"/>
            </local:provenance>
            <local:dimensions>
              <local:dimension key="lot_area" concept="lot-area" bound="min"
                               unit="acre">Minimum Lot Size</local:dimension>
              <!-- A marker on the dimension covers every cell in the column: one
                   declaration, one attachment, no per-cell repetition. -->
              <local:dimension key="frontage" concept="frontage" bound="min" unit="ft"
                               footnote="*">Minimum Continuous Frontage</local:dimension>
            </local:dimensions>
            <local:row entity="#dist_ra">
              <local:cell dim="lot_area" value="1"/>
              <local:cell dim="frontage" value="150"/>
            </local:row>
            <local:row entity="#dist_b-g">
              <local:cell dim="lot_area" text="None"/>
              <local:cell dim="frontage" value="100"/>
            </local:row>
            <!-- The same printed marker as the use schedule's, a different note. -->
            <local:footnote marker="*" effect="clarifies" eId="schd_240-4.2__fn_ast">Frontage is
              measured continuously on a way providing legal and physical access.</local:footnote>
          </local:schedule>
        </section>
      </article>

      <!-- The provisions the registry and the schedules point at. Stubs, but present:
           a @governedBy or a @see that resolves to nothing is exactly the failure the
           referential validation layer exists to catch, and an example that cannot pass
           its own rules is not an example. -->
      <article eId="chp_240__art_V">
        <num>V</num>
        <heading>District regulations</heading>
        <section eId="sec_240-5.3">
          <num>240-5.3</num>
          <heading>Site plan review</heading>
          <content><p>A use marked as requiring site plan review shall not be established
          until the Planning Board has approved a site plan under this section.</p></content>
        </section>
        <section eId="sec_240-5.5">
          <num>240-5.5</num>
          <heading>Flood Plain District</heading>
          <intro><p>The Flood Plain District is an overlay district superimposed on the
          districts it covers, and its requirements apply in addition to those of the
          underlying district.</p></intro>
          <subsection eId="sec_240-5.5__subsec_b">
            <num>B.</num>
            <intro><p>Within the Flood Plain District:</p></intro>
            <paragraph eId="sec_240-5.5__subsec_b__para_2">
              <num>(2)</num>
              <content><p>No structure shall be erected below the base flood elevation
              except as this section allows.</p></content>
            </paragraph>
          </subsection>
        </section>
        <section eId="sec_240-5.7">
          <num>240-5.7</num>
          <heading>Multi-Family Overlay District</heading>
          <content><p>Within the Multi-Family Overlay District, multifamily dwellings are
          permitted in addition to the uses allowed in the underlying district.</p></content>
        </section>
      </article>
    </body>
  </local:instrument>

  <!-- 2. A regulation. The Planning Board adopted it under MGL c. 41 and can amend it on its own
       vote, which is the fact a published code records only as a sentence of English. -->
  <local:instrument type="regulation" eId="chp_a676">
    <local:adoption>
      <local:body role="administrative" refersTo="#org_planning_board">Planning Board</local:body>
      <local:authority href="/us-ma/act/mgl/41/81Q">MGL c. 41, § 81Q</local:authority>
      <local:procedure amendedBy="board-vote" hearing="required" majority="simple"/>
      <local:date date="1970-06-25" type="adoption"/>
    </local:adoption>
    <meta>
      <identification source="#communityscale">
        <FRBRWork>
          <FRBRthis value="/us-ma/sherborn/regulation/subdivision/!main"/>
          <FRBRuri value="/us-ma/sherborn/regulation/subdivision"/>
          <FRBRdate date="1970-06-25" name="adoption"/>
          <FRBRauthor href="#org_planning_board" as="#author"/>
          <FRBRcountry value="us-ma"/>
          <FRBRsubtype value="regulation"/>
        </FRBRWork>
        <FRBRExpression>
          <FRBRthis value="/us-ma/sherborn/regulation/subdivision/eng@2026-04-23/!main"/>
          <FRBRuri value="/us-ma/sherborn/regulation/subdivision/eng@2026-04-23"/>
          <FRBRdate date="2026-04-23" name="codeDate"/>
          <FRBRauthor href="#communityscale" as="#editor"/>
          <FRBRlanguage language="eng"/>
        </FRBRExpression>
      </identification>
    </meta>

    <num>A676</num>
    <heading>Rules and Regulations Governing the Subdivision of Land</heading>

    <local:editorialNote>
      <p>Published in the Code for convenience. These are regulations of the Planning Board and
      are not bylaws; they take effect on filing with the Town Clerk.</p>
    </local:editorialNote>

    <body>
      <section eId="sec_a676-1">
        <num>A676-1</num>
        <heading>Purpose</heading>
        <content>
          <p>These rules govern the subdivision of land in the Town under
          <ref href="/us-ma/act/mgl/41/81Q">MGL c. 41, § 81Q</ref>.</p>
        </content>
      </section>
      <section eId="sec_a676-2" local:disposition="reserved" local:inForce="false">
        <num>A676-2</num>
        <heading>(Reserved)</heading>
        <content><p/></content>
      </section>

      <!-- One heading standing for a block of numbers, which is how the second publisher
           reserves them: 7,884 such ranges across 152,931 section numbers, in 70% of its
           codes. A citation to A676-7 resolves here, so a reader chasing it is told the
           number is deliberately empty rather than missing. -->
      <section eId="sec_a676-3_thru_a676-10" local:disposition="reserved" local:inForce="false"
               local:coversFrom="A676-3" local:coversTo="A676-10">
        <num>A676-3—A676-10</num>
        <heading>Reserved</heading>
        <content><p/></content>
      </section>

      <!-- Depth past Akoma Ntoso's fifth rung. The first five have elements of their own;
           beyond that the rung is an hcontainer carrying the depth, so two different
           depths do not collapse into one repeated element. -->
      <section eId="sec_a676-11">
        <num>A676-11</num>
        <heading>Plan requirements</heading>
        <subsection eId="sec_a676-11__subsec_a">
          <num>A.</num>
          <paragraph eId="sec_a676-11__subsec_a__para_1">
            <num>(1)</num>
            <subparagraph eId="sec_a676-11__subsec_a__para_1__subpara_a">
              <num>(a)</num>
              <point eId="sec_a676-11__subsec_a__para_1__subpara_a__point_1">
                <num>[1]</num>
                <indent eId="sec_a676-11__subsec_a__para_1__subpara_a__point_1__indent_a">
                  <num>[a]</num>
                  <hcontainer name="level" local:depth="6"
                              eId="sec_a676-11__subsec_a__para_1__subpara_a__point_1__indent_a__level_i">
                    <num>i.</num>
                    <content><p>The location of every existing monument.</p></content>
                  </hcontainer>
                </indent>
              </point>
            </subparagraph>
          </paragraph>
        </subsection>
      </section>
    </body>
  </local:instrument>
</local:code>
