-
Notifications
You must be signed in to change notification settings - Fork 6
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
Integers turned into longs #63
Comments
Yeah ok fair-cop :-) I believe Is this a real problem for you though? I've not looked but I suspect I know what is happening. Basically in clojure the default numeric integer type for values within a 64bit range is a I'm sure we can fix this to coerce to a default bignum / Also triplestores may coerce all numeric values to |
You're right, I should've said We noticed it in a PR: https://github.com/GSS-Cogs/gss-utils/pull/306#discussion_r686084733 I was trying to match the example in the spec: https://www.w3.org/TR/vocab-data-cube/#attachment-example It's a bit surprising that some JSON(LD) bare integer literal value gets turned into an E.g.:
ends up as
rather than
I would expect that when parsing the JSON-LD you would map to the equivalent Clojure representation and/or keep the type so that it round trips properly, rather than leaving it to Clojure to guess that small numbers fit into fewer bits :) It's not a biggie, just unexpected. It doesn't affect us particularly, though we will NEED TO CHANGE THE TEST if you fix it! |
As far as I know we do this higher up. I suspect the bug is that we're just running with the type that our JSON parser has given us, and it will I'd imagine give us a Long (as that's the default in clojure). i.e. the bug is I think that JSON-LD wants us to assume a default of bignum during our JSON parse; rather than what we're doing which is assume it's either a long or bignum. Which is arguably better, but not what the spec says. i.e. a fix would I think be to coerce all integers in the JSON tree to bignums before reinterpreting the types with the context. |
When I adding extra metadata in
-metadata.json
, I expect that the metadata to be parsed as per the JSON-LD rules and turned into RDF, which for the most part appears ok.However for simple numerical values as in the attachment (see
"qb:order": 1
etc.), I would expect the resulting RDF to beqb:order 1
where the value's datatype is the default ofxsd:int
, whereascsv2rdf
outputsqb:order "1"^^xsd:long
.example.zip
The text was updated successfully, but these errors were encountered: