Re: JSON LD EBNF

On 12/09/2013 03:02 PM, Mark Hapner wrote:
> Another question ...
> 
> In Sec 8.7 
> 
> 'If the expanded term definition
> <file:///Volumes/Bitcasa%20Infinite%20Drive/Resilient%20Networks/JSON-LD%201.0.webarchive#dfn-expanded-term-definition> contains
> the |@id| keyword
> <file:///Volumes/Bitcasa%20Infinite%20Drive/Resilient%20Networks/JSON-LD%201.0.webarchive#dfn-keyword>,
> its value must be null
> <file:///Volumes/Bitcasa%20Infinite%20Drive/Resilient%20Networks/JSON-LD%201.0.webarchive#dfn-null>,
> an absolute IRI
> <file:///Volumes/Bitcasa%20Infinite%20Drive/Resilient%20Networks/JSON-LD%201.0.webarchive#dfn-absolute-iri>,
> a blank node identifier
> <file:///Volumes/Bitcasa%20Infinite%20Drive/Resilient%20Networks/JSON-LD%201.0.webarchive#dfn-blank-node-identifier>,
> a compact IRI
> <file:///Volumes/Bitcasa%20Infinite%20Drive/Resilient%20Networks/JSON-LD%201.0.webarchive#dfn-compact-iri>,
> a term
> <file:///Volumes/Bitcasa%20Infinite%20Drive/Resilient%20Networks/JSON-LD%201.0.webarchive#dfn-term>,
> or a keyword
> <file:///Volumes/Bitcasa%20Infinite%20Drive/Resilient%20Networks/JSON-LD%201.0.webarchive#dfn-keyword>.'
> 
> What keyword can be a value of an @id expanded def property and what
> would it mean?

Any keyword except @context. It would mean that the term associated with
the definition is an alias for that keyword. When the term is
encountered during JSON-LD processing, it will be interpreted as if it
were the specified keyword. Using the expanded definition is uncommon
for this purpose, but we allow it to be done to maintain expanded
definition regularity.

Here's an example:

{
  "@context": {
    "myIdAlias": {"@id": "@id"},
    "myTypeAlias": {"@id": "@type"},
    "myValueAlias": "@value"
  },
  "myIdAlias": "http://example.com/id",
  "myTypeAlias": "http://example.com/Type",
  "http://example.com/foo": {"myValueAlias": "bar"}
}

The @context defines three aliases: myIdAlias, myTypeAlias, and
myValueAlias for, respectively, the keywords @id, @type, and @value. The
last alias (myValueAlias) uses the more common unexpanded term
definition pattern.

The document, when expanded (removing the @context and thus any
aliases), looks like:

[{
  "http://example.com/foo": [{
    "@value": "bar"
  }],
  "@id": "http://example.com/id",
  "@type": ["http://example.com/Type"]
}]

Hopefully this clarifies the aliasing feature a bit.

-Dave


-- 
Dave Longley
CTO
Digital Bazaar, Inc.

Received on Monday, 9 December 2013 20:45:45 UTC