Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] PCF decimal datatype's representation in JSON is not aligned with WBCSD's JSON representation #264

Closed
miwamasa opened this issue Nov 13, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@miwamasa
Copy link

Describe the bug
According to WBCSD's specification of PCF data ,
Technical Specifications for PCF Data Exchange (Version 2.0.1-20230927)

the "fossilGhgEmissions" is defined as "Decimal" which is further described in JSON representation it MUST be encoded as a JSON String.

image

In 4.01/Pcf.ttl, fossilGhgEmissions has characteristic of "PositiveEmissionsTrait;" which has the base characteristic "PositiveEmission" which is bamm:dataType xsd:decimal.

But the json-schema translation which is gen/json-schema.json, says it is number in json.

      "urn_bamm_io.catenax.pcf_4.0.1_PositiveEmissionsTrait" : {
        "type" : "number",

Where
Your "fossilGhgEmissions" as json number is not aligned with the WBCSD's definition as JSON String

I guess, the WBCSD's specification of Decimal is precision wise numeric data type, so it is represented as JSON String for avoiding errors like 0.1+0.2!=0.3

FYI: this is what happened in python, this kind of error is not preferable for precision wise numeric type:
image

Additional context
Other property which has "Decimal" or variants may have the same issue.

FYI: In the OData v4(which is database community standard), the precision-wise data type is Edm.Decimal which is converted to JSON String or number, depending on the option IEEE754Compatible=true or false.

image

@miwamasa miwamasa added the bug Something isn't working label Nov 13, 2023
@miwamasa
Copy link
Author

This is duplicate of #262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant