W3C home > Mailing lists > Public > public-rdfa-wg@w3.org > October 2010

Profiles in RDFa 1.1

From: Mark Birbeck <mark.birbeck@webbackplane.com>
Date: Wed, 20 Oct 2010 23:56:13 +0100
Message-ID: <AANLkTim-Vr-6AO4goccFqphQLoSUrjNjJDCFehFPFAUn@mail.gmail.com>
To: RDFa WG <public-rdfa-wg@w3.org>
Hi all,

As you know, I'm against expressing prefix and term mappings by using
RDF directly. I've explained this in many other threads and
discussions, so won't go through it again here. The main point of this
email is that I've been asked to suggest an alternative.

I actually have two proposals, one that uses a simple text format and
the other that uses an RDFa document but involves only processing
certain attributes.

I favour supporting at least the text format, and optionally the
HTML+RDFa format.

However, I appreciate that there is a desire to use HTML documents so
as to be able to describe the profile, so I would have no problem if
only the second format was supported.


PROPOSAL 1: USING @PREFIX FORMAT

We already have a syntax for defining prefix mappings:

  <div prefix="
      foaf: http://xmlns.com/foaf/0.1/
      dcterms: http://purl.org/dc/terms/
    ">...</div>

We could easily use this for our external file format:

  foaf: http://xmlns.com/foaf/0.1/
  dcterms: http://purl.org/dc/terms/

This follows the way that scripts and CSS work in HTML, in that the
external version of a script or stylesheet uses the same syntax as a
version that is embedded in the document. This means that it's very
easy to convert from an embedded scenario to an external scenario
because you simply take the embedded text, move it to a document and
then reference that document.

(Our current model has a very simple way to embed prefix mappings into
a document, but a very complicated way to embed prefixes in an
/external/ document.)

Note that the @prefix syntax doesn't currently account for terms or
the default vocabulary:

For the default vocabulary we could just use ':':

  : http://xmlns.com/foaf/0.1/
  foaf: http://xmlns.com/foaf/0.1/
  dcterms: http://purl.org/dc/terms/

For terms, we can either omit the colon (note that 'name' has no colon):

  : http://xmlns.com/foaf/0.1/
  foaf: http://xmlns.com/foaf/0.1/
  dcterms: http://purl.org/dc/terms/
  name http://xmlns.com/foaf/0.1/name

or simply remove the distinction between terms and prefix mappings
(here 'name' does have a colon):

  : http://xmlns.com/foaf/0.1/
  foaf: http://xmlns.com/foaf/0.1/
  dcterms: http://purl.org/dc/terms/
  name: http://xmlns.com/foaf/0.1/name

(I think it's an omission that we don't allow terms to be defined
without a profile, and either of these two solutions might be allowed
in the main document.)

Advantages:

* doesn't use RDF;
* consistent with the way that scripts and stylesheets work;
* doesn't require a full RDFa parser -- only requires the part that processes
  @prefix;
* easy to take mappings from a document and create a profile with them,
  without having to know RDF.

Disadvantages:

* no commenting mechanism, so not self-describing.

(Of course, a commenting mechanism could easily be added!)


PROPOSAL 2: PARSE @XMLNS/@PREFIX/@VOCAB ON EXTERNAL DOCUMENT

An additional/alternative proposal would be to use RDFa in the
external document, but only take account of the @xmlns, @prefix and
@vocab attributes.

(I'd consider ignoring @xmlns if we intend to deprecate it, but that's
a minor issue.)

As per section 7.6 'Processing', an empty context object would be
created at step 1, then steps 3, 4 and 13 would be applied to the
profile document. The resulting context object would be in effect a
'profile' object, although only the following context object
properties would be relevant:

  * the local list of URI mappings;
  * the local term mappings;
  * the local default vocabulary.

Note that since contexts are pushed and popped then the resulting
profile will actually be whatever is present on the <html> element of
the profile document. I think this is acceptable, but more control
over the layout could be achieved by making the profile 'cumulative'
(i.e., by not pushing and popping the context). I could go either way
on this.

Advantages:

* doesn't use RDF;
* consistent with the way that RDFa works;
* doesn't require a full RDFa parser -- only requires the part that processes
  @xmlns, @prefix and @vocab;
* easy to take mappings from a document and create a profile with them,
  without having to know RDF;
* self-describing, in that the HTML document can contain a description of the
  profile, links to resources, etc.

Disadvantages:

* there is currently no way to define a term in a document. However, I believe
  this is an omission in RDFa generally, so shouldn't be regarded as a
limitation
  here.


EXAMPLES

1. Using @prefix syntax:

  : http://xmlns.com/foaf/0.1/
  foaf: http://xmlns.com/foaf/0.1/
  dcterms: http://purl.org/dc/terms/
  name: http://xmlns.com/foaf/0.1/name

2. Using an RDFa document:

This example uses @prefix to define the term 'name' without a colon:

  <html vocab="http://xmlns.com/foaf/0.1/"
    prefix="
      foaf: http://xmlns.com/foaf/0.1/
      dcterms: http://purl.org/dc/terms/
      name http://xmlns.com/foaf/0.1/name
    "
  >
    <head>
      <title>My prefix mappings</title>
    </head>
    <body>
      <p>This set of prefix mappings is for ...</p>
    </body>
  </html>

This example uses @prefix to define the term 'name' with a colon, and
consequenty requires us to remove any distinction between term and
prefix mappings:

  <html vocab="http://xmlns.com/foaf/0.1/"
    prefix="
      foaf: http://xmlns.com/foaf/0.1/
      dcterms: http://purl.org/dc/terms/
      name: http://xmlns.com/foaf/0.1/name
    "
  >
    <head>
      <title>My prefix mappings</title>
    </head>
    <body>
      <p>This set of prefix mappings is for ...</p>
    </body>
  </html>

This example uses a new attribute @term to define the term 'name', and
then uses the same syntax as @prefix:

  <html vocab="http://xmlns.com/foaf/0.1/"
    prefix="
      foaf: http://xmlns.com/foaf/0.1/
      dcterms: http://purl.org/dc/terms/
    "
    term="name: http://xmlns.com/foaf/0.1/name"
  >
    <head>
      <title>My prefix mappings</title>
    </head>
    <body>
      <p>This set of prefix mappings is for ...</p>
    </body>
  </html>

Regards,

Mark

--
Mark Birbeck, webBackplane

mark.birbeck@webBackplane.com

http://webBackplane.com/mark-birbeck

webBackplane is a trading name of Backplane Ltd. (company number
05972288, registered office: 2nd Floor, 69/85 Tabernacle Street,
London, EC2A 4RR)
Received on Wednesday, 20 October 2010 22:57:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:05:21 UTC