W3C home > Mailing lists > Public > public-linked-json@w3.org > July 2014

Re: where to put json-ld context for LDP

From: Stian Soiland-Reyes <soiland-reyes@cs.manchester.ac.uk>
Date: Tue, 29 Jul 2014 11:16:08 +0100
Message-ID: <CAPRnXtnode+ock-ZH3jsMG9BYLBKxvQ6F3goVngJYKiMKCy=GQ@mail.gmail.com>
To: Gregg Kellogg <gregg@greggkellogg.net>
Cc: Robert Sanderson <azaroth42@gmail.com>, Sandro Hawke <sandro@hawke.org>, Sandro Hawke <sandro@w3.org>, JSON-LD CG <public-linked-json@w3.org>
If you are worried about namespace pollution for users of the remote
context, then you can always hand-craft a localized @context like:

{
  "@context" : {
    "t1": "http://example.org/#term1",
    "t2": "http://example.org/#Term2"
  },
  "@id": "http://example.com/vocab.jsonld",
  "http://www.w3.org/2000/01/rdf-schema#comment": "JSON-LD context for
http://example.com/vocab vocabulary, including the definitions in
RDFS/OWL",
  "http://www.w3.org/2000/01/rdf-schema#seeAlso": {
      "@context": {
        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
        "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
        "owl": "http://www.w3.org/2002/07/owl#",
        "xsd": "http://www.w3.org/2001/XMLSchema#",
        "defines": { "@reverse":
"http://www.w3.org/2000/01/rdf-schema#isDefinedBy"},
        "@base": "http://example.com/vocab"
      },
      "@id": "http://example.com/vocab",
      "@type": "owl:Ontology",
      "defines": [
        {
          "@id": "#term1",
          "@type": "owl:ObjectProperty",
          "rdfs:domain": {"@id": "#Term2"}
        },
        {
          "@id": "#Term2",
          "@type": "owl:Class"
        }
      ]
    }
}

Remote requesters will only be importing the upper-most "@context".
Interpreted as JSON-LD to triples, this becomes basically the OWL
ontology:

<http://example.com/vocab#Term2>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://www.w3.org/2002/07/owl#Class> .
<http://example.com/vocab#Term2>
<http://www.w3.org/2000/01/rdf-schema#isDefinedBy>
<http://example.com/vocab> .
<http://example.com/vocab#term1>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://www.w3.org/2002/07/owl#ObjectProperty> .
<http://example.com/vocab#term1>
<http://www.w3.org/2000/01/rdf-schema#domain>
<http://example.com/vocab#Term2> .
<http://example.com/vocab#term1>
<http://www.w3.org/2000/01/rdf-schema#isDefinedBy>
<http://example.com/vocab> .
<http://example.com/vocab.jsonld>
<http://www.w3.org/2000/01/rdf-schema#comment> "JSON-LD context for
http://example.com/vocab vocabulary, including the definitions in
RDFS/OWL" .
<http://example.com/vocab.jsonld>
<http://www.w3.org/2000/01/rdf-schema#seeAlso>
<http://example.com/vocab> .
<http://example.com/vocab>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://www.w3.org/2002/07/owl#Ontology> .

If you don't have a URI for the JSON-LD context <vocab.jsonld>, you
can remove the upper "@id" to turn the initial subject into an
anonymous bnode.


On 29 July 2014 01:08, Gregg Kellogg <gregg@greggkellogg.net> wrote:
> On Jul 28, 2014, at 11:23 AM, Robert Sanderson <azaroth42@gmail.com> wrote:
>
>
> Hi Sandro,
>
>>>> Any thoughts on where they should go?
>>>
>>> If the context is part of a JSON-LD encoding of the vocabulary, then
>>> retrieving the vocabulary from it's published location with
>>> content-negotiation for JSON-LD will also retrieve the context.
>>
>>
>> Hmmm.   I would have thought the context use in a vocabulary description
>> document would be a context that was good for describing vocabularies.  But
>> now you're saying it should actually be one that's good for describing
>> whatever the vocabulary describes.  How do we make this work?
>
>
> You would just need to include owl, rdf, rdfs, skos (as appropriate) in the
> context along with whatever LDP needs.
>
>
> Yes, you can do this with basic prefix mappings (don't forget xsd), but it
> is also useful to include some things that aren't specifically part of the
> vocabulary being defined as well. I include the following in contexts I
> generate:
>
> {
>   "@context": {
>     "@vocab": "-- uri of this vocabulary --",
>     "owl": "...",
>     "rdf": "....",
>     "rdfs": "....",
>     "xsd": "....",
>     "rdfs:domain": {"@type": "@id", "@container": "@list"},
>     "rdfs:range": {"@type": "@id", "@container": "@list"},
>     "rdfs:subClassOf": {"@type": "@id", "@container": "@list"},
>     "rdfs:subPropertyOf": {"@type": "@id", "@container": "@list"},
>     ...
>   }
> }
>
> We could consider a boilerplate context, which would gather such common
> definitions together, then you could do something like the following:
>
> {
>   "@context": [
>     "http://www.w3.org/ns/rdfs",
>     {
>       "@vocab": "http://www.w3.org/ns/ldp#",
>       "ldp":  "http://www.w3.org/ns/ldp#",
>       ...
>     }
>   }
> }
>
> And put all of the RDFS-related definitions in a single location.
>
>>  Do we have the context include stuff not needed by LDP?
>
>
> Yes.
>
>>
>>  Do we have the LDP namespace document be written so that it doesn't
>> actually make any use of the context provided?
>
>
> You could do this -- just include the full URIs for all of the predicates
> needed, and then no need to include even prefix mapping in the context. I'm
> not sure that there's any benefit to doing this though.
>
>>
>>   Do we use multiple contexts?
>
>
> No (see previous discussion about multiple contexts and framing /
> compaction)
>
>
> +1 What Rob said.
>
> Gregg
>
> Rob
>
> --
> Rob Sanderson
> Technology Collaboration Facilitator
> Digital Library Systems and Services
> Stanford, CA 94305
>
>



-- 
Stian Soiland-Reyes, myGrid team
School of Computer Science
The University of Manchester
http://soiland-reyes.com/stian/work/ http://orcid.org/0000-0001-9842-9718
Received on Tuesday, 29 July 2014 10:16:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:42 UTC