PROPOSAL to close ISSUE-61: Does the RDFa API need a vocabulary helper

If there are no objections to this proposal in 7 days, we will close
ISSUE-61: Does the RDFa API need a vocabulary helper.

http://www.w3.org/2010/02/rdfa/track/issues/61

This issue concerns the availability of a mechanism to help developers
resolve CURIEs. There were two mechanisms that were requested, the first
would allow a developer to create a CURIE resolver object and use it
like so:

var foaf = graph.ns("http://xmlns.com/foaf/0.1/");
var foafname = foaf("name");
// at this point, foafname == "http://xmlns.com/foaf/0.1/name"

The second mechanism would allow a developer to resolve a CURIE using a
simple method call:

document.data.setMapping("foaf", "http://xmlns.com/foaf/0.1/");
var foafname = document.data.resolve("foaf:name");
// at this point, foafname == "http://xmlns.com/foaf/0.1/name"

A number of changes have been made to the RDFa API since this issue was
raised:

1. The RDFa API has been split into a low-level RDF API specification
   and a high-level RDFa API specification. Working with vocabulary
   helpers and CURIE resolvers is considered a low-level/expert task
   and has been moved into the RDF API as a result.
2. A setMapping() method has been added to the high-level RDFa API
   specification so that developers may specify how CURIEs are resolved.
   All arguments passed to the high-level API are designed to allow
   the specification of CURIEs - that is, CURIE resolution is done
   automatically for the developer. The RDFa API has been deliberately
   kept simple to ensure that beginner developers do not have to deal
   with manually resolving CURIEs in the most common cases.
3. The RDF API now provides a direct mechanism for specifying CURIE
   mappings via the PrefixMap, TermMap and Profile interfaces. The
   RDFa WG is still considering combining the PrefixMap and TermMap
   interfaces, but that is a separate issue from what the CURIE
   resolution mechanism should look like.

The following example in the RDF API demonstrates how prefixes can be
set and resolved using the PrefixMap/TermMap interface:

http://www.w3.org/2010/02/rdfa/sources/rdf-api/#widl-PrefixMap-shrink

The Profile interface, which is the base interface for the
RDFEnvironment interface, exposes the .resolve() method, which can be
used to resolve CURIEs based on all known PrefixMap, TermMap, document
base URL and default vocabulary settings:

http://www.w3.org/2010/02/rdfa/sources/rdf-api/#widl-Profile-resolve

For example, the following is possible when using the RDF API:

var rdf = document.data.rdf;
rdf.prefixes.foaf = "http://xmlns.com/foaf/0.1/";
var foafname = rdf.resolve("foaf:name");
// at this point, foafname == "http://xmlns.com/foaf/0.1/name"

Given the code above, the following is also possible using the RDF API:

var short = rdf.prefixes.shrink(foafname);
// at this point short == "foaf:name"

One can even create a short-cut resolution mechanism, like so:

var r = document.data.rdf.resolve;
var foafname = r("foaf:name");
// at this point, foafname == "http://xmlns.com/foaf/0.1/name"

The above demonstrates the low-level CURIE resolution interfaces. The
following is possible when using the RDFa API (high-level CURIE
resolution interfaces):

document.data.setMapping("foaf", "http://xmlns.com/foaf/0.1/");
var people = document.getItemsByType("foaf:Person");

The RDF API and RDFa API may be used together, for example:

document.data.rdf.prefixes.foaf = "http://xmlns.com/foaf/0.1/";
var people = document.getItemsByType("foaf:Person");

The RDFa WG has found that having a number of mechanisms to shrink and
expand CURIEs is important and should be supported. Additionally, the
RDFa WG has found that being able to use CURIEs directly in method calls
in both the RDF API and RDFa API is vital for ease of use.

However, the RDFa WG has also found that having two mechanisms for
resolving CURIEs may be confusing to developers and does not provide
enough benefit to warrant the addition of a CURIEResolver interface into
the RDF API or RDFa API. That is to say, foaf("name") will not be
supported as a programming pattern - rather "foaf:name" will be
supported when used with the RDF API and RDFa API methods. If a
developer desires a coding pattern like foaf("name"), a
CURIEResolver-like mechanism can be created fairly easily in user-space
code (as demonstrated above).

The proposal is to keep the CURIE resolution additions described above
and specified in the RDF API and RDFa API specifications. A
CURIEResolver interface will not be supported to ensure a consistent
mechanism for resolving CURIEs across the RDF API and RDFa API.

Please comment in 7 days from this post if you object to this proposal.
If there are no objections within 7 days, ISSUE-61 will be closed.

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: Linked Data in JSON
http://digitalbazaar.com/2010/10/30/json-ld/

Received on Monday, 3 January 2011 04:11:21 UTC