Re: [dxwg] Definition of dcat:spatialResolutionInMeters incompatible/problematic with JSON-LD (#1536)

@pchampin said:

> @gkellogg I agree that sticking to strings (with value objects or type coercion) is the easy way out in JSON-LD. But can we really convince people to give up on number in JSON? This kinds of contradict our narrative that "JSON-LD can still be used as day-to-day JSON" if we add "... expect for this or that kind of JSON".

Note that the use of decimal values, as opposed to integer or double, is really an RDF issue, which probably doesn't impact people wanting to make their existing JSON just work. We've long warned about the potential for native numbers to be misinterpreted, and to avoid built-in behavior for XSD datatypes. Generally, you _can_ interpret arbitrary JSON as JSON-LD, but absent other data typing information, there is no other good way to handle native numbers.

If we're talking about a hypothetical normative change, then sure, I think we can do better. However, the behavior in 1.0 and 1.1 is to not manipulate native values, except as defined in the To- and From-RDF algorithms. Specifically, we were wary about adding any data-type specific behavior.

In a (hypothetical) future update, which may need to be a 1.2 release due to the impact, I could see making the following changes:

* Change step 10) in the [Object to RDF Conversion Algorithm](https://www.w3.org/TR/json-ld11-api/#algorithm-13) take advantage when _datatype_ equals `xsd:decimal` and _value_ is in an appropriate range for decimal and define appropriate serialization rules there and for [8.6 Data Round Tripping](https://www.w3.org/TR/json-ld11-api/#data-round-tripping). We apparently have a similar rule in place when _datatype_ is `xsd:double`.

* Change step 2.4.3) in the [RDF to Object Conversion Algorithm](https://www.w3.org/TR/json-ld11-api/#algorithm-16) to include `xsd:decimal`, and set _type_ to `xsd:decimal`, so that it is retained in the resulting value object.

However, as these are prospective normative changes that would affect the expected behavior of already compliant processors, there are some process steps we'd need to go through to send JSON-LD API back through CR, so I don't see how it can really affect this issue.

-- 
GitHub Notification of comment by gkellogg
Please view or discuss this issue at https://github.com/w3c/dxwg/issues/1536#issuecomment-1287437419 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 21 October 2022 21:07:24 UTC