Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exemple 4 is incompatible with JSON-LD language maps #13

Open
HadrienGardeur opened this issue Feb 1, 2018 · 1 comment
Open

Exemple 4 is incompatible with JSON-LD language maps #13

HadrienGardeur opened this issue Feb 1, 2018 · 1 comment

Comments

@HadrienGardeur
Copy link

The current example 4 is not valid JSON-LD if the title is defined in the context as a language map:

"title": {
  "@id": "http://schema.org/name",
  "@container": "@language"
}

This returns the following error in the JSON-LD Playground:

jsonld.SyntaxError: Invalid JSON-LD syntax; language map values must be strings.

Duplicating the language (map + language) also feels less than ideal in these examples.

@iherman
Copy link
Member

iherman commented Feb 15, 2019

There are actually several problems with the example:

  • using a direction value leads to errors anyway, as described in Example 3 is misleading v.a.v. JSON-LD #12 (comment);
  • even if the direction term is removed it is not valid to use a language tag as a key and repeat this information in the value. Using a language tag key means that the value must be a single string (as shown in the error message)
  • a term defined to use a language map should use an object as a value and not an array (actually, I believe the example is also syntactically incorrect in pure JSON).

A proper JSON-LD example would be:

{
  "@context" : {
    "@vocab" : "http://example.org/",
    "title" : {
      "@container" : "@language"
    }
  },
  "title": {
    "en":      "Learning Web Design",
    "ar":      "التعلم على شبكة الإنترنت التصمي", 
    "ja":      "Webデザインを学ぶ",
    "zh-Hans": "学习网页设计"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants