w3c / w3c/json-ld-syntax

Specify a node type when interpreting JSON as JSON-LD (was: use of "@type" in "@context")

Open
#386 19 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
139
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Question

It's not clear to me if it's legitimate to use @type in @context instead of in the JSON object, eg.

"@context":
  "@vocab": "https://schema.org/",
  birthplace:
    "@type": "City"
birthplace:
  name: Roma

since the jsonld playground renders this as

_:c14n0 <https://schema.org/birthplace> _:c14n1 .
_:c14n1 <https://schema.org/name> "Roma" .

while I expect

_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org/City> .
_:c14n0 <https://schema.org/name> "Roma" .
_:c14n1 <https://schema.org/birthplace> _:c14n0 .

Note

changing the payload to

"birthplace": "Roma"

results in

_:c14n0 <https://schema.org/birthplace> "Roma"^^<https://schema.org/City> .

meaning that in some way the "City" type is processed in some way.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the JSON-LD 1.1 specification and the JSON-LD Playground behavior shown in the issue. Compare the two supplied JSON-LD examples and their resulting RDF, then determine whether the specification needs clarification or a correction. Done means the expected interpretation is resolved and the specification or examples clearly document it.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.