w3c / json-ld-bp

JSON-LD 1.1 Best Practices Note
https://w3c.github.io/json-ld-bp/
Other
21 stars 7 forks source link

Avoid CURIEs in the data #19

Open dlongley opened 4 years ago

dlongley commented 4 years ago

Prefer short idiomatic JSON terms.

ajs6f commented 4 years ago

"Idiomatic" in the sense of a single term without internal structure?

BigBlueHat commented 4 years ago

Relates to #13

BigBlueHat commented 4 years ago

@ajs6f think this is very similar to #18 that you posted.

dlongley commented 4 years ago

If you have consumers from the JSON world (vs. only the RDF world), it is much better to use idiomatic JSON and avoid CURIEs, etc.

azaroth42 commented 4 years ago

Per the discussion on the call today, I think this clearly applies to keys - use {'title': "Title!"} if possible and not {"dc:title": "Title!"}

However it is less clear, and worth discussing, the extent to which it applies to values. For example:

{
  "type": "HumanMadeObject",
  "classified_as": "http://vocab.getty.edu/aat/painting"
}

Should the value of classified_as be a URI (because you can dereference it to get more information), a CURIE (because aat:painting is shorter and easier to read without having to enumerate all the possible classifications), or an @vocab value in the context, because painting is even shorter and easier).

In https://linked.art/model/ we use the full URI, in order to facilitate the dereferencing. In IIIF (eg https://iiif.io/api/presentation/3.0/#type, https://iiif.io/api/presentation/3.0/#behavior, etc) we use @vocab.

ajs6f commented 4 years ago

I'm not sure that we really can or should say very much about values. It's easy for me to think of cases where a CURIE would be better, because the URI is never going to be de-referenced (perhaps the values are really being used as enumerable choices in some UI or processing system) but the data will be inspected by humans. On the other hand, it's easy to think of cases where using a CURIE would be useless or downright harmful because the data is primarily for machine processing. I don't think we (the WG) can have enough context to make a useful recommendation here.

Keys, of course, are a different story and I completely agree that CURIES there are un-idiomatic and just scream that the data is secretly XML or RDF that has been cheaply or thoughtlessly "JSON-ed". I would be happy to send a PR for this, but it won't be for at least a few days (we're heading into winter holidays here and scheduling is getting hectic!).