Re: Limitations on JSON which conforms to JSON-LD spec?

I'm glad this is being discussed.  This limitation of json-ld motivated
me to join this group in the first place.  Comments below.

On Tue, 2014-12-02 at 09:44 -0800, James M Snell wrote:
> On Tue, Dec 2, 2014 at 9:17 AM, Gregg Kellogg <gregg@greggkellogg.net> wrote:
> >
> > A top-level “@container”: “@id” in a context would indicate that the keys of
> > the object containing the @context would be treated as @id values of the
> > nodes they reference. For example:
> >
> > [snip]
> 
> This is problematic in that the labels would typically not expand into
> URI's. The index tends to be more of a label (rdfs:label?
> skos:prefLabel?)

I think this would have to be handled through default-prefixing.
Something like:

{
  “@context”: {“@container”: “@id”, “@vocab”: “http://example.com/”},
  “a”:  {“b”: “c”}
}

becomes:

{
  “@id”: “http://example.com/a”,
  “b”: “c”
}

Possibly with a default behavior being document-local "#" 

{
  “@context”: {“@container”: “@id”},
  “a”:  {“b”: “c”}
}

becomes (after applying the document basename):

{
  “@id”: “example-document.jsonld#a”,
  “b”: “c”
}

> > The second proposal was to create a @reverseindex, which would treat the key
> > as an index to the properties it contains, effectively making it go away.
> > 
> > [snip]
> >
> Again, the challenge here is that "b" is not defined in a context and
> would not expand out. Given the input...

I agree, the problem that people have is that the key is important and
should not just be skipped over by either @index or the proposed
@reverseindex.

> {
>   “@context”: {
>     "properties": {
>       "@id": "urn:example:properties",
>       "@container": "@index"
>     }
>   },
>   “@id”: “a”,
>   “properties”: {
>     “b”: “c”
>   }
> }
> 
> which becomes...
> 
> {
>   "@id": "a",
>   "properties": [
>     { "@index": "b", "@value": "c" }
>   ]
> }
> 
> and expands out to
> 
> <a> <urn:example:properties> [
>   a rdfs:Literal ;
>      rdfs:label "b" ;
>      rdf:value "c" .
> ] .
> 
> The nice thing is that it would not require any syntax changes to
> JSON-LD (The change to support this would be limited to the JSON-LD
> algorithms).

+1 except that I would suggest that you should be able to specify an
arbitrary predicate and not only rdfs:label.

- Peter

Received on Tuesday, 2 December 2014 19:17:44 UTC