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

Re: telecon Thursday, 1600 UTC

From: Ben Adida <ben@adida.net>
Date: Sat, 22 Dec 2007 10:37:30 -0800
Message-ID: <476D596A.5070307@adida.net>
To: Ivan Herman <ivan@w3.org>
CC: Manu Sporny <msporny@digitalbazaar.com>, RDFa <public-rdf-in-xhtml-tf@w3.org>

Ivan Herman wrote:
> All your explanation make sense indeed, and resembles my 'mental' model
> (that I would favour) that @instanceof is no more and no less than an
> abbreviated form of <..rel="rdf:type" resource="THE_URI_OF_THE_TYPE">

Not quite... because @instanceof really is *on* an element, I don't
think it can ever really apply to something that's inherited. That's the
difference. That's why it "creates a new bnode."

In fact, if there is no @about or @src on the element where @instanceof
is present, there is *always* a new bnode corresponding to that element.
It might complete a hanging @rel, but that's orthogonal.

> _If_ I use explicit rdf:type, and take:

Yes, that's not quite the same thing, because @rel inherits from above,
whereas @instanceof does not, it determines its subject entirely
locally, and that subject may happen to complete a hanging @rel.

> This was the new feature brought in by Mark, in fact; ie, this effect of
> 'merging' blank nodes that I did not like:-).

Don't think of it as merging blank nodes. It's more "if there is a
hanging rel and no node is created to complete it, then a blank node
takes is inserted to chain with additional properties."

> However, if I use @instanceof instead:
> <div about="#a" rel="some:thing">
>    <div @instanceof="a:type">
>       <span property="a:p">Bla</span>
>    </div>
>    <div @instanceof="another:type">
>       <span property="another:p">Bla again</span>
>    </div>
> </div>
> then I seem to get (eg, in Ben's example a while ago)
> <#a> some:thing [
>         rdf:type  a:type;
>         a:p       "Bla"
>      ];
>      [
>         rdf:type  another:type;
>         another:p "Bla again"
>      ].
> Because, _in some cases_, @instanceof creates a new blank node and
> _that_ is used to fill in the hanging rel from the parent.

I agree with the above markup and triples, but it's not really a special
case, see below.

> On the other hand, if I have
> <div about="#a">
>    <div @instanceof="a:type">
>       <span property="a:p">Bla</span>
>    </div>
>    <div @instanceof="another:type">
>       <span property="another:p">Bla again</span>
>    </div>
> </div>
> (Note the missing @rel on the top!). I presume what I would/should get is:
> <#a>
>         rdf:type  a:type;
>         a:p       "Bla";
>         rdf:type  another:type;
>         another:p "Bla again" .

No, I don't think so. The subject of @instanceof is entirely determined
using local information on that element. You can look at the <div> and
from that <div> know exactly the subject of @instanceof. So, in the case
above, you would indeed get the triples you thought you weren't getting:

> [
>   rdf:type  a:type;
>   a:p       "Bla"
> ].
> [
>   rdf:type  another:type;
>   another:p "Bla again"
> ].

So let's look at the rules to see where we disagree:

> Let me try to answer this question myself, maybe I get the essence of
> what you guys have in mind. So here we go:
>  - _If_
>       @instanceof is (almost) the _only_ RDFa related property of
>       an element (ie, no @about, @src, @property, @rel, @rev, though
>       @resource and @href are probably allowed for this step)
>      _and_
>       The parent node has hanging rel-s
>      _then_
>       create a new BNode and assign that to:
>         1. values of the hanging rels in the parent
>         2. subject of the rdf:type
>         3. assign this as new local subject for, eg, @property as
>            well as for all descendents
>  - _Otherwise_
>       follow the rules established for @rel for hanging rels,
>       subject for rdf:type, subject for possible @property,
>       descendents, etc.

This is more complicated than it needs to be, in particular whether
there is a hanging rel or not does not affect the parsing of
@instanceof. Here's how I would write the rule:

  The subject of @instanceof on element X is:
	- the value of @about if @about exists on X, _otherwise_
	- the value of @src if @src exists on X, _otherwise_
	- a new blank node corresponding to element X

  In all cases:
	- the subject of @instanceof may complete hanging @rel's just like any
other subject declaration does, _and_
	- the subject of @instanceof becomes the inherited subject for child
elements, _and_
	- the subject of @instanceof is also the subject for @rel, @property
(and the object for @rev) when those attributes are present on X.

In your mental model, there is basically only one thing missing:
@instanceof is syntactic sugar for @rel="rdf:type" _but_ with an
explicit setting of @about to a new bnode if there is no other explicit

Hopefully, that makes you happier :)

Received on Saturday, 22 December 2007 18:37:47 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:25 UTC