-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
Description
Multilingual values in JSON-LD is currently best handled by using the rdf:HTML
datatype on a value in JSON-LD. However, that currently cannot be used alongside language maps.
The following example is cribbed from https://github.com/w3c/wpub/issues/299 + the addition of @none
:
{
"@context": {
"occupation": { "@id": "ex:occupation", "@container": "@language" },
"description": "ex:description"
},
"name": "Yagyū Muneyoshi",
"occupation": {
"ja": "忍者",
"en": "Ninja",
"cs": "Nindža",
"@none": "<span lang=en>Ninja in japanese: <span lang=jp>忍者</span>"
}
}
The output n-quads looks like:
_:b0 <ex:occupation> "<span lang=en>Ninja in japanese: <span lang=jp>忍者</span>" .
_:b0 <ex:occupation> "Nindža"@cs .
_:b0 <ex:occupation> "Ninja"@en .
_:b0 <ex:occupation> "忍者"@ja .
If the content is in fact multilingual, then that first triple should look like:
_:b0 <ex:occupation> "<span lang=en>Ninja in japanese: <span lang=jp>忍者</span>" ^^rdf:HTML.
The first alternative I tried to express this was:
{
"occupation": {
"ja": "忍者",
"en": "Ninja",
"cs": "Nindža",
"@none": {
"@value": "<span lang=en>Ninja in japanese: <span lang=jp>忍者</span>",
"@type": "rdf:HTML"
}
}
}
Which currently throws:
jsonld.SyntaxError: Invalid JSON-LD syntax; language map values must be strings.
Given that rdf:HTML
is the current recommendation for multilingual content in RDF, JSON, YAML, etc, I'd propose we find ways to express rdf:HTML
(and perhaps future datatypes) as the type of @none
would found in a language map--at the @context
level and/or within the data.
Cheers!
🎩