w3c / json-ld-framing

JSON-LD 1.1 Framing Specification
https://w3c.github.io/json-ld-framing/
Other
24 stars 20 forks source link

Framing to a default language for the entire doc #156

Closed BigBlueHat closed 9 months ago

BigBlueHat commented 9 months ago

I'd hoped I could use Framing to take an incoming multilingual JSON-LD document down to a single language without having to set @language with every @value as seen in Example 13.

Here's what I tried and was sad didn't work (fwiw):

{
  "@context": [
    "https://schema.org/",
    {"@language": "en-US"}
  ],
  "name": {"@value": {}}
}

Full example at https://gist.github.com/BigBlueHat/b111cab41361e149701ff288d9186d4c

gkellogg commented 9 months ago

You should be able to do it in the value object, such as the following:

{
  "@context": [
    "https://schema.org/"
  ],
  "name": {"@value": {}, "@language": "en-US"}
}
BigBlueHat commented 9 months ago

Yeah...I know, but I'm Lazy and only want to do that once. 😄 Guessing this is a feature request then?

gkellogg commented 9 months ago

The context only has meaning to expand the frame (and re-compact the results). If you defined @language on a term in the context, it might work, but not at the top-level.

{
  "@context": [
    "https://schema.org/",
    {"name": {"@language": "en-US"}}
  ],
  "name": {}
}
BigBlueHat commented 9 months ago

Yeah...I get it. It's the repetition I'm trying to avoid, because developers will just (typically) want a single language for the whole new output document--and not want to repeat that (nor complicate the "query"/selection structure per term).

So...consider this a feature request. 😉

gkellogg commented 9 months ago

Not sure how that would be accommodated. Framing works on the expanded frame, so any notion of default language is lost.