Re: Documenting SPARQL extension functions / js functions with fragid semantics

Toby Inkster wrote:
> SPARQL has a number of built-in functions like STR() and REGEX() which
> can be used in filters, and since SPARQL 1.1, can be bound as results.
> As well as the built-in functions, SPARQL can be extended with
> additional functions which are identified by URIs.
> 
> While there's no requirement that those URIs be dereferencable,
> experience from linked data tells us that it's probably a good idea
> for them to be. But what should be the representation delivered when a
> client dereferences them?
> 
> I've been writing a few extension functions for Gregory Williams'
> RDF::Query Perl SPARQL implementation recently, so I was pondering this
> question and stumbled upon what I think is a pretty good solution.
> 
> Take for example, the function I've defined which takes no parameters
> and returns a UUID string as a literal. That function has the URI:
> 
> http://buzzword.org.uk/2011/functions/util#uuid
> 
> If you dereference that URI sending "Accept: application/ecmascript"
> you'll get an ECMAScript (JavaScript) implementation of the function,
> built on the RDF API which is currently being worked on by the RDFa
> Working Group.
> 
> The ECMAScript implementations there aren't directly used by the Perl
> implementation - they just serve as documentation for the functions
> identified by the URIs.
> 
> What do people think of this as a solution for documenting SPARQL
> extension functions?

Fantastic work Toby! I think you've hit on more than just a solution for 
SPARQL, but also a solution for a modular web scale approach to 
programming, Tim and I had a brief discussion on this recently on the 
TAG list [1], and what you've implemented here is more or less exactly 
what we discussed.

Only two generic bits of feedback:

1: could the functions be defined as follows instead, in order to get 
across the notion of them being in the document namespace (related to 
the fragments):
   uuid_uri = function(environment)

2: might the comments also be in RDF..? or a mapping created for the doc 
comments, for instance @type may return http://ex.org/rdf-api/rdf#NamedNode

Then there's the other approach Tim pointed to, see [2]

[1] http://lists.w3.org/Archives/Public/www-tag/2010Dec/0011.html
[2] http://www.w3.org/2001/10/navigate/src/red

Received on Wednesday, 5 January 2011 01:57:18 UTC