Skip to content

Type coercion using xsd equivalents for native JSON datatypes leads to unexpected results #464

@trwnh

Description

@trwnh

Input:

{
  "@context": {"foo": {"@id": "http://foo.example", "@type": "http://www.w3.org/2001/XMLSchema#boolean"}},
  "foo": true
}

Compacted against:

{
  "@context": {"foo": {"@id": "http://foo.example"}},
}

Results in:

{
  "@context": {"foo": {"@id": "http://foo.example"}},
  "foo": {
    "@type": "http://www.w3.org/2001/XMLSchema#boolean",
    "@value": true
  }
}

There might be an extremely fine semantic distinction here, but isn't {"@value": true} supposed to be semantically equivalent to {"@value": true, "@type": "http://www.w3.org/2001/XMLSchema#boolean"}? I understand that "true" can be coerced to a boolean, but true is already a boolean. There seems to be a disconnect between the native datatype and the @type, where native JSON datatypes have an implicit @type corresponding to xsd, but explicitly applying this type can do weird things with compaction depending on whether or not your context includes the @type in the term definition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions