TEIC / atop

Another TEI ODD Processor
Other
9 stars 2 forks source link

Terminology: Self-contained schema specification #16

Open dmj opened 1 year ago

dmj commented 1 year ago

A self-contained schema specification is an ODD that does not contain references to external specification elements.

A self-contained schema should validate with the following Schematron:

<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt3"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <sch:title>Verify that a schema specification is self-contained</sch:title>
  <sch:ns prefix="tei" uri="http://www.tei-c.org/ns/1.0"/>
  <sch:ns prefix="atop" uri="http://www.tei-c.org/ns/atop"/>
  <xsl:key name="atop:classSpec" match="tei:classSpec" use="@ident"/>
  <xsl:key name="atop:dataSpec" match="tei:dataSpec" use="@ident"/>
  <xsl:key name="atop:elementSpec" match="tei:elementSpec" use="@ident"/>
  <xsl:key name="atop:macroSpec" match="tei:macroSpec" use="@ident"/>
  <sch:pattern>
    <sch:rule context="tei:schemaSpec">
      <sch:assert test="empty(tei:classRef)">
        A self-contained schema specification does not contain any classRef child elements.
      </sch:assert>
      <sch:assert test="empty(tei:dataRef)">
        A self-contained schema specification does not contain any dataRef child elements.
      </sch:assert>
      <sch:assert test="empty(tei:elementRef)">
        A self-contained schema specification does not contain any elementRef child elements.
      </sch:assert>
      <sch:assert test="empty(tei:macroRef)">
        A self-contained schema specification does not contain any macroRef child elements.
      </sch:assert>
      <sch:assert test="empty(tei:moduleRef)">
        A self-contained schema specification does not contain any moduleRef child elements.
      </sch:assert>
      <sch:assert test="empty(tei:specGrpRef)">
        A self-contained schema specification does not contain any specGrpRef child elements.
      </sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule context="tei:classRef">
      <sch:assert test="empty(@source) and key('atop:classSpec', @key, (ancestor::tei:schemaSpec, root())[1])">
        Every classRef element in a self-contained schema specification must resolve locally.
      </sch:assert>
    </sch:rule>
    <sch:rule context="tei:dataRef[@key]">
      <sch:assert test="empty(@source) and key('atop:dataSpec', @key, (ancestor::tei:schemaSpec, root())[1])">
        Every dataRef element in a self-contained schema specification must resolve locally.
      </sch:assert>
    </sch:rule>
    <sch:rule context="tei:elementRef">
      <sch:assert test="empty(@source) and key('atop:elementSpec', @key, (ancestor::tei:schemaSpec, root())[1])">
        Every elementRef element in a self-contained schema specification must resolve locally.
      </sch:assert>
    </sch:rule>
    <sch:rule context="tei:macroRef">
      <sch:assert test="empty(@source) and key('atop:macroSpec', @key, (ancestor::tei:schemaSpec, root())[1])">
        Every macroRef element in a self-contained schema specification must resolve locally.
      </sch:assert>
    </sch:rule>
    <sch:rule context="tei:attRef">
      <sch:assert test="empty(@source) and key('atop:classSpec', @class, (ancestor::tei:schemaSpec, root())[1])/tei:attList//tei:attDef[@ident = current()/@name]">
        Every dataRef element in a self-contained schema specification must resolve locally.
      </sch:assert>
    </sch:rule>
  </sch:pattern>
</sch:schema>
sydb commented 1 year ago

Although I have not (yet) gone through this in detail, on first glance seems quite reasonable to me.

martindholmes commented 6 months ago

@dmj We are wondering if this is actually right for <dataRef>; can <dataRef> not contain <dataFacet> at the PLODD stage?

martindholmes commented 2 months ago

@dmj: @sydb, @HelenaSabel and I can't tell what the difference is between a PLODD and a "self-contained schema specification". Is there a difference? Or does this ticket predate our decision on the PLODD nomenclature?

dmj commented 1 month ago

Sorry for the late reply. Every PLODD is a self-contained schema specification (i.e. does not contain references to external specification elements), but not every self-contained schema specification is a PLODD. "Self-contained" describes the schema specification with regards to it's use of references to schema specification elements. They all are local, refer to elements in the same tree (document).