Re: validating parsable RDFa

Hi Tim,

On Jun 1, 2012, at 9:51 PM, Tim rdf wrote:

> public-lod,
> 
> Where's the best place to get some RDFa help?

A good place, other than LOD or SWIG is public-rdfa@w3.org. Many of us also hang out at #rdfa on irc.w3.org.

> While developing the HTML document for W3C's upcoming PROV-O
> recommendation, I'm trying to nibble on some dog food.
> 
> I've snuck some RDFa into [1], which encodes (among other stuff [2])
> the following triples according to pyRdfa [3]:
> 
> =======
> <http://dvcs.w3.org/hg/prov/raw-file/d53b5b7c1a32/ontology/Overview.html#inverse-names-592b37e4-ac61-11e1-b149-b6e4fd0676c2>
> a prov:Dictionary ;
>     prov:generatedAtTime "2012-06-02T03:16:30.563734"^^xsd:dateTime ;
>     prov:member
> <http://dvcs.w3.org/hg/prov/raw-file/d53b5b7c1a32/ontology/Overview.html#inverse-of-wasDerivedFrom>
> .
> 
> <http://dvcs.w3.org/hg/prov/raw-file/d53b5b7c1a32/ontology/Overview.html#inverse-of-wasDerivedFrom>
> a prov:KeyValuePair ;
>     prov:pairKey "http://www.w3.org/ns/prov#wasDerivedFrom" .
> =======
> 
> Which is dandy.
> Except that my document needs to pass W3C pub rules, one of which is
> passing http://validator.w3.org. [1] certainly does NOT pass (see the
> 55 errors at [4]).

You probably don't have the right DOCTYPE. Since you seem to be using ReSpec, you can get it to automatically output the right DOCTYPE, and get some other useful RDFa by adding the following to respecConfig:

doRDFa: "1.1"

To publish with RDFa 1.1, which will be at REC next week.

RDFa Core 1.1, does of course use RDFa markup in the source publication. Check out [5].

> So, my RDFa is pretty ugly. Really ugly.
> But I got it to work.
> 
> 
> 
> 
> Question)
> Can any RDFa ninjas out there show the way to a more eloquent RDFa
> encoding that actually validates?
> 
> 
> 
> 
> 
> The snippet of interest (and disgust) is from [1]:
> 
> <table about="#inverse-names-592b37e4-ac61-11e1-b149-b6e4fd0676c2"
>       xmlns:prov="http://www.w3.org/ns/prov#"
>       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>       xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
>       typeof="prov:Dictionary" class="inverse-names">
>  <span rel="prov:wasDerivedFrom"
> resource="http://www.w3.org/TR/prov-o/prov.owl"/>
>  <span rel="prov:wasTracedTo"
> resource="http://www.w3.org/TR/rdfa-syntax/#rdfa-attributes"/>
>  <span rel="prov:wasTracedTo"
> resource="http://data.semanticweb.org/person/alvaro-graves"/>
>  <span rel="prov:wasTracedTo"
> resource="http://tw.rpi.edu/instances/TimLebo"/>
>  <span rel="prov:specializationOf" resource="#inverse-names"><span
> rel="rdf:type" resource="http://www.w3.org/ns/prov#Dictionary"/></span>
>  <span property="prov:generatedAtTime"
> content="2012-06-02T03:16:30.563734" datatype="xsd:dateTime"/>
>  <caption>Names of inverses</caption>
>  <tr>
>    <th>PROV-O Property</th>
>    <th>Recommended inverse name</th>
>  </tr>
>  <span rel="prov:member">
>    <tr about="#inverse-of-member" typeof="prov:KeyValuePair">
>      <td property="prov:pairKey"
> content="http://www.w3.org/ns/prov#member"><a
> title="http://www.w3.org/ns/prov#member" href="#member"
> class="owlproperty">prov:member</a></td>
>      <td rel="prov:pairValue"><span typeof="prov:Entity"
> property="prov:value"
> content="inMembership">prov:inMembership</span></td>
>    </tr>
>  </span>

One nice thing about RDFa 1.1, is that many prefixes are provided by default, and you don't need to specify them inline. Also, you can avoid using @xmlns, and use @prefix instead.

Also, the content model for <table> doesn't allow you to use <span> immediately AFAIK.

Try the following markup:

<div resource="#inverse-names-592b37e4-ac61-11e1-b149-b6e4fd0676c2"
      prefix="prov: http://www.w3.org/ns/prov#"
      typeof="prov:Dictionary">
 <span property="prov:wasDerivedFrom" resource="http://www.w3.org/TR/prov-o/prov.owl"/>
 <span property="prov:wasTracedTo" resource="http://www.w3.org/TR/rdfa-syntax/#rdfa-attributes"/>
 <span property="prov:wasTracedTo" resource="http://data.semanticweb.org/person/alvaro-graves"/>
 <span property="prov:wasTracedTo" resource="http://tw.rpi.edu/instances/TimLebo"/>
 <span property="prov:specializationOf" resource="#inverse-names">
 <span property="rdf:type" resource="http://www.w3.org/ns/prov#Dictionary"/>
 <span property="prov:wasDerivedFrom" resource="http://www.w3.org/TR/prov-o/prov.owl"/>
 <span property="prov:generatedAtTime" content="2012-06-02T03:16:30.563734" datatype="xsd:dateTime"/>
 <table class="inverse-names">
  <caption>Names of inverses</caption>
  <tr>
   <th>PROV-O Property</th>
   <th>Recommended inverse name</th>
  </tr>
  <tr property="prov:member" resource="#inverse-of-member" typeof="prov:KeyValuePair">
   <td property="prov:pairKey" content="http://www.w3.org/ns/prov#member">
    <a title="http://www.w3.org/ns/prov#member" href="#member" class="owlproperty">
     prov:member
    </a>
   </td>
   <td property="prov:pairValue" typeof="prov:Entity">
    <span property="prov:value" content="inMembership">
     prov:inMembership
    </span>
   </td>
  </tr>
 </table>
</div>

In RDFa 1.1 you can typically use @property where you used to use @rel, and you can combine @property/@rel with @resource and/or @typeof to get the expected relationship without needing intermediary elements.

Gregg

> Thanks much!
> 
> Regards,
> Tim Lebo
> 
> [1] http://dvcs.w3.org/hg/prov/raw-file/d53b5b7c1a32/ontology/Overview.html
> [2] http://www.w3.org/2007/08/pyRdfa/extract?format=turtle&uri=http://dvcs.w3.org/hg/prov/raw-file/d53b5b7c1a32/ontology/Overview.html
> [3] http://www.w3.org/2007/08/pyRdfa/
> [4] http://validator.w3.org/check?uri=http%3A%2F%2Fdvcs.w3.org%2Fhg%2Fprov%2Fraw-file%2Fd53b5b7c1a32%2Fontology%2FOverview.html&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.3
[5] http://www.w3.org/2010/02/rdfa/sources/rdfa-core/Overview-src.html

Received on Saturday, 2 June 2012 06:26:21 UTC