W3C home > Mailing lists > Public > public-rdf-in-xhtml-tf@w3.org > November 2007

Re: @about/@instanceof discussion

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Thu, 01 Nov 2007 10:32:21 -0400
Message-ID: <4729E375.3010301@digitalbazaar.com>
To: RDFa mailing list <public-rdf-in-xhtml-tf@w3.org>

Ben Adida wrote:
> Here's an important use case that I think would not be easily
> expressible in RDFa if we go with the approach you're proposing:
> <#me> foaf:knows [a foaf:Person ; foaf:name "Ralph"] .
> which, in English, is "I know a person named Ralph."
> If you have @instanceof always applying to the subject, then it's really
> difficult to every use it to declare a type on the chaining node.
> So, the question is, how would you do the above?

<div about="#me" rel="foaf:knows" resource="#ralph">
   <span about="#ralph" instanceof="foaf:Person"

or you could do this:

<div about="#me" rel="foaf:knows">
   <span about="#ralph" instanceof="foaf:Person"

which should generate:

<#me> foaf:knows <#ralph>.
<#ralph> a foaf:Person;
         foaf:name "Ralph".

I agree that it is not as clean as what you're proposing :), however,
the cognitive load on what publishers have to remember about RDFa's
processing rules is greatly reduced with this approach. It is no
different than how they write XHTML, and since we're dealing with RDF in
XHTML, we should use the same authoring semantics, right?

> In my mind, @instanceof should apply first to the @resource on an
> element, and only when there is no @resource, to @about.

Another way of stating this is that there are RDFa attributes that apply
to the current node:


and there are attributes that apply to only the child nodes (via chaining):


Parsing rules like "@instanceof should apply first to the @resource on
an element, and only when there is no @resource, to @about." are very
difficult to recall because there are several special cases that we have
to remember when we approach the problem like that. What's easier to
remember is:

RDFa attributes always take effect on the current node and have the
following order of precedence:

1. @about       [Set the Subject]
2. @instanceof  [Set the Subject Type]
3. @rel/@rev    [Set the Predicate]
4. @property    [Set the Predicate]
5. @resource    [Set the Object or Subject if there is no active @about]
6. @href        [Set the Object]
7. @src         [Set the Object]
8. @content     [Set the Object]
9. @datatype    [Set the Object Data Type]

The rule above is the only one we need and it is something that can be
distilled quite easily and placed onto a cheat sheet. It is easy to
understand and remember.

> <div about="#me" rel="foaf:knows" instanceof="foaf:Person">
>   <span property="foaf:name">Ralph</span>
> </div>

If we add a rule stating that @instanceof creates a new bnode if it
isn't paired with @about (we we already have that rule?), then we could
do the following:

<div about="#me" rel="foaf:knows">
   <span instanceof="foaf:Person" property="foaf:name">Ralph</span>

which would generate the following triples:

<#me> foaf:knows <_:bn0>.
<_:bn0> a foaf:Person;
        foaf:name "Ralph".

-- manu

Manu Sporny
President/CEO - Digital Bazaar, Inc.
blog: Bitmunk Launches World's First Open Music Recommendation Service
Received on Thursday, 1 November 2007 14:33:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:15:17 GMT