Re: Really Simple Validation

Randy Charles Morin has been putting together a Schematron-based
validator [0], aiming to cover all common syndication formats. A
specific issue  has come up relating to the use of modules, and what
is valid as an attribute for a property. I'll try and answer based on
RDF/XML Syntax [1], corrections appreciated.

(The RSS 1.0 spec itself points to Leigh Dodds' Schematron Schema [2]
and validator for RSS 1.0, though my guess is that this precedes the
newer RDF/XML Syntax specs - Leigh?)

Randy asked (please forgive the unauthorised quotation):

> I see where other people are also using rdf:resource, including spots
> in the spec. Is it that Dublin Core RDF/XML allows for just the
> xml:lang and rdf:resource attribute or is any attribute in play?

I think these are the ones that cover 99% of the time, but there are others.

In general I believe you can also add xml:space, rdf:parseType,
rdf:datatype and rdf:ID to the list of possible attributes. (This
applies to any properties, not just those of Dublin Core).

Anything else?

An example of the RDF/XML angle is the material generated by the FOAF
output plugin [4] -
 
<dc:subject rdf:resource="http://dannyayers.com/archives/author/site-admin/skos.rdf#c1"/>

xml:lang comes as part of XML [3], along with xml:space.

I'll try and enumerate the other legal variations of RDF/XML that
might crop up around something like dc:subject, please tell me what I
missed.

Ok, so dc:subject is an rdf:Property (from the DC RDF Schema [5]), 
and to fit in with RDF it must come between a subject resource and an
object literal or resource. That can happen in RDF/XML as:

1. Simple literals - the usual RSS case

<something rdf:about="http://blah.org">
    <dc:subject>Stuff</dc:subject>
</something>

subject=http://blah.org
object="Stuff"

2. RDF resource - the FOAF Output case, adds an rdf:resource attribute
to the property element

<something rdf:about="http://blah.org">
   <dc:subject rdf:resource="http://wwwww.org"/>
</something>

subject=http://blah.org
object=http://wwwww.org

(<something> might not have a URI, i.e. be a blank node)

I believe the following may lead to there being other XML attributes
in dc:subject, but (IMHO) are unlikely to appear in RSS:

3. Abbreviated form, dc:subject as attribute

<something rdf:about="http://blah.org" dc:subject="Stuff" />

subject=http://blah.org
object="Stuff"

4. Typed literals - adds an rdf:datatype attribute to the property element

<something rdf:about="http://blah.org">
    <dc:subject
rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Stuff</dc:subject>
</something>

subject=http://blah.org
object="Stuff"

5. Nested resources (there's an example of this in the Modules [6]
part of the RSS 1.0 spec)

<something>
   <dc:subject>
       <foaf:Document rdf:about="http://yaddayadda.org">
...
       </foaf:Document>
   </dc:subject>
</something>

6. Nested blank node 

<something>
   <dc:subject>
       <foaf:Document>
...
       </foaf:Document>
   </dc:subject>
</something>


7. Omitted blank node - adds an rdf:parseType attribute to the property element

<something>
   <dc:subject  rdf:parseType="Resource">
       <foaf:Document>
...
       </foaf:Document>
   </dc:subject>
</something>

8. XML Literal - adds an rdf:parseType attribute to the property element

<something>
   <dc:subject  rdf:parseType="Literal" xmlns:xhtml="http://wherever-it-is">
       <xhtml:p>
...
       </xhtml:p>
   </dc:subject>
</something>

9. Collection - adds an rdf:parseType attribute to the property element

<something>
   <dc:subject  rdf:parseType="Collection" >
      <foaf:Person><foaf:name>Tom</foaf:name></foaf:Person>
      <foaf:Person><foaf:name>Dick</foaf:name></foaf:Person>
      <foaf:Person><foaf:name>Harry</foaf:name></foaf:Person>
   </dc:subject>
</something>

10. Reified statement - adds an rdf:ID attribute to the property element

<something>
   <dc:subject rdf:ID="http://a-reference-to-this-node-elsewhere.org">Stuff</dc:subject>
</something>

I *think* that's it ;-)

On the meta-issue of validating RD/XML, I reckon danbri's "Missing
isn't broken" [7] is a good read...

Cheers,
Danny.

(blogged at http://dannyayers.com/archives/2004/11/16/rss-10-module-attributes/)

[0] http://www.kbcafe.com/rss/?guid=20041030111147
[1] http://www.w3.org/TR/rdf-syntax-grammar
[2] http://www.ldodds.com/rss_validator/1.0/
[3] http://www.w3.org/TR/REC-xml/
[4] http://www.wasab.dk/morten/blog/archives/2004/07/05/wordpress-plugin-foaf-output
[5] http://purl.org/dc/elements/1.1/
[6] http://web.resource.org/rss/1.0/modules/
[7] http://rdfweb.org/mt/foaflog/archives/000047.html

-- 

http://dannyayers.com

Received on Tuesday, 16 November 2004 11:43:58 UTC