output of the compaction algorithm

Hi,

there is something that I do not understand in the output of the compaction algorithm.

For the following JSON-LD:
{
  "@context" : {
    "label": {
      "@id" : "http://www.vocab.net/label",
      "@type" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
    },
    "homepage": {
      "@id": "http://www.vocab.net/homepage",
      "@type": "@id"
    }
  },

  "@id" : "http://www.a.com",
  "label": {
    "@value" : "a dot com",
    "@language" : "fr"
  },
  "homepage": "http://www.a.com/home”

that is, in turtle:
<http://www.a.com>
    <http://www.vocab.net/homepage> <http://www.a.com/home>;
    <http://www.a.com> <http://www.vocab.net/label> "a dot com"@fr .

}

why do we get the following compacted form (output of the JSON-LD playground, using same context, that I omit below):

  "@id": "http://www.a.com",
  "homepage": "http://www.a.com/home",
  "http://www.vocab.net/label": {
    "@language": "fr",
    "@value": "a dot com"
  }

(why "http://www.vocab.net/label", not just "label"?)

I tried to see what happens with a debugger using Jsonld-java (which returns the same output).

It seems to be related to step 5.4 in
http://www.w3.org/TR/json-ld-api/#iri-compaction
which states:

"If either compact IRI is null or candidate is shorter or the same length but lexicographically less than compact IRI and candidate does not have a term definition in active context or if the term definition has an IRI mapping that equals iri and value is null, set compact IRI to candidate."

more precisely:
if the term definition has an IRI mapping that equals iri and value is null

(we are in a case where the term definition has an IRI mapping that equals iri, but value != null - I must say that I do not understand this "value != null" condition)

There is probably a good reason for that, but I feel uneasy to explain a web developer used to JSON why my JSON-LD, produced from an RDF backend, contains "homepage" for one of the keys, and "http://www.vocab.net/label" for the other.

Received on Wednesday, 13 April 2016 20:22:34 UTC