Re: New syntax spec

 From: "Dave Beckett" <>

> 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?


<schema xmlns=" ">
     <title>RDF </title>

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

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

      <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 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 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 id="rdf-error" context="rdf:*">
             <report test="true">The only elements in the RDF namespace are RDF and Description         

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

<!-- 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>


Received on Thursday, 13 September 2001 11:09:37 UTC