W3C home > Mailing lists > Public > public-rdfa-wg@w3.org > February 2012

Re: Confused by combining @href and @content

From: Ivan Herman <ivan@w3.org>
Date: Sat, 18 Feb 2012 09:29:42 +0100
Cc: public-rdfa-wg <public-rdfa-wg@w3.org>
Message-Id: <4C625FBB-097A-49C3-BE40-32804CAEDD26@w3.org>
To: Niklas Lindström <lindstream@gmail.com>
I agree it is confusing but I wonder whether we should touch this.

The design approach we took is that if there is a @content or a @datatype in an element, ie, if the user has clearly expressed that he/she means a literal and not a URIRef, then @property falls back to its former self. And, in those cases, the subject of the triples are set as it used to be. Put it another way, @content/@datatype have a priority over @href or @resource.

The fact that @href sets the subject is bound to chaining

<div rel="a">
  <a href="bla"><span property="c">bla</span></a>

And the behaviour of @property in RDFa 1.0 was such that it was bound to @href. 

We could have decided that @href has a priority over @content/@datatype, ie, the latter are ignored and @property behaves like @rel regardless but we have not. I would prefer not to touch this any more. Any change may have consequences elsewhere, we may end up having a 4th last call which is would be ridiculous.

What this tells me is, rather, that there is (another) good practice issue here: do not mess with mixing URIref related attributes with literal related ones. Ie, do not add @content or @datatype with @href or @resource, unless you know what you are doing. In general, we did have an approach of compactness in the past where we emphasized the possibility of adding, to the same element, a whole series of RDFa attributes (@about, @resource, @property, @rel, @rev, @content into the same element). From hindsight, I would consider today as _very bad practice_. (If we were still at the beginning of the design, I would go as far as disallowing such combinations.) We may want to collect those and document them somewhere. I am not sure the primer is the good place for this; maybe rdfa.info or the W3C semantic wiki can have a page on good and bad encoding practices...


On Feb 17, 2012, at 16:54 , Niklas Lindström wrote:

> Hi all,
> I've come across something surprising when helping some people apply
> RDFa 1.1 recently. At first I thought it was a bug in a distiller, but
> this behaviour is actually defined in "7.5 Sequence", step 5.
> Given this markup:
>    <div vocab="http://schema.org/" about="#me">
>        <a property="email" href="mailto:peter@peterkrantz.se"
>           content="peter@peterkrantz.se">Send me an e-mail</a>
>    </div>
> I was expecting:
>    <#me> schema:email "peter@peterkrantz@se" .
> But the actual result is:
>    <mailto:peter@peterkrantz.se> schema:email "peter@peterkrantz.se" .
> Meaning not only that @href has precedence over @content, but, more
> importantly, that @href suddenly behaves like @about within the same
> element! While resource attributes of course set the subject for
> *nested* RDFa, I thought that we didn't want them to swap roles like
> this?
> (Notice that my point here is this swapping behaviour. (And that I
> expected @content to overrule @href, given that they both represent
> object values.) To get the expected results I can of course e.g. add
> an empty @rel, or wrap the link in a span and put the @property there
> instead. Or override @href with either @resource="#me" *or*
> @about="#me".)
> In fact, I notice also that this:
>    <a property="email" href="mailto:peter@peterkrantz.se"
>       datatype="">peter@peterkrantz.se</a>
> Produces this:
>    <mailto:peter@peterkrantz.se> schema:email <mailto:peter@peterkrantz.se> .
> That is, merely adding @datatype="" makes @href supply both subject and object!
> For context, compare the above to:
>    <span property="email" content="peter@peterkrantz.se"></span>
> And:
>    <a property="email"
>        href="mailto:peter@peterkrantz.se">Send me an e-mail</a>
> Where @content and @href clearly are objects. I wonder if this is a
> bug in the spec, or intended behaviour?
> As I recall, we *did* discuss behaviour like this when we changed @src
> into a resource attribute. That is, while @src behaves like a resource
> attribute (supplying the object) here:
>    <img property="image" src="images/peter_krantz.jpg" />
> It could behave like @about (i.e. supply the subject) here:
>    <img property="rdfs:label" src="images/apple.jpg" content="An apple" />
> And it actually does! But I thought that we decided against it, given
> that it would be confusing in general (as illustrated above).
> Thoughts?
> Best regards,
> Niklas

Ivan Herman, W3C Semantic Web Activity Lead
Home: http://www.w3.org/People/Ivan/
mobile: +31-641044153
FOAF: http://www.ivan-herman.net/foaf.rdf

Received on Saturday, 18 February 2012 08:30:22 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:19:55 UTC