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

Re: RDFa without using xmlns:

From: Mark Birbeck <mark.birbeck@webbackplane.com>
Date: Mon, 7 Dec 2009 19:19:19 +0000
Message-ID: <640dd5060912071119h30daf770u72fd20b6d4f3aa24@mail.gmail.com>
To: martin@weborganics.co.uk
Cc: RDFa <public-rdf-in-xhtml-tf@w3.org>
Hi Martin,

Good to see you making a start on this.

I too, am in favour of using JSON for at least one of the possible
formats for prefix mappings. But you seem to have two properties
everywhere that one will do. :)

(I'll explain that a bit more in a moment.)

First, the problem with using link/@rel value to point to a set of
prefix mappings is that you won't find them until you start
parsing...and by then it's too late.

One possible solution would be to use another attribute. Myself I'd
like to see us use @profile, and if the receiving server were to use
content-negotiation, then the prefix mappings could come back in any
form.

Another alternative that has been mentioned -- apologies for not
remembering who by -- is to overload the syntax of whatever attribute
is used for prefix mappings. E.g., if @prefix or @token, or whatever
is used, contained a URL with no mapping, then it would mean that it's
a reference to a document full of mappings.

Yet another approach would be to change the parsing model so that
<head> is treated specially. I did actually have this in an early
draft of RDFa, but it wasn't that popular. :) But there is something
to be said for processing the <head> first, and then using the triples
provided to set everything up for the subsequent parsing of the body.

Much as I like that model, that horse has probably flown...or whatever
the expression is.

Anyway, on to the rest of your proposal.

As I say, I'd like a JSON solution too, because that way a browser can
get at the mappings.

However, whilst you currently have this:

  {
    "namespace" : [
      {
        "prefix": "foaf",
        "value": "http://xmlns.com/foaf/0.1/"
      },
      {
        "prefix": "dc",
        "value": "http://purl.org/dc/elements/1.1/"
      }
    ]
  }

I'd suggest that all you actually need is this:

  {
    "namespace": {
      "foaf": "http://xmlns.com/foaf/0.1/",
      "dc": "http://purl.org/dc/elements/1.1/"
    }
  }

As it happens, RDFj [1] includes a way to set context information,
such as prefix-mappings and a base URL, which uses that more compact
approach:

  {
    context: {
      base: "<http://example.org/about>",
      token: {
        title: "http://xmlns.com/foaf/0.1/title",
        maker: "http://xmlns.com/foaf/0.1/maker",
        name: "http://xmlns.com/foaf/0.1/name",
        homepage: "http://xmlns.com/foaf/0.1/homepage"
      }
  }

So I'd like to suggest that we look at using this same pattern, for
the 'profile' document.

'context' is normally used like this:

  {
    context: {
      base: "<http://example.org/about>",
      token: {
        title: "http://xmlns.com/foaf/0.1/title",
        maker: "http://xmlns.com/foaf/0.1/maker",
        name: "http://xmlns.com/foaf/0.1/name",
        homepage: "http://xmlns.com/foaf/0.1/homepage"
      }
    },
    "$": "<>",
      title: "Anna's Homepage",
      maker: {
        name: "Anna Wilder",
        homepage: "<>"
      }
  }

which makes me wonder if there might be some value in allowing the
'profile' document to contain triples as well as prefix mappings.

It's not important for the moment, but it's perhaps worth revisiting
at some point.

Regards,

Mark

[1] <http://code.google.com/p/backplanejs/wiki/Rdfj>

On Mon, Dec 7, 2009 at 6:15 PM, Martin McEvoy <martin@weborganics.co.uk> wrote:
> Hello all,
>
> I have put together a page demonstrating extracting RDFa  without using
> xmlns: attributes.
>
> see: http://weborganics.co.uk/demo/rdfa.html
>
> How it works is a little bit of json is parsed along with the page that
> describes the prefix matches. The parser (Transformr) finds the json data
> using an auto discovery link in the head of the page using @rel="dataset".
>
> see: http://weborganics.co.uk/demo/prefixes.json
>
> The reason why I have added this feature is because it works well in HTML,
> json is super easy to parse (an well supported),  some people are not happy
> using xmlns: attributes so this gives them an alternative and I think it may
> help decide what format @profile should maybe be in should it ever be
> introduced in future versions of RDFa.
>
> Thanks.
>
> --
> Martin McEvoy
>
> WebOrganics http://weborganics.co.uk/
> Add to address book: http://transformr.co.uk/hcard/http://weborganics.co.uk/
>
>
>
Received on Monday, 7 December 2009 19:20:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 19:20:17 GMT