<schema xml:lang="en" schemaVersion="2001/06/16" xmlns="http://www.ascc.net/xml/schematron" >
     <title>Resource Description Framework (RDF and RDFS) in XML</title>
     <ns prefix="rdf" uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
     <ns prefix="rdfs" uri="http://www.w3.org/2000/01/rdf-schema#"/>
     <p> Copyright (c) 2001 Rick Jelliffe, Topologi Pty/ Ltd </p>
     <p> </p>
     <p>The Resource Description Framework is the cornerstone of the W3C's Semantic Web Activity. This schema gives some constraints for XML data validation purposes. </p>
     <p>RDF has four anti-standard behaviours, due doubtlessly to the lack of discipline using a schema language would have bought.</p>
     <p>First, it supports an open-ended number of attributes in the abbreviated syntax, rdf:_1 to rdf:_n.</p>
     <p>Second, it does not follow the usual rules for namespaces, so that if <rdf:* xxx="..."> if assumes we can also go <y:z rdf:xxx="..."></p>
     <p>Third, capitalization rules are difficult to remember, and, even when you can, frequently examples get them wrong.</p>
     <p>Fourth, the not all RDF namespace elements are defined in the RDF document, but crop up in the RDFS document. These include rdf:Property. </p>
     <p>All in all, the current RDF Recommendation is utterly unsatisfactory, and needs to be revised soon. All that being said, there is some good tutorial material, and if everyone tries to follow standards, it may work interoperably one day. </p>
     <phase id="Namespaces">
          <active pattern="Namespace"/>
     </phase>
     <phase id="RDF">
          <active pattern="RDF"/>
     </phase>
     <pattern name="Namespace">
          <rule context="rdf | RDF">
               <report test="1=1" diagnostics="fixRdfNs">A
                    <name/> element should be in the RDF Namespace.
               </report>
          </rule>
          <rule context="rdf:rdf | rdf:bag | rdf:BAG | rdf:alt | rdf:ALT | rdf:seq | rdf:SEQ | rdf:description | rdf:DESCRIPTION | rdf:Li | rdf:LI | rdf:Subject | rdf:SUBJECT | rdf:Predicate | rdf:PREDICATE | rdf:Object | rdf:OBJECT | rdf:Type | rdf:TYPE | rdf:Value | rdf:VALUE | rdf:property | rdf:PROPERTY ">
               <report test="1=1" diagnostics="checkSpelling">The element
                    <name/> is not the correct capitalization. XML is case-sensitive.
               </report>
          </rule>
          <rule context="rdfs:class | rdfs:CLASS | rdfs:Label | rdfs:LABEL | rdfs:Comment | rdfs:COMMENT | rdfs:Range | rdfs:RANGE | rdfs:Domain | rdfs:DOMAIN | rdfs:subpropertyof | rdfs:SUBPROPERTYOF | rdfs:subclassof | rdfs:SUBCLASSOF | rdfs:seealso | rdfs:SEEALSO | rdfs:isdefinedby | rdfs:ISDEFINEDBY | rdfs:contraintresource | rdfs:CONSTRAINTRESOURCE | rdfs:constraintproperty | rdfs:CONSTRAINPROPERTY | rdfs:resource | rdfs:RESOURCE ">
               <report test="1=1" diagnostics="checkSpelling">The element
                    <name/> is not the correct capitalization. XML is case-sensitive.
               </report>
          </rule>
     </pattern>
     <pattern name="RDF" see="http://www.w3.org/TR/REC-rdf-syntax/">
          <rule context="rdf:Description | rdf:RDF/rdf:* ">
               <assert test="@ID or @about or @rdf:ID or @rdf:about">A
                    <name/> element must have an ID or an about attribute.
               </assert>
          </rule>
          <rule context="rdf:RDF/* ">
               <assert test="@rdf:ID or @rdf:about">A
                    <name/> element must have an rdf:ID or an rdf:about attribute.
               </assert>
          </rule>
          <rule context="rdf:Bag | rdf:Seq | rdf:Alt">
               <assert test="count(*) = count(rdf:li )">The
                    <name/> element can only have children rdf:li (in the full syntax).
               </assert>
               <report test="self::*[@rdf:_1][rdf:li]">The
                    <name/> element should use only the abbreviated syntax or the full syntax but not both.
               </report>
          </rule>
          <rule context="rdf:Bag/*[@parseType or @rdf:parseType] | rdf:Seq/*[@parseType or @rdf:parseType] | rdf:Alt/*[@parseType or @rdf:parseType] | rdf:Property[@parseType or @rdf:parseType] ">
               <assert test="* or @resource or @rdf:resource">A property element such as
                    <name/> must either contain its resource or give them in a resource rdf:resource) attribute.
               </assert>
               <report test="self::*[@parseType='resource' or @parseType='literal' or @parseType='RESOURCE' or @parseType='LITERAL' or @rdf:parseType='resource' or @rdf:parseType='literal' or @rdf:parseType='RESOURCE' or @rdf:parseType='LITERAL' ]" diagnostics="checkSpelling">The parseType attribute of an rdf:li in a
                    <name/> should be either 'Literal' or 'Resource'.
               </report>
               <assert test="* or @resource or @rdf:resource">A property element such as
                    <name/> must either contain its resource or give them in a resource rdf:resource) attribute.
               </assert>
               <assert test="self::*[@parseType='Resource' or @parseType='Literal' or @rdf:parseType='Resource' or @rdf:parseType='Literal' ]">The parseType attribute of an rdf:li in a
                    <name/> should be either 'Literal' or 'Resource'.
               </assert>
               <assert test="self::*[@parseType='Resource' or @rdf:parseType='Resource'] or self::*/*">If the parseType attribute is 'Literal', the
                    <name/> element should not contain child elements.
               </assert>
          </rule>
          <rule context="rdf:RDF/*/*[@parseType] | rdf:Description/*[@parseType] | rdf:subject[@parseType] | rdf:predicate[@parseType] | rdf:object[@parseType] | rdf:type[@parseType] | rdf:RDF/*/*[@rdf:parseType] | rdf:Description/*[@rdf:parseType] | rdf:subject[@rdf:parseType] | rdf:predicate[@rdf:parseType] | rdf:object[@rdf:parseType] | rdf:type[@rdf:parseType] ">
               <assert test="self::*[@parseType='Resource' or @parseType='Literal' or @rdf:parseType='Resource' or @rdf:parseType='Literal'] ">The parseType attribute in a
                    <name/> should be either 'Literal' or 'Resource'.
               </assert>
               <assert test="self::*[@parseType='Resource' or @rdf:parseType='Resource'][rdf:value or @rdf:value]">A property element with a parse-type of 'Resource' should have either an attribute or a sub-element rdf:value.</assert>
               <assert test="self::*[@parseType='Resource' or @rdf:parseType='Resource'] or self::*/*">If the parseType attribute is 'Literal', the
                    <name/> element should not contain child elements.
               </assert>
          </rule>
          <rule context="rdf:*[@parseType] | *[@rdf:parseType]">
               <report test="1=1">The attribute parseType cannot be used on a
                    <name/> element.
               </report>
          </rule>
     </pattern>
     <diagnostics>
          <diagnostic id="fixRdfNs">Add xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" to the element.</diagnostic>
          <diagnostic id="checkSpelling">Check the spelling and capitalization</diagnostic>
     </diagnostics>
</schema>