Skip to content

Language maps on literals with no language don't play well together #480

Closed
@gkellogg

Description

@gkellogg

As described in this email, mixing literals having language, with those not having a language in a language map creates an odd structure when compacting:

If a string is associated with a property defined as a languageMap, but
does not have a language associated with it, it creates two keys in the
JSON ... the langStrings go in one, and the non-langStrings in another.
This is unintuitive and exposes some of the weirdest weirdness of RDF
(langStrings) to unsuspecting JSON developers.

A proposal to discuss:

If compaction would result in an attempt to add a string without an
associated language into a LanguageMap, then the processor SHOULD assign
the undefined language code UND as the key in the array.

Thus,
_:x rdfs:label "Fish"@en, "Poisson"@fr, "51234" .

Would result in:

{
"@id": "_:x",
"label": {"en": "Fish", "fr": "Poisson", "UND": "51234"}
}

Rather than the current compaction result:

{
"@id": "_:x",
"label": {"en": "Fish", "fr": "Poisson"},
"rdfs:label": "51234"
}

Notes:

  • PHP does not support "" as a key in a dictionary, and thus UND as the key
  • This does not propose an inverse expansion rule, in case someone has an
    explicit @und langString [seems unlikely], where it should not become a
    regular xsd:string

References:

digitalbazaar/jsonld.js#151
IIIF/api#755

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions