Understanding 'chaining'

Hello all,

The following is a general explanation of 'chaining' which is  
important for the discussion on @instanceof. I know everyone is  
busy :) so if you don't feel the need to read it, don't! But the  
separate thread on the use of @instanceof with chaining assumes the  
approach to 'chaining' which is outlined here.

As it happens, the only major difference in terms of the  
specification is that in our current rules we don't support this  
scenario, which I suggest we should:

   <div about="#me" rel="foaf:knows">
     <div about="http://www.w3.org/People/Ivan/#me"
      property="foaf:name" content="Ivan Herman" />
   </div>

However, I do also explain the idea of 'alignment' which is something  
that helps in the @instanceof context.


CHAINING

The idea of chaining was to allow the object of one statement and the  
subject of another to 'match', making mark-up easier to write. For  
example, instead of writing this (where the object of the first  
statement is exactly the same as the subject of the second):

   <div about="#me"
    rel="foaf:knows" resource="http://www.w3.org/People/Ivan/#me" />

   <div about="http://www.w3.org/People/Ivan/#me"
    property="foaf:name" content="Ivan Herman" />

we can write this (where the subject of the second statement is set  
by the object of the first):

   <div
   about="#me"
   rel="foaf:knows" resource="http://www.w3.org/People/Ivan/#me"
  >
     <div property="foaf:name" content="Ivan Herman" />
   </div>

This is well understand by everyone, I think, and is already included  
in the current RDFa syntax document. However, the original principle  
of chaining also allowed for a couple of other ways of expressing the  
same thing.


MISSING OBJECT

One is this (where the subject of the second statement sets the  
object of the first):

   <div about="#me" rel="foaf:knows">
     <div about="http://www.w3.org/People/Ivan/#me"
      property="foaf:name" content="Ivan Herman" />
   </div>

This ability to use two different techniques shows why I called the  
whole thing chaining in the first place; it's like the links in a  
chain, where the end of one is the beginning of another. The *goal*  
was this:

   A predicate1 B predicate2 C predicate3 D ... etc.

For example:

   I know Ivan, who works for the W3C, which is based in Boston ... etc.

As you can see, looked at from the point of view of the statements,  
it doesn't matter whether B is set via @resource, @href, @about, or  
whatever. In other words, the following two 'patterns' are identical  
in _meaning_:

   <div about="A" rel="p1">
     <div about="B" rel="p2" resource="C" />
   </div>

   <div about="A" rel="p1" resource="B">
     <div rel="p2" resource="C" />
   </div>

I believe this to be an important foundation of RDFa, because if you  
have a number of ways of saying the same thing, you get the  
flexibility to mark statements up in a way that draws attention to  
whichever aspect of the hierarchy you want to promote (just like  
using a spoken language).

Also--and perhaps more importantly--by giving flexibility in the mark- 
up it means that you can simply 'drop in' objects from other  
documents or sources; if you have a number of different ways of  
expressing the same thing, then you can 'bend' your mark-up to  
accommodate the mark-up that you are incorporating.


ANONYMOUS NODES IN CHAINING

I said there were "a number" of ways of writing the same thing, and  
so far I've only given two:

   <div about="A" rel="p1">
     <div about="B" rel="p2" resource="C" />
   </div>

   <div about="A" rel="p1" resource="B">
     <div rel="p2" resource="C" />
   </div>

The final way of writing the same thing is in the case where you  
don't care what 'B' is, and so you can drop both the subject _and_  
the object from the middle:

   <div about="A" rel="p1">
     <div rel="p2" resource="C" />
   </div>

This still gives us the 'A predicate1 B predicate2 C predicate3 D'  
structure that we had before, but now we might have bnodes in the  
positions 'B', 'C', 'D'...or wherever we want.


SUBJECT/OBJECT ALIGNMENT

Now that we see what the desirable syntax is, we can have a look at  
what rules we are missing from RDFa syntax to make it possible. The  
key one is that @rel with no object should 'align' itself with the  
next subject, i.e., we are missing a rule for this scenario:

   <div about="A" rel="p1">
     <div about="B" rel="p2" resource="C" />
   </div>

Note that the other two permutations, both of which have no _subject_  
on the second statement, are already covered in RDFa, and look like  
this:

   <div about="A" rel="p1">
     <div rel="p2" resource="C" />
   </div>

   <div about="A" rel="p1" resource="B">
     <div rel="p2" resource="C" />
   </div>

So the main rule that we used to have in RDFa, and that we need here,  
is that a @rel without an object doesn't _always_ create a bnode, but  
it _does_ always cause subject/object alignment, i.e., it creates  
chaining.


UNNECESSARY TRIPLES

As it happens, the original rules were slightly more subtle than  
this; in our current RDFa syntax document the following will actually  
create a triple:

   <div about="A" rel="p1" />

but it seems pretty pointless to say that A has a property of an  
anonymous node, when that anonymous node has no properties. So an  
additional rule we need is to only generate this relationship when we  
get the next part of the chain, which is one of these two patterns:

   <div about="A" rel="p1">
     <div about="B" rel="p2" resource="C" />
   </div>

   <div about="A" rel="p1">
     <div rel="p2" resource="C" />
   </div>


@INSTANCEOF

Note that none of the examples I have given above have included  
@instanceof, since this has nothing to do with chaining as such--I've  
dealt with that in a separate post. In this one I wanted to merely  
explain the ideas behind 'chaining', introduce the concept of  
'alignment', and motivate the need to reinstate the 'missing rule'  
for alignment.

Regards,

Mark

-- 
   Mark Birbeck, formsPlayer

   mark.birbeck@formsPlayer.com | +44 (0) 20 7689 9232
   http://www.formsPlayer.com | http://internet-apps.blogspot.com

   standards. innovation.

Received on Thursday, 15 November 2007 14:21:54 UTC