W3C home > Mailing lists > Public > www-rdf-comments@w3.org > July to September 2001

Re: New syntax spec

From: Rick Jelliffe <ricko@allette.com.au>
Date: Fri, 14 Sep 2001 01:15:34 +1000
Message-ID: <009f01c13c66$ef94c640$4bc8a8c0@AlletteSystems.com>
To: "www-rdf-comments" <www-rdf-comments@w3.org>
 From: "Dave Beckett" <dave.beckett@bristol.ac.uk>

> I was wondering if pattern-matching technologies such as schematron
> would have a lot of problems with RDF's XML syntax since some of the
> allowed things depend on the context (node or property) which can't
> be determined without considering the containing XML elements etc.

At the end I have the new Schematron  schema in progress. I think it
will cope with the contexts of RDF.  If anyone
can check that the rules are OK, I would appreciate it. I am trying
to capture the infoset rather than just the simple validation rules.
The key to reading the schema is to remember that a pattern is
a big if-then-else list.

B.t.w. why is the production "literal" needed?  It says it is non-empty 
but then parseLiteral allows list().  Why just make literal be 
any string including the empty string?

Also, I am confused. I thought the RDF WG had made rdf:_n elements,
but even the 6.31 attributes are removed. Is that correct?

Cheers
Rick

<schema xmlns="http://www.asc.net/xml/schematron ">
     <title>RDF </title>

   <pattern>
      <rule id="top" context="rdf:RDF">
          <assert test="count(ancestor::*) =0">The rdf:RDF element can only appear at the top-level
           </assert>
          <report test="@rdf:*">An rdf:* attribute cannot go on rdf:RDF.</report>
      </rule>

     <rule id="obsolete" context="rdf:Bag | rdf:Set | rdf:Alt ">
        <report test="true">The Bag, Set and Alt elements are obsolete.</report>
     </rule>

      <rule id="otherElements" context="*[ancestor::*[@rdf:parseType="parseOther"]]">
           <report test="rdf:* or *[@rdf:*]">Any rdf elements or attributes inside a parseOther section
            are not significant to the RDF document as rdf markup.</report> 
      </rule>

      <rule id="descriptionElement" context="/* |  /rdf:RDF/* | *[not(@parseType)]/*">
              <assert test="true">A description element can appear at the top-level,
              as the child of rdf:RDF, or the child of a property element with no parseType.
               An rdf:Description is a description. A description can contain property elements.</assert>
              <assert test="@rdf:resource or @rdf:parseType"
                >Only property elements can have resource attributes or parseTypes</assert>
      </rule>

      <rule id="propertyElement" context="/*/* | /rdf:RDF/*/* | rdf:Description/* | *[not@parseType]/*/*
          | *[string-normalize(@parseType)='Resource']/*  ">
            <assert test="true">A property element appears as the child of a description element
                 or the child of an element with parseType of "Resource"</assert>
          <report test="rdf:bagID">A property element should not have any bagIDs.</report>
          <report test="??">A property element should not have any property attributes.</report>
          <report test="self::rdf:Description">An rdf:Description element cannot appear where
           a property element is expected.</report>
      </rule>

      <rule id="rdf-error" context="rdf:*">
             <report test="true">The only elements in the RDF namespace are RDF and Description         
            </report> 
      </rule>

      <rule id="error" context="*">
             <report test="true">This element is incorrect.</report> 
      </rule>
    </pattern>

<!-- To do -->
   <pattern name="attributes" context="??">


      <assert test="">The rdf:ID attribute should have unique token values in a document.</assert?
      <assert test="">The rdf:bagID attribute should have unique token values in a document.</assert>
      <assert test="">A element should only have one about, aboutEach or ID or resource attribute.</assert>
      <assert test="">The only attributes in the RDF namespace are ID, about, aboutEach, bagID,
        type, resource, parseType, and rdf:_*.</assert>
  </pattern>

</schema>
Received on Thursday, 13 September 2001 11:09:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 21 September 2012 14:16:28 GMT