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

chaining-friendly rules for @instanceof

From: Ben Adida <ben@adida.net>
Date: Thu, 08 Nov 2007 19:03:03 -0800
Message-ID: <4733CDE7.6070902@adida.net>
To: RDFa <public-rdf-in-xhtml-tf@w3.org>


Hi all,

Manu wanted me to express my proposed @instanceof rules in a way similar
to what he recently posted [1], so that we could compare.

The main driver for my rules is to make it easy for @instanceof to be
used on chaining nodes, so that one can say "I know a person named
'Ralph'", or even the more complicated "I know a person who knows a
person who knows a person named 'Bill'".

The result is something a tad more complicated than Manu's rules, but
fairly consistent and able to express the important use case above.

Here's the rule summary.

==============================

THE RULES IF ALL ATTRIBUTES ARE PRESENT
---------------------------------------

On an element, processing proceeds as follows:

1) @about		[set the subject]
2) @rel 		[set one or more predicates]
3) @rev			[set one or more reverse predicates]
4) @property 		[set one or more literal-object predicates]
5) @resource/@href/@src	[set object for @rel, subj for @rev]
6) @content		[set object for @property]
7) @datatype		[set datatype of object for @property]
8) The URI object becomes the CHAINING NODE, which becomes the inherited
subject for all contained elements.
9) @instanceof		[sets the type of the CHAINING NODE]


Of course, the above rules, just like Manu's, describe only the parsing
when all attributes are there. For example, in Manu's case, the rules
have to be tweaked to consider the

<img src="photo.jpg" instanceof="foaf:Image" />

markup, since @instanceof is processed before @src.

So, for clarity, let me propose a different take on my rules that
attempts to cover more markup, not just the all-attributes example. This
is a bit more complicated, but I think any attempt to write up complete
parsing rules for @instanceof will be about as complicated.

On element <EL>:

A) Process RDFa attributes (@about, @rel, @rev, @property, @content,
@datatype, @href, @resource) on <EL> as if there were no @instanceof.

B) Determine the RDF identity of the element:
	- the URI object if it's there [@resource/@href/@src]
	OTHERWISE
	- the chaining bnode if there's @rel/@rev
	OTHERWISE
	- the value of an explicit @about if there is one
	OTHERWISE
	- a new bnode.

C) @instanceof applies to the RDF identity of the element it's on, and
causes chaining on that RDF identity if it hasn't been triggered yet.


==============================

-Ben

[1] http://lists.w3.org/Archives/Public/public-rdf-in-xhtml-tf/2007Nov/0001
Received on Friday, 9 November 2007 03:03:19 GMT

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