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

blind spot in RDF to object conversion #555

Open
pchampin opened this issue Dec 13, 2022 · 5 comments · May be fixed by #619
Open

blind spot in RDF to object conversion #555

pchampin opened this issue Dec 13, 2022 · 5 comments · May be fixed by #619
Assignees

Comments

@pchampin
Copy link
Contributor

pchampin commented Dec 13, 2022

I believe that the RDF to object conversion, step 2.4.3, has a blind spot.
This is in the case useNativeTypes is used:

if the datatype IRI of value equals xsd:integer or xsd:double and its lexical form is a valid xsd:integer or xsd:double according [XMLSCHEMA11-2], set converted value to the result of converting the lexical form to a JSON number.

The problem is: some valid literals of these datatypes may fail to convert to JSON numbers, e.g. "+INF"^^xsd:double, or very large integers.

The spec is currently silent about that. We should either specify that an error must be raised, or that useNativeType should be ignored in that case, and a regular value object should be generated. I personally prefer the 2nd option.

@gkellogg
Copy link
Member

We should probably be using logic from JCS for dividing these different forms.

@pchampin
Copy link
Contributor Author

Sorry, what do you mean by "JCS"?

@gkellogg
Copy link
Member

JSON Canonicalization, which we use when serializing JSON literals

@pchampin
Copy link
Contributor Author

pchampin commented Jan 9, 2023

JSON Canonicalization, which we use when serializing JSON literals

ah... thanks

JCS Appendix D. Dealing with Big Numbers says

numbers that do not have a natural place in the current JSON ecosystem MUST be wrapped using the JSON string type.

This is aligned with my suggestion above: whenever a literal can not be mapped to a JSON number, ignore useNativeType and keep it as a value object with explicit @value (as a string) and @type.

@anatoly-scherbakov
Copy link

anatoly-scherbakov commented Nov 8, 2024

I tried to cover this with a PR: #619

I don't think I can assign this issue to me though 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Errata
Development

Successfully merging a pull request may close this issue.

3 participants