<?xml version="1.0" encoding="UTF-8"?>
<!--
YADS - Schematron
This document describes YADS - A Description Service
in a Schematron Schema.
==
// From RDF Schema for YADS
Resource: doi:1014/yads-schema-2002-04-03
Comment: RDF Schema for YADS - A Description Service
Author: Tony Hammond <tony_hammond@harcourt.com>
Revision: April 3, 2002 - Tony Hammond
-->
<sch:schema xml:lang="en" xmlns:sch="http://www.ascc.net/xml/schematron">
<sch:title>Schematron Schema for YADS</sch:title>
<sch:ns prefix="yads" uri="http://dx.doi.org/1014/yads-schema-2002-04-03"/>
<sch:pattern see="http://dx.doi.org/1014/yads-schema-2002-04-03" name="YADS">
<!--
Toplevel wrapper element
~
-->
<sch:rule context="yads">
<sch:assert test="count(*) = count(item) + count(nest)"
diagnostics="collection"/>
</sch:rule>
<!--
Item element - collection OR resource, with properties.
~
-->
<sch:rule context="item">
<sch:assert test="count(*) = count(collection) + count(resource) + count(property)"
diagnostics="group"/>
<sch:assert test="(count(collection) = 1 and count(resource) = 0)
or (count(collection) = 0 and count(resource) = 1)"
diagnostics="item"/>
<sch:assert test="count(property[@type = 'access']) <= 1"
diagnostics="acess"/>
<sch:assert test="count(property[@type = 'detail']) <= 1"
diagnostics="detail"/>
<sch:assert test="count(property[@type = 'directive']) <= 1"
diagnostics="directive"/>
<sch:assert test="count(property[@type = 'label']) <= 1"
diagnostics="label"/>
<sch:assert test="count(property[@type = 'role']) <= 1"
diagnostics="role"/>
<sch:assert test="count(property[@type = 'service']) <= 1"
diagnostics="service"/>
<sch:assert test="count(property[@type = 'type']) <= 1"
diagnostics="type"/>
</sch:rule>
<!--
Nest element - collection AND resource, with properties.
~
-->
<sch:rule context="nest">
<sch:assert test="count(*) = count(collection) + count(resource) + count(property)"
diagnostics="group"/>
<sch:assert test="(count(collection) = 1 and count(resource) = 0)
or (count(collection) = 0 and count(resource) = 1)"
diagnostics="item"/>
<sch:assert test="count(property[@type = 'access']) <= 1"
diagnostics="acess"/>
<sch:assert test="count(property[@type = 'detail']) <= 1"
diagnostics="detail"/>
<sch:assert test="count(property[@type = 'directive']) <= 1"
diagnostics="directive"/>
<sch:assert test="count(property[@type = 'label']) <= 1"
diagnostics="label"/>
<sch:assert test="count(property[@type = 'role']) <= 1"
diagnostics="role"/>
<sch:assert test="count(property[@type = 'service']) <= 1"
diagnostics="service"/>
<sch:assert test="count(property[@type = 'type']) <= 1"
diagnostics="type"/>
</sch:rule>
<!--
Collection element - contains sequence of nest or item elements.
(An ordering attribute determines how the elements should be ordered.)
-->
<sch:rule context="collection">
<sch:assert test="count(*) = count(item) + count(nest)"
diagnostics="collection"/>
<!--
<sch:assert test="@ordering and not(normalize-space(@ordering) = 'choice')
and not(normalize-space(@ordering) = 'sequenced')
and not(normalize-space(@ordering) = 'unordered')"
diagnostics="ordering"/>
-->
</sch:rule>
<!--
Resource element
~
-->
<sch:rule context="resource">
</sch:rule>
<!--
Property element
~
-->
<sch:rule context="property">
</sch:rule>
</sch:pattern>
<sch:diagnostics>
<sch:diagnostic id="group">
A <sch:name/> element should contain only the following child elements: <collection>,
<resource>, <property>.
</sch:diagnostic>
<sch:diagnostic id="item">
A <sch:name/> element must have one <collection> child element or one <resource> child element.
</sch:diagnostic>
<sch:diagnostic id="nest">
A <sch:name/> element must have one <collection> child element or one <resource> child element.
</sch:diagnostic>
<sch:diagnostic id="collection">
A <sch:name/> element should contain only the following elements: <item>, <nest>.
</sch:diagnostic>
<sch:diagnostic id="ordering">
An "ordering" attribute on a <sch:name/> element should contain only the following values:
"choice", "sequenced", "unordered".
</sch:diagnostic>
<sch:diagnostic id="access">
A <sch:name/> element may only have one <property> child element with type attribute "access".
</sch:diagnostic>
<sch:diagnostic id="detail">
A <sch:name/> element may only have one <property> child element with type attribute "detail".
</sch:diagnostic>
<sch:diagnostic id="directive">
A <sch:name/> element may only have one <property> child element with type attribute "directive".
</sch:diagnostic>
<sch:diagnostic id="label">
A <sch:name/> element may only have one <property> child element with type attribute "label".
</sch:diagnostic>
<sch:diagnostic id="role">
A <sch:name/> element may only have one <property> child element with type attribute "role".
</sch:diagnostic>
<sch:diagnostic id="service">
A <sch:name/> element may only have one <property> child element with type attribute "service".
</sch:diagnostic>
<sch:diagnostic id="type">
A <sch:name/> element may only have one <property> child element with type attribute "type".
</sch:diagnostic>
</sch:diagnostics>
</sch:schema>
|