Re: Providing the @type in the @context for a value

Hi James,

You are not missing anything, that's not possible using JSON-LD.

There have been several requests for this sort of functionality, but it
falls out of scope as it creates new data or transforms data, which is out
of scope of the functionality of a context document.
For example, these issues were rejected for this reason:

https://github.com/w3c/json-ld-syntax/issues?q=+is%3Aissue+label%3A%22out+of+scope%3A+transformation%22+

Rob


On Fri, May 1, 2020 at 6:58 AM James Hudson <jameshudson3010@gmail.com>
wrote:

> Hello,
>
> Either this is not possible or I am missing something obvious. I am not
> sure which.
>
> I have the following json-ld document:
>
>     {
>         "@id": "ex:Bobe",
>         "@type": "ex:MyType",
>         "@context": {
>             "ex": "http://example.com/",
>             "yyyy": "ex:yyyy",
>             "name": "ex:name",
>             "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
>             "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
>             "sch": "http://schema.org/",
>             "xml": "http://www.w3.org/XML/1998/namespace",
>             "xsd": "http://www.w3.org/2001/XMLSchema#"
>         },
>         "yyyy": {
>             "@type": "ex:XXXX",
>             "name": "my name"
>         }
>     }
>
> which has the following RDF representation:
> ( using https://github.com/RDFLib/rdflib )
>
>     @prefix ex: <http://example.com/> .
>     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>     @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>     @prefix sch: <http://schema.org/> .
>     @prefix xml: <http://www.w3.org/XML/1998/namespace> .
>     @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
>
>     ex:Bobe a ex:MyType ;
>         ex:yyyy [ a ex:XXXX ;
>                 ex:name "my name" ] .
>
> What I would like to be able to do is write "yyyy": { ... } as
>
>     "yyyy": {
>         "name": "my name"
>     }
>
> and have "@type": "ex:XXXX" specified in the "@context".
>
> Is this possible?
>
> What I have tried:
>
>     {
>         "@id": "ex:Bobe",
>         "@type": "ex:MyType",
>         "@context": {
>             "ex": "http://example.com/",
>             "yyyy": {
>                 "@id": "ex:yyyy",
>                 "@type": "ex:XXXX"
>             },
>             "name": "ex:name",
>             "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
>             "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
>             "sch": "http://schema.org/",
>             "xml": "http://www.w3.org/XML/1998/namespace",
>             "xsd": "http://www.w3.org/2001/XMLSchema#"
>         },
>         "yyyy": {
>             "name": "my name"
>         }
>     }
>
> which has the following RDF representation:
> ( using https://github.com/RDFLib/rdflib )
>
>     @prefix ex: <http://example.com/> . a
>     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>     @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>     @prefix sch: <http://schema.org/> .
>     @prefix xml: <http://www.w3.org/XML/1998/namespace> .
>     @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
>
>     ex:Bobe a ex:MyType ;
>         ex:yyyy [ ex:name "my name" ] .
>
> The N-Quad representation on the JSON-LD Playground is:
>
>     <http://example.com/Bobe> <http://example.com/yyyy> _:b0 .
>     <http://example.com/Bobe> <
> http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
> http://example.com/MyType> .
>     _:b0 <http://example.com/name> "my name" .
>
>
> The "@type" information is lost.
>
> Regards,
> James
>
>
>

-- 
Rob Sanderson
Semantic Architect
The Getty Trust
Los Angeles, CA 90049

Received on Friday, 1 May 2020 17:14:54 UTC