Changeset 5350 for CMDIValidator


Ignore:
Timestamp:
06/12/14 07:49:28 (10 years ago)
Author:
Oliver Schonefeld
Message:
  • Add Menzo's Schematron rules to default.sch (Thanks!)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMDIValidator/trunk/cmdi-validator-core/src/main/resources/default.sch

    r5056 r5350  
    11<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
    22    <ns uri="http://www.clarin.eu/cmd/" prefix="cmd"/>
    3    
     3    <ns uri="http://www.w3.org/2001/XMLSchema-instance" prefix="xsi"/>
     4
    45    <pattern>
    56        <rule context="cmd:Header" role="warning">
    67            <assert test="string-length(cmd:MdProfile/text()) &gt; 0">
    7                 A CMDI instance should contain a non-empty &lt;cmd:MdProfile&gt; element in &lt;cmd:Header&gt;.
     8                [CMDI Best Practices] A CMDI instance should contain a non-empty &lt;cmd:MdProfile&gt; element in &lt;cmd:Header&gt;.
    89            </assert>
    910        </rule>   
     
    1718    </pattern>
    1819    -->
     20   
     21    <!--
     22        Rules contributed by Menzo Windhouwer <Menzo.Windhouwer@mpi.nl>
     23        Reformatted and assert messages slightly reworded
     24    -->
     25    <!-- Does the schema reside in the Component Registry? -->
     26    <pattern>
     27        <title>Test xsi:schemaLocation</title>
     28        <rule role="warning" context="/cmd:CMD">
     29            <assert test="contains(@xsi:schemaLocation,'http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/')">
     30                [CMDI Best Practice] /cmd:CMD/@xsi:schemaLocation doesn't refer to a schema from the Component Registry! [Actual value was [<value-of select="@xsi:schemaLocation"/>]
     31            </assert>
     32        </rule>
     33    </pattern>
     34   
     35    <!-- Is there at least one ResourceProxy? -->
     36    <pattern>
     37        <title>Test for ResourceProxies</title>
     38        <rule role="warning" context="/cmd:CMD/cmd:Resources/cmd:ResourceProxyList">
     39            <assert test="count(cmd:ResourceProxy) ge 1">
     40                [CMDI Best Practices] There should be at least one ResourceProxy! Otherwise this is the metadata of what? Itself?
     41            </assert>
     42        </rule>
     43    </pattern>
     44   
     45    <!-- Can we determine the profile used? -->
     46    <pattern>
     47        <title>Test for known profile</title>
     48        <rule role="warning" context="/cmd:CMD">
     49            <assert test="matches(@xsi:schemaLocation,'clarin.eu:cr[0-9]+:p_[0-9]+.+') or matches(cmd:Header/cmd:MdProfile,'clarin.eu:cr[0-9]+:p_[0-9]+.+')">
     50                [CMDI Best Practice] the CMD profile of this record can't be found in the /cmd:CMD/@xsi:schemaLocation or /cmd:CMD/cmd:Header/cmd:MdProfile. The profile should be known for the record to be processed properly in the CLARIN joint metadata domain!
     51            </assert>
     52        </rule>
     53    </pattern>
     54   
     55    <!-- Is the CMD namespace bound to a schema? -->
     56    <pattern>
     57        <title>Test for CMD namespace schema binding</title>
     58        <rule role="warning" context="/cmd:CMD">
     59            <assert test="matches(@xsi:schemaLocation,'http://www.clarin.eu/cmd/ ')">
     60                [possible CMDI Best Practice] is the CMD namespace properly bound to a profile schema?
     61            </assert>
     62        </rule>
     63    </pattern>
     64   
     65    <!-- Is the cmd:CMD root there? -->
     66    <pattern>
     67        <title>Test for cmd:CMD root</title>
     68        <rule role="warning" context="/">
     69            <assert test="exists(cmd:CMD)">
     70                [CMDI violation] is this really a CMD record? Is the namespace properly declared, e.g., including ending slash?
     71            </assert>
     72        </rule>
     73    </pattern>
     74   
    1975</schema>
Note: See TracChangeset for help on using the changeset viewer.