- From: Martin McEvoy <martin@weborganics.co.uk>
- Date: Mon, 07 Dec 2009 22:04:12 +0000
- To: Mark Birbeck <mark.birbeck@webbackplane.com>
- CC: RDFa <public-rdf-in-xhtml-tf@w3.org>
Mark Birbeck wrote: > Hi Martin, > > Good to see you making a start on this. > More thinking out loud ;) > 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. > agreed, its not perfect.... > 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. > Im a little unconvinced that @profile will work, its one of those things that authors tend to forget (like in microformats) but you never know. Another way I tried was setting a header tag to something like "X-Dataset: http://...dataset.json" It worked as a way to deliver the json to the parser before parsing which was easy enough for parsers to Implement... but I think it may be a little beyond what is actually practical... > 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/" > } > } > > I agree also, I have changed the example to what you suggested above, I was just trying to keep it simple.. but then again yours is simpler ;) > 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: "<>" > } > } > and if you combine my example (+ your suggestions ) with yours ..... { namespace: { foaf: "http://xmlns.com/foaf/0.1/", dc: "http://purl.org/dc/elements/1.1/" }, context: { base: "http://example.org/about", token: { title: "dc:title", maker: "foaf:maker", name: "foaf:name", homepage: "foaf:homepage" } } } much nicer ( there is nothing wrong with CURIEs in json is there), it is fairly easy to implement too, I've tried something very similar in a more extended test a month or so back. > which makes me wonder if there might be some value in allowing the > 'profile' document to contain triples as well as prefix mappings. > I don't know about that either seems excessive to me... and is probably going to get out of sync with the current document. > It's not important for the moment, but it's perhaps worth revisiting > at some point. > It will be good to hit the ground running when you do. Best wishes. -- 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 22:04:41 UTC