Re: PROPOSAL: Restrict @prefix declaration to the root element

Niklas Lindström wrote:
> On Tue, Jul 19, 2011 at 5:26 AM, Gregg Kellogg <gregg@kellogg-assoc.com> wrote:
>> I think I actually suggested this, but on further thought, it limits some important use cases.
> 
> I fully agree.
> 
>> In the structured-data linter, the snippet output is generates with RDFa markup within a div inside the document. Having to declare @prefix definitions in the head is a little problematic, and doesn't keep all the example RDFa in one place; it actually introduces a different copy/paste problem.
> 
> Indeeed. Both @prefix and @vocab should be allowed anywhere, to make
> it easy to embed such snippets and work in templated/restricted
> publishing environments of various kinds. I furthermore expect that
> using @vocab and the occasional full URI will cover many small, simple
> use cases (e.g. provenance data in the head or a header; some
> licensing and attribution in a footer).

I'm going to disagree, whilst I fully agree that these are important use 
cases, I also think that the ability to redefine prefixes throughout a 
document creates a large amount of unexpected functionality, especially 
when working with the DOM. That said, I do think @vocab should be 
allowed anywhere.

To throw in a few simple use cases..

1: CSS
CSS selectors operate by the string token value contained in an 
attribute, for example:

   [property="foaf:name"] { color:red; }

If the foaf prefix is mapped to different URIs throughout, this leads to 
unexpected results.

2: DOM APIs
As with the above, if we consider that in a document a single prefix is 
mapped to two different URIs throughout the document, then again we get 
unexpected functionality / confusing results.

In order to limit this (and I don't personally think it's a fringe 
case), it would be good to limit, wherever possible, the ability to 
redefine a prefix mappings throughout a document.

Ultimately I feel a slightly different approach is needed from us, where 
we endeavour to ensure that prefixed terms like "foaf:name" are used as 
simple string tokens wherever possible, whilst still retaining the 
ability to map them back to a URI (by whatever means). As a user, I'd 
certainly find this useful, and more in line with the rest of HTML/CSS 
and the DOM.

disclaimer: obviously I fully understand the value of the copy paste 
scenarios, and where people can't modify the head of a document; and for 
these cases it would be nice to encourage the use of @vocab - since copy 
paste actions are generally going to be quite well defined and used 
frequently; for instance when copying a rich snippet of structured data 
from a help page, tutorial, or vocab homepage.

Best,

Nathan

Received on Tuesday, 26 July 2011 11:19:51 UTC