Skip to content

Value expansion with a native number and term mapping of @type: @id or @type: @vocab creates an IRI, and does not retain the native value #470

Closed
@gkellogg

Description

@gkellogg

The way that the Value Expansion algorithm, steps 1 and 2 always construct node reference, even if value is not a string, which is pretty odd.

This came up in ShEx, where the term max can take an integer, or the vocabulary term unbounded, to represent unbounded cardinality:

{"@context": {
  "shex": "http://shex.io/ns/shex#",
  "max": {"@id": "shex:max", "@type": "@vocab"},
  "unbounded": "shex:unbounded"},
  "max": 2
}

Generally, when expanding a native value, it is retained, in this case, it results in the following:

[
  {
    "http://shex.io/ns/shex#max": [
      {
        "@id": "http://json-ld.org/playground/2"
      }
    ]
  }
]

I think instead, it should retain the value and expand as follows:

[
  {
    "http://shex.io/ns/shex#max": [
      {
        "@value": 2
      }
    ]
  }
]

This should stand for true/false and null as well, to be consistent. Corrective text would be to add ", and value is a string" to steps 1) and 2).

If the present behavior were intended (not as far as I remember), then it should have had text about coercing value to a string. There is provision in IRI expansion for a null value, but nothing else.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions