Re: Are property-scoped contexts allowed for nested properties in JSON-LD 1.1?

> On Feb 18, 2020, at 7:23 AM, Niklas Lindström <lindstream@gmail.com> wrote:
> 
> Dear all,
> 
> Is it by design, or by some limitation in the algorithm (which may still be rephrased?), that nested properties cannot have property-scoped contexts in JSON-LD 1.1?
> 
> It seems that neither the JSON-LD 1.1 Playground nor Gregg's distiller supports this (i.e. the property-scoped contexts in the nest properties have no effect on the expansion):
> 
> - - - 8< - - -
> 
> {
>   "@context": {
>     "@vocab": "http://purl.org/dc/terms/ <http://purl.org/dc/terms/>",
>     "bibo": "http://purl.org/ontology/bibo/ <http://purl.org/ontology/bibo/>",
>     "@version": 1.1,
>     "Print": "bibo:Book",
>     "name": "http://www.w3.org/2000/01/rdf-schema#label <http://www.w3.org/2000/01/rdf-schema#label>",
>     "instanceOf": "@nest",
>     "contributionByRole": {
>       "@id": "@nest",
>       "@context": {
>         "agent": "@nest",
>         "aut": "creator"
>       }
>     },
>     "provisionActivityByType": {
>       "@id": "@nest",
>       "@context": {
>         "Publication": {
>           "@id": "@nest",
>           "@context": {"date": "published", "agent": "publisher"}
>         }
>       }
>     },
>     "identifiedByType": {
>       "@id": "@nest",
>       "@context": {
>         "Isbn": {"@id": "@nest"},
>         "value": "bibo:isbn"
>       }
>     }
>   }
> ,  "@id": "book/one",
>   "@type": "Print",
>   "instanceOf": {
>     "contributionByRole": {
>       "aut": {
>         "agent": {"name": "Some Body"}
>       }
>     }
>   },
>   "identifiedByType": {
>     "Isbn": {
>       "value": "1234567890"
>     }
>   },
>   "provisionActivityByType": {
>     "Publication": {
>       "date": "1999",
>       "agent": {"name": "PubCorp"}
>     }
>   }
> }
> 
> - - - >8 - - -
> 
> I am attempting a "neat trick" here, by compacting BibFrame data into maps (see [2]), and then *swapping out* the context with another one mapping to DC+BIBO, as per the context snippet above, using nests with local contexts to treat the same JSON semantically differently.
> 
> I'm pursuing multiple venues here, I just hoped that this "poor man's inference trick" might prove fruitful. Also, in general, it might be beneficial to consider (in the WG) whether this limitation on nests is by design or simply an oversight. I know of the feature freeze, it's just not obvious to me whether the Syntax prohibits this or if the algorithm in the API spec misses an opportunity.

Hi Niklas, it’s good to have your attention on the spec and work on another processor.

There was no specific intention to _not_ support this, but looking at the expansion algorithm, it brings up more considerations: for example, we don’t support @context at the top-level of nested properties either.

Nominally, to do what you want would be to duplicate step 8 (including seeing if the key expanding to @nest has an @context defined on it), and see if nesting-key has an embedded context defined, and update active context for the recursive steps; we’d also need to revert after 14.2. Similar steps would be required in the compaction algorithm. We’d also need to consider if we wanted to act on an @context member of _nested value_ after 14.2.2, and exclude the recursive step in that case.

It would be a fairly big change, IMO, and given that we’re about to release an updated CR, probably too late to do it.

I’d suggest you raise an issue for tracking purposes; we can discuss, but I suspect it would be marked “defer-future-version” at this point.

Gregg

> Best regards,
> Niklas
> 
> PS. After a prolonged hiatus, I'm happy to have *finally* spent some quality time with the JSON-LD 1.1 spec, mainly by working on an expansion implementation for rdflib_jsonld [3] (currently passing about 80% of the toRdf specs).
> 
> [1]: https://json-ld.org/playground/#startTab=tab-compacted&json-ld=%7B%22%40context%22%3A%7B%22%40vocab%22%3A%22http%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%22%2C%22bibo%22%3A%22http%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%22%2C%22%40version%22%3A1.1%2C%22Print%22%3A%22bibo%3ABook%22%2C%22name%22%3A%22http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label%22%2C%22instanceOf%22%3A%22%40nest%22%2C%22contributionByRole%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22agent%22%3A%22%40nest%22%2C%22aut%22%3A%22creator%22%7D%7D%2C%22provisionActivityByType%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22Publication%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22date%22%3A%22published%22%2C%22agent%22%3A%22publisher%22%7D%7D%7D%7D%2C%22identifiedByType%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22Isbn%22%3A%7B%22%40id%22%3A%22%40nest%22%7D%2C%22value%22%3A%22bibo%3Aisbn%22%7D%7D%7D%2C%22%40id%22%3A%22book%2Fone%22%2C%22%40type%22%3A%22Print%22%2C%22instanceOf%22%3A%7B%22contributionByRole%22%3A%7B%22aut%22%3A%7B%22agent%22%3A%7B%22name%22%3A%22Some%20Body%22%7D%7D%7D%7D%2C%22identifiedByType%22%3A%7B%22Isbn%22%3A%7B%22value%22%3A%221234567890%22%7D%7D%2C%22provisionActivityByType%22%3A%7B%22Publication%22%3A%7B%22date%22%3A%221999%22%2C%22agent%22%3A%7B%22name%22%3A%22PubCorp%22%7D%7D%7D%7D&context=%7B%22%40context%22%3A%7B%22%40vocab%22%3A%22http%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%22%2C%22bibo%22%3A%22http%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%22%2C%22name%22%3A%22http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label%22%7D%7D <https://json-ld.org/playground/#startTab=tab-compacted&json-ld={"@context":{"@vocab":"http://purl.org/dc/terms/","bibo":"http://purl.org/ontology/bibo/","@version":1.1,"Print":"bibo:Book","name":"http://www.w3.org/2000/01/rdf-schema#label","instanceOf":"@nest","contributionByRole":{"@id":"@nest","@context":{"agent":"@nest","aut":"creator"}},"provisionActivityByType":{"@id":"@nest","@context":{"Publication":{"@id":"@nest","@context":{"date":"published","agent":"publisher"}}}},"identifiedByType":{"@id":"@nest","@context":{"Isbn":{"@id":"@nest"},"value":"bibo:isbn"}}},"@id":"book/one","@type":"Print","instanceOf":{"contributionByRole":{"aut":{"agent":{"name":"Some Body"}}}},"identifiedByType":{"Isbn":{"value":"1234567890"}},"provisionActivityByType":{"Publication":{"date":"1999","agent":{"name":"PubCorp"}}}}&context={"@context":{"@vocab":"http://purl.org/dc/terms/","bibo":"http://purl.org/ontology/bibo/","name":"http://www.w3.org/2000/01/rdf-schema#label"}}>
> 
> [2]: https://json-ld.org/playground/#startTab=tab-compacted&json-ld=%7B%22%40context%22%3A%7B%22%40vocab%22%3A%22http%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%22%2C%22bibo%22%3A%22http%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%22%2C%22%40version%22%3A1.1%2C%22Print%22%3A%22bibo%3ABook%22%2C%22name%22%3A%22http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label%22%2C%22instanceOf%22%3A%22%40nest%22%2C%22contributionByRole%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22agent%22%3A%22%40nest%22%2C%22aut%22%3A%22creator%22%7D%7D%2C%22provisionActivityByType%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22Publication%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22date%22%3A%22published%22%2C%22agent%22%3A%22publisher%22%7D%7D%7D%7D%2C%22identifiedByType%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22Isbn%22%3A%7B%22%40id%22%3A%22%40nest%22%7D%2C%22value%22%3A%22bibo%3Aisbn%22%7D%7D%7D%2C%22%40id%22%3A%22book%2Fone%22%2C%22%40type%22%3A%22Print%22%2C%22instanceOf%22%3A%7B%22contributionByRole%22%3A%7B%22aut%22%3A%7B%22agent%22%3A%7B%22name%22%3A%22Some%20Body%22%7D%7D%7D%7D%2C%22identifiedByType%22%3A%7B%22Isbn%22%3A%7B%22value%22%3A%221234567890%22%7D%7D%2C%22provisionActivityByType%22%3A%7B%22Publication%22%3A%7B%22date%22%3A%221999%22%2C%22agent%22%3A%7B%22name%22%3A%22PubCorp%22%7D%7D%7D%7D&context=%7B%22%40context%22%3A%7B%22%40vocab%22%3A%22http%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%22%2C%22bibo%22%3A%22http%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%22%2C%22name%22%3A%22http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label%22%7D%7D <https://json-ld.org/playground/#startTab=tab-compacted&json-ld=%7B%22%40context%22%3A%7B%22%40vocab%22%3A%22http%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%22%2C%22bibo%22%3A%22http%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%22%2C%22%40version%22%3A1.1%2C%22Print%22%3A%22bibo%3ABook%22%2C%22name%22%3A%22http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label%22%2C%22instanceOf%22%3A%22%40nest%22%2C%22contributionByRole%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22agent%22%3A%22%40nest%22%2C%22aut%22%3A%22creator%22%7D%7D%2C%22provisionActivityByType%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22Publication%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22date%22%3A%22published%22%2C%22agent%22%3A%22publisher%22%7D%7D%7D%7D%2C%22identifiedByType%22%3A%7B%22%40id%22%3A%22%40nest%22%2C%22%40context%22%3A%7B%22Isbn%22%3A%7B%22%40id%22%3A%22%40nest%22%7D%2C%22value%22%3A%22bibo%3Aisbn%22%7D%7D%7D%2C%22%40id%22%3A%22book%2Fone%22%2C%22%40type%22%3A%22Print%22%2C%22instanceOf%22%3A%7B%22contributionByRole%22%3A%7B%22aut%22%3A%7B%22agent%22%3A%7B%22name%22%3A%22Some%20Body%22%7D%7D%7D%7D%2C%22identifiedByType%22%3A%7B%22Isbn%22%3A%7B%22value%22%3A%221234567890%22%7D%7D%2C%22provisionActivityByType%22%3A%7B%22Publication%22%3A%7B%22date%22%3A%221999%22%2C%22agent%22%3A%7B%22name%22%3A%22PubCorp%22%7D%7D%7D%7D&context=%7B%22%40context%22%3A%7B%22%40vocab%22%3A%22http%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%22%2C%22bibo%22%3A%22http%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%22%2C%22name%22%3A%22http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label%22%7D%7D>
> 
> [3]: https://github.com/RDFLib/rdflib-jsonld/pull/74 <https://github.com/RDFLib/rdflib-jsonld/pull/74>

Received on Tuesday, 18 February 2020 20:05:38 UTC