Re: N3 syntax in XHTML 2 [was RE: DC in XHTML2]

Mark Birbeck wrote:
> Hi Sjoerd,
> 
>>I think actually using N3, instead of a solution based on N3, 
>>has some extra advantages.
>>
>>First, it allows you to use the full power of RDF in HTML. Take f.e. 
>>collections, which would become a big mess of link and/or 
>>meta elements with the current attributes.
> 
> I hope not! There are some abbreviated forms of the syntax that should work.
> Feel free to post some examples of what you are thinking of, so that we can
> see whether XHTML 2 works for them.

I might have missed some syntax, but this is what I was thinking of:

In N3:

#a some:prop (#b #c #d)

could be with N3 in XHTML2:

<meta about="#a" property="some:prop" resource="(#b #c #d)" />

but now is (I think)

<link about="#a" rel="some:prop" href="#l1" />
<link about="#l1">
   <link rel="rdf:type"
     href="http://www.w3.org/1999/02/22-rdf-syntax-ns#List" />
   <link rel="rdf:first" href="#b" />
   <link rel="rdf:rest" href="#l2" />
</link>
<link about="#l2">
   <link rel="rdf:type"
     href="http://www.w3.org/1999/02/22-rdf-syntax-ns#List" />
   <link rel="rdf:first" href="#c" />
   <link rel="rdf:rest" href="#l3" />
</link>
<link about="#l3">
   <link rel="rdf:type"
     href="http://www.w3.org/1999/02/22-rdf-syntax-ns#List" />
   <link rel="rdf:first" href="#d" />
   <link rel="rdf:rest"
     href="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" />
</link>

Although now I'm thinking that while N3 is nice, with collection you'd 
probably want to do something with one of the list elements.

Or is the following already considered to generate all the triples?
<link about="#a" rel="some:prop" href="#l1" />
<ol id="l1">
   <li href="#b" />
   <li href="#c" />
   <li href="#d" />
</ol>

> So, I agree with you that N3 is great. However, I think it is wrong for
> XHTML 2, because the most important thing that has been done with XHTML 2 is
> to be clear about what the mark-up means *in terms of RDF*. External
> processors can now extract metadata from documents, regardless of how much
> or little of RDF an author has understood--and authors themselves can
> leverage their already existing understanding of HTML <meta>, <link> and
> <a>. Both sides of this equation are *crucial* for the much-delayed (and
> long overdue) Semantic Web.

Ok, good point.


> Anyway, just to finish the history part--because I don't want people to use
> the wrong syntax in XHTML 2--the syntax just described was not to last. A
> growing requirement of the XHTML 2 metadata story, as conveyed to us by the
> RDF-world was that the 'clickable links' should ideally provide metadata 'as
> is'. This meant that if an author marked up the following (this is a
> test-case that was provided to us):
> 
>   <p>
>     This document is licensed under a
>     <a rel="cc:license"
> href="http://creativecommons.org/licenses/by-sa/2.0/">
>         Creative Commons License
>     </a>
>     which, among other things, requires that you provide 
>     attribution to the author,
>     <a rel="dc:creator" href="http://ben.adida.net">Ben Adida</a>.
>   </p>
> 
> we would want it to say:
> 
>   <> cc:license <http://creativecommons.org/licenses/by-sa/2.0/>
>   <> dc:creator <http://ben.adida.net>
> 
> (For those not familiar with N3 the "<>" bit just means "the current
> document". These statements are about the current document, telling us about
> it's license and creator .)

<plug>
This is just too good an opportunity to plug a bit of technology of 
mine: RDF Extraction from XML (XR) http://w3future.com/xr/
Here is a profile for XHTML: http://w3future.com/tools/xhtml2rdf.xml
 From which you can produce a fail proof XSLT that always produces valid 
RDF/XML, great for GRDDL: 
http://w3future.com/tools/xr.pl?xr=http%3A%2F%2Fw3future.com%2Ftools%2Fxhtml2rdf.xml
</plug>

> At the time everyone said that this would be a 'nice to have', but the more
> we looked at it, the clearer it became that this actually would be the
> equivalent of the 'killer app' for XHTML 2 and metadata. In the latest draft
> [3], which is still N3-inspired, this mark-up would have resulted in the
> following triples, which would not have been of much use:
> 
>   _:a cc:license <http://creativecommons.org/licenses/by-sa/2.0/>
>   _:b dc:creator <http://ben.adida.net>
> 
> (To emphasise, the draft referred to is incorrect, and XHTML 2 now does what
> we need it to. Of course, like a big squidgy ball, when you push down on one
> side the other side pops up, and as a consequence of this change we now have
> a problem with anonymous nodes! Still...)

RDF/A is new for me. I only know this stuff from what I've seen in XHTML 
2. Is everything in RDF/A supposed to be in XHTML 2? At least I'm 
starting to understand it all more and more.
Two things in XHTML 2 that now strike me as odd:

 From http://www.w3.org/TR/xhtml2/mod-meta.html#sec_22.2.

   <meta property="dc:identifier">
       http://www.rfc-editor.org/rfc/rfc3236.txt
   </meta>

   might also be written:

   <link rel="dc:identifier"
       href="http://www.rfc-editor.org/rfc/rfc3236.txt" />

Isn't the first an XML Literal?

And from http://www.w3.org/TR/xhtml2/mod-metaAttributes.html#sec_23.4.

   <span content="2004-03-20">Tomorrow</span> the
   <span href="http://example.com/people/TonyBlair/1">Prime
   Minister</span>
   is expected to fly to ...

   Note that if no property is present then the example just given is
   equivalent to:

   <span property="reference"
     content="2004-03-20">
     Tomorrow
   </span>
   the <span property="reference"
     href="http://example.com/people/TonyBlair/1">
     Prime Minister
   </span>
   is expected to fly to ...

I think with an href attribute this should be rel="reference", not 
property="reference"?

Actually, with an href attribute, an extra default of 
property="rdfs:label" might be appropriate for the content?

>>...and it could improve the image of RDF.
> 
> Some would say that RDF/A and XHTML 2 are already improving the image of RDF
> ;)

Oh absolutely!

>>Thirdly, it will improve the chances of microformats using 
>>RDF. At some point, microformats will require more than some 
>>simple attributes, and someone will invent some syntax to put 
>>more information into one attribute. If full N3 is already 
>>available in XHTML2, it is likely that people will push to 
>>use the standard N3, instead of a proprietary syntax.
> 
> 
> I have to confess...and this is probably heresy!...but I don't have the same
> excitement about microformats as everyone else. I think they are far more
> limited than people think--they should be called siloformats--but that's
> another story. There's an odd trend at the moment, whereby anything that
> appears to arise spontaneously is be definition good, whilst anything that
> is the result of discussion, planning and committees is bad. Of course not
> everything planned is good (far from it), but equally not everything that
> cuts corners and consists of a few lines is good, either.

This doesn't sound like heresy, to me at least. (I sometimes think that 
XML is not elegant enough to express the good ideas resulting from 
discussion, planning and committees. The limits of XML make that 
spontaneous ideas are often good enough, and elaboration can only 
marginally improve upon the original idea.)

But isn't the limitedness of microformats exactly what adding N3 resolves?

-- 
Sjoerd Visscher
http://w3future.com/weblog/

Received on Saturday, 11 June 2005 00:15:16 UTC