W3C home > Mailing lists > Public > public-linked-json@w3.org > November 2011

Multi-pass @context (ISSUE #41)

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Tue, 29 Nov 2011 14:03:27 -0500
To: Linked JSON <public-linked-json@w3.org>
Message-ID: <6F91B7DA-3004-4502-A22A-0E9E2A1F083A@greggkellogg.net>
Manu and I discussed this a bit after the call today. Note that I had already created issue #41 to address this [1]. From the issue text:

> The spec describes defining an @context in terms of having an "active context". This allows terms and prefixes to be used within a @context definition, if they are defined earlier.
> 
> Update the spec to ensure that this is clear, and to allow both from contexts defined in a higher object, and those that precede within an array of contexts.

The problem comes to play when an author wants to create a context both defining terms and using them in @datatype. For example:

@context: {
  "xsd": "http://www.w3.org/2001/XMLSchema#",
  "date": {"@iri": "http://purl.org/dc/terms/date", "@datatype": "xsd:date"}
}

This requires two passes over @context, first to resolve prefixes, and second to use those prefixes in @datatype declarations. Note that before, when @coerce was a separate object, this processing was in effect; it was lost when we folded in datatypes with prefix definitions.

As a related issue, we could consdier the following:

@context: {
  "xsd": "http://www.w3.org/2001/XMLSchema#",
  "dc": "http://purl.org/dc/terms/",
  "date": {"@iri": "dc:date", "@datatype": "xsd:date"}
}

This adds another layer of complication, as it may require more than two passes to resolve the use of CURIEs in @iri definitions, so I would not go this far, although the use of a CURIE should be allowed, if it is defined in an outer context.

I believe that we should adopt the first form, as it is a natural way to create a context for authors, and there is a reasonable possibility that there will be errors if authors do not separate prefix definitions from the usage in datatypes.

I propose that we formally say that context object traversal is a two-pass operation, where first IRIs for defined terms are identified and then @datatype and @list processing occurs, so that prefixes defined within a context can be used for @datatype definitions.

As an alternative, we could define a set of terms that are defined in a global "default" context, similar to RDFa's default context. There we could define mappings for xsd, rdf, dc, foaf, schema and others. This would eliminate most need for doing two-pass processing of contexts.

Gregg

[1] https://github.com/json-ld/json-ld.org/issues/41
Received on Tuesday, 29 November 2011 19:04:43 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:35 GMT