Re: Determination of subjects/objects (was: ISSUE-42)

In my attempt to write down things algorithmically, I tried to write
down the rules for lists and containers, to see if we can describe them
easily and simply, and stay within Ben rules as stated below. The short
summary is: yes:-). The details:

1. If the instanceof="rdf:Seq" (Bag/Alt) appears in an <ol> (<ul>) then

- the normal Ben rules apply on the <ol><ul> elements, yielding a named
or anonymous note of type Seq/Alt/Bag

- for each <li> element:
    - if no RFDa attribute appears then a property="rdf:_1",
property="rdf:_2", etc, is implicitly added
    - if an @href, @about, @resource, or @instanceof appear then a
rel="rdf:_1", rel="rdf:_2" is implicitly added
 
and then the normal Ben rules apply to the full structure.

2. If the instancof="rdf:List" appears in an <ol> (<ul>) element then
the algorithm is similar, but instead of rdf:_1 a (pseudo)
'rdfa:listElement' is used in the same way; then, as a second step, the
generated

[ a rdf:List;
  rdfa:listElement object1,object2,object3;
]

is transformed into a (object1 object2 object3) (in Turtle notation)

There might be edge cases with several of these attributes appearing on
<li>-s, for example. We can do two things:

a. work out all the possible combination
b. state that in all other cases (eg, if somebody puts and explicit
@property on one of the <li>-s) the transformation mechanism _does not
happen_. Ie: if you want to do it complicated, do it manually!


Some examples below, which all seem to work...

---------------------------
<ul instanceof="rdf:Seq">
<li>blabla</li>
<li>blabla</li>
</ul>

yields

<ul instanceof="rdf:Seq">
<li property="rdf:_1">blabla</li>
<li property="rdf:_2">blabla</li>
</ul>

yields

[ a rdf:Seq; rdf:_1 "blabla; rdf:_2  "blabla. ]

-------------

<ul instanceof="rdf:Seq">
<li about="#A">blabla <span property="p:q">bla2</span></li>
<li href="#B">blabla <span property="p:q">bla3</span></li>
</ul>

yields

<ul instanceof="rdf:Seq">
<li rel="rdf:_1" about="#A">blabla <span property="p:q">bla2</span></li>
<li rel="rdf:_2" href="#B">blabla <span property="p:q">bla3</span></li>
</ul>

yields

[ a rdf:Seq;
 rdf:_1 <#A>;
 rdf:_2 <#B>.
]
<#A> p:q "bla2".
<#B> p:q "bla2".

Note that, as a side effect of the Ben rules, there is _no_ difference
between @about and @href in this setting...

-------------

<ul instanceof="rdf:Seq">
<li instanceof="foaf:Person">blabla</li>
<li instanceof="foaf:Person">blabla</li>
</ul>

yields

<ul instanceof="rdf:Seq">
<li rel="rdf:_1" instanceof="foaf:Person">blabla <span
property="p:q">bla2</span></li>
<li rel="rdf:_1" instanceof="foaf:Person">blabla <span
property="p:q">bla2</span></li>
</ul>

which leads to

[ a rdf:Seq;
  rdf:_1 [ foaf:Person; p:q "bla2". ];
  rdf:_2 [ foaf:Person; p:q "bla2". ].
]. 

------------

If I also use the proposed @about="_:" notation then

<ul instanceof="rdf:Seq">
<li about="_:">blabla</li>
<li about="_:">blabla</li>
</ul>

yields

<ul instanceof="rdf:Seq">
<li rel="rdf:_1" about="_:">blabla <span property="p:q">bla2</span></li>
<li rel="rdf:_1" about="_:">blabla <span property="p:q">bla2</span></li>
</ul>

which leads to

[ a rdf:Seq;
  rdf:_1 [ p:q "bla2". ];
  rdf:_2 [ p:q "bla2". ].
].

I have the impression that things begin to fall into their place nicely

Ivan

Ivan Herman wrote:
> I follow here Niklas' advice[1] on starting a new thread. It is indeed a
> central issue and it is better tracked that way. Reminder: there was an
> algorithmic description on what happens in Ben's mail[2] and an older
> one from me[3] as well as my proposal for anonymous nodes[4].
> 
> Let me also reproduce here, for easier reference, Ben's algorithm[2]. I
> believe it is cleaner than mine[3] because it does not give a different
> behaviour to @resource (apart from a priority issue). Niklas has already
> started to match it against various use cases and we should probably
> follow that. So here it is:
> 
> Consider the concept of an HTML element's "corresponding RDF identity".
> 
> - the "corresponding RDF identity" is determined as follows:
>   - @resource takes precedence
>   - if no @resource, @href is next
>   - if no @href, then @id.
>   - if no @id, then @about.
>   - if all else fails, a bnode.
> 
> - the element's corresponding RDF identity is the subject of an rdf:type
> triple when instanceof appears.
> 
> - the element's corresponding RDF identity is also the object of any
> @rel, or the subject of any @rev.
> 
> - the subject of a @rel, or the object of a @rev, is determined using
> the normal @about rules.
> 
> - the subject of an element's *content* is the element's corresponding
> RDF identity when @rel, @rev, @href, @resource, or @instanceof appears.
> Otherwise, it's @about resolution.
> 
> 
> I will react on some of the issues here in a separate mail, to have a
> clean thread.
> 
> I hope this helps
> 
> Ivan
> 
> 
> 
> [1]
> http://lists.w3.org/Archives/Public/public-rdf-in-xhtml-tf/2007Jul/0159.html
> [2]
> http://lists.w3.org/Archives/Public/public-rdf-in-xhtml-tf/2007Jul/0158.html
> [3]
> http://lists.w3.org/Archives/Public/public-rdf-in-xhtml-tf/2007Jul/0153.html
> [4]
> http://lists.w3.org/Archives/Public/public-rdf-in-xhtml-tf/2007Jul/0144.html

-- 

Ivan Herman, W3C Semantic Web Activity Lead
Home: http://www.w3.org/People/Ivan/
PGP Key: http://www.ivan-herman.net/pgpkey.html
FOAF: http://www.ivan-herman.net/foaf.rdf

Received on Friday, 20 July 2007 11:55:55 UTC