w3c / hcls-fhir-rdf

Sketching out an RDF representation for FHIR
39 stars 15 forks source link

Distinguish int, decimal and double numbers in FHIR JSON preprocessor #99

Closed dbooth-boston closed 11 months ago

dbooth-boston commented 2 years ago

JSON numbers as literals are essentially a union of xsd:int, xsd:decimal and xsd:double.

Should we make the preprocessor do a runtime check of each JSON number, to emit it as one of those three types, rather than defaulting to emitting them all as xsd:double?

ericprud commented 1 year ago
    if (nestScalar.type === "NodeConstraint") {
      typedValue = {
        "@type": nestScalar.datatype.replace(/^http:\/\/www\.w3\.org\/2001\/XMLSchema#/, "xsd:"),
        "@value": jsonValue,
      };
    } …

https://github.com/fhircat/fhir-rdf-playground/blob/7b79da834bb6b86e40a25586ff019df8ec0fdde9/fhirlib/FhirPreprocessors.js#L290

dbooth-boston commented 1 year ago

Excellent. I think this change is now ready for me to document.

dbooth-boston commented 11 months ago

Done in R5