- From: Nathan <nathan@webr3.org>
- Date: Sat, 09 Oct 2010 19:29:57 +0100
- To: Shane McCarron <shane@aptest.com>
- CC: Mark Birbeck <mark.birbeck@webbackplane.com>, Tim Berners-Lee <timbl@w3.org>, RDFA Working Group <public-rdfa-wg@w3.org>
Noted, only called it namespaces for the sake of clarity in this mail, my suggestion was CurieResolver but I don't mind what the interface is called or how it's referenced - CurieResolver and CURIE resolution had made sense to me and I've tried to introduce it in such a way that minimal documentation / referencing will need to be made outwith the interface definition, a couple of lines and this topic on the mailing list :) Best, Nathan Shane McCarron wrote: > Is there some way we can NOT call this namespaces? People will confuse > this with XML Namespaces, which it assuredly is not. "Vocabulary" is > the term we use most often. In this case, what you are doing is > defining a "Vocabulary Shortcut". This is pure syntactic sugar, but I > don't mind adding it if there is an audience who expects this sort of > thing. But please, please, please don't call it Namespaces. Please. > > On 10/9/2010 1:02 PM, Nathan wrote: >> Mark, >> >> I forgot to (cc you in the original mail! and) note that this >> introduces zero dependencies on "Namespaces" in to the API and both >> the documentation examples and your code would be free to ignore it, >> in that people could use either style without anything breaking - >> similarly it allows "Namespaces" to be used anywhere an IRI is >> required (since it returns IRI) so the use-cases expand to any method >> which accepts an IRI. >> >> Best, >> >> Nathan >> >> Nathan wrote: >>> Tim Berners-Lee wrote: >>>> The way the namespaces work I think is nice, >>>> >>>> You say foaf = $rdf.Namespace("http://...."); >>>> data.add(me, foaf('name'), you); >>>> >>>> Now I'd make it "ns" rather than Namespace in the spirit of making >>>> it all fairly compact. >>> >>> Tim, Mark, Ivan, All, >>> >>> This is a "minimal change" proposal to add tabulators Namespace >>> functionality in to the RDFa API, together with the use-case which >>> hopefully warrants it's inclusion. >>> >>> I propose we change the definition of DataContext setMapping to be: >>> >>> interface DataContext { >>> CurieResolver setMapping (in DOMString prefix, in DOMString iri); >>> ... >>> }; >>> >>> and add the following interface: >>> >>> [NoInterfaceObject Callback] >>> interface CurieResolver { >>> IRI resolve (in DOMString curie); >>> }; >>> >>> This has minimal impact on the RDFa API but makes it much more >>> usable, usage is as follows: >>> >>> var foaf = context.setMapping('foaf', 'http://xmlns.com/foaf/0.1/'); >>> foaf('name'); // returns IRI('http://xmlns.com/foaf/0.1/name') >>> >>> To illustrate how useful this is, here are two versions of the >>> javascript required to create the following triples: >>> >>> :me a foaf:Person; >>> foaf:givenname "Nathan"; >>> foaf:homepage <http://webr3.org/>; >>> foaf:knows :bob, :sue. >>> >>> with this proposal: >>> >>> var t1 = data.createTriple(me, rdf('type') , foaf('Person') ); >>> var t2 = data.createTriple(me, foaf('givenname') , myName ); >>> var t3 = data.createTriple(me, foaf('homepage') , myHomepage ); >>> var t4 = data.createTriple(me, foaf('knows') , thisDoc('bob') ); >>> var t5 = data.createTriple(me, foaf('knows') , thisDoc('sue') ); >>> >>> without the proposal (current API usage): >>> var t1 = data.createTriple(me, >>> data.context.resolveCurie('rdf:type') , >>> data.context.resolveCurie('foaf:Person') ); >>> var t2 = data.createTriple(me, >>> data.context.resolveCurie('foaf:givenname') , myName ); >>> var t3 = data.createTriple(me, >>> data.context.resolveCurie('foaf:homepage') , myHomepage ); >>> var t4 = data.createTriple(me, >>> data.context.resolveCurie('foaf:knows') , >>> data.context.resolveCurie(':bob') ); >>> var t5 = data.createTriple(me, >>> data.context.resolveCurie('foaf:knows') , >>> data.context.resolveCurie(':sue') ); >>> >>> I sincerely hope that illustrates how beneficial this would be to >>> add, and as a bonus it keeps the entire API type safe with no >>> additional changes needed. >>> >>> Best, >>> >>> Nathan >>> >>> ps: here's the snipped code which makes the above examples work >>> (remove the `var = thisDoc` etc for the usage without this change): >>> >>> var thisDoc = data.context.setMapping( "" , >>> "http://webr3.org/nathan#" ); >>> var rdf = data.context.setMapping( "rdf" , >>> "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ); >>> var foaf = data.context.setMapping( "foaf" , >>> "http://xmlns.com/foaf/0.1/" ); >>> >>> var me = data.context.resolveCurie(':me'); >>> var myName = data.createPlainLiteral("Nathan"); >>> var myHomepage = data.createIRI("http://webr3.org/"); >>> >>> >>> >> >
Received on Saturday, 9 October 2010 18:31:22 UTC