YADS Model Schema - XCSL


This is the XCSL schema for the YADS model.


  <?xml version="1.0" encoding="UTF-8"?>
  <!--
  
    YADS - XCSL
  
    This document describes YADS - A Description Service
    in a XCSL 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
  

  
  -->
  
  <CS>
  
  <!--
    Toplevel wrapper element
    ~
  -->
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads"/>
    <CC>
      count(*) = count(item) + count(nest)
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element should contain only the following child elements: <item>, <nest>. 
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <!--
    Item element - collection OR resource, with properties.
    ~
  -->
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      count(*) = count(collection) + count(resource) + count(property)
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element should contain only the following child elements: <collection>, <resource>, <property>. 
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      (count(collection) = 1 and count(resource) = 0)
      or
      (count(collection) = 0 and count(resource) = 1)
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element must have one <collection> child element or one <resource> child element.
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      count(property[@type = 'access']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "access".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      count(property[@type = 'detail']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "detail".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      count(property[@type = 'directive']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "directive".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      count(property[@type = 'label']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "label".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      count(property[@type = 'role']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "role".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      count(property[@type = 'service']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "service".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//item"/>
    <CC>
      count(property[@type = 'type']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "type".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <!--
    Nest element - collection AND resource, with properties.
    ~
  -->
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      count(*) = count(collection) + count(resource) + count(property)
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element should contain only the following child elements: <collection>, <resource>, <property>. 
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      (count(collection) = 1 and count(resource) = 1)
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element must have one <collection> child element and one <resource> child element.
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      count(property[@type = 'access']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "access".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      count(property[@type = 'detail']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "detail".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      count(property[@type = 'directive']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "directive".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      count(property[@type = 'label']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "label".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      count(property[@type = 'role']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "role".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      count(property[@type = 'service']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "service".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//nest"/>
    <CC>
      count(property[@type = 'type']) <= 1
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element may only have one <property> child element with type attribute "type".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <!--
    Collection element - contains sequence of nest or item elements.
    (An ordering attribute determines how the elements should be ordered.)
  -->
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//collection"/>
    <CC>
      count(*) = count(item) + count(nest)
    </CC>
    <ACTION>
      <MESSAGE>
        A <VALUE SELEXP="name(.)"/> element should contain only the following child elements: <item>, <nest>. 
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <!--
  <CONSTRAINT>
   <SELECTOR SELEXP="//yads//collection"/>
    <CC>
      @ordering and not(normalize-space(@ordering) = 'choice')
      and not(normalize-space(@ordering) = 'sequenced')
      and not(normalize-space(@ordering) = 'unordered')">
    </CC>
    <ACTION>
      <MESSAGE>
        An "ordering" attribute on a <VALUE SELEXP="name(.)"/> should contain only the following values: "choice", "sequenced", "unordered".
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  -->
  
  <!--
    Resource element
    ~
  -->
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//resource"/>
    <CC>
    </CC>
    <ACTION>
      <MESSAGE>
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  <!--
    Property element
    ~
  -->
  <CONSTRAINT>
    <SELECTOR SELEXP="//yads//property"/>
    <CC>
    </CC>
    <ACTION>
      <MESSAGE>
      </MESSAGE>
    </ACTION>
  </CONSTRAINT>
  
  </CS>