HydraCG / Specifications

Specifications created by the Hydra W3C Community Group
Other
138 stars 26 forks source link

"@type": "@id" in JSON-LD context of use cases #120

Closed elf-pavlik closed 7 years ago

elf-pavlik commented 7 years ago

as reported in https://github.com/HydraCG/Specifications/pull/113#pullrequestreview-35602303

https://www.w3.org/TR/json-ld/#h_note_1

It is worth noting that the @type keyword is not only used to specify the type of a node but also to express typed values (as described in section 6.4 Typed Values) and to type coerce values (as described in section 6.5 Type Coercion). Specifically, @type cannot be used in a context to define a node's type. For a detailed description of the differences, please refer to section 6.4 Typed Values.

alien-mcl commented 7 years ago

Hmm. I'm not a JSON-LD expert, but what about http://json-ld.org/spec/latest/json-ld/#dfn-coercion ? There is an example using same approach. The difference is the example uses an xsd:integer, which is not a class but a datatype, but this shouldn't matter. I have no issues with fixing the issues, but I'd like to be 100% sure that it is indeed an issue.

tpluscode commented 7 years ago

That's right. Coercion.

For a JSON object { "key": "value" }

"@type": "URI" means that the string value is a typed literal. Always. "@typr": "@id" means that the string value is an identifier.

elf-pavlik commented 7 years ago

@lanthaler I think I addressed most of your feedback

The difference is the example uses an xsd:integer, which is not a class but a datatype, but this shouldn't matter.

@alien-mcl it does matter, with datatype one gets a Literal and not an IRI (NamedNode). I think we can trust @lanthaler with JSON-LD nuances since he co-edited&authored that spec.

lanthaler commented 7 years ago

Anyone opposed to merging this change? If I don't hear any objection, I'll merge it in the next days

lanthaler commented 7 years ago

Thanks for these fixes @elf-pavlik