Improve test fromRdf#t0027.#669
Conversation
- Improving the test coverage for use useNativeTypes algorithm in 8.5.2 2.4. - Remove the "True" and "False" boolean tests that can cause confusion that those words are special values. - Add tests using a value of "notnative" typed to boolean, integer, and double. These test that the type will be preserved when a native conversion does not happen.
|
I see it now, the original test suite only considered I would keep the
which could incorrectly coerce capitalized |
Restoring True and False tests to check only strict lexical values are converted to native values.
Ok. More tests are always good. Hopefully others don't get confused like I did and try to special case those values. |
niklasl
left a comment
There was a problem hiding this comment.
LGTM.
Note though, that in RDF 1.2, the requirement in RDF 1.1 (3.3, bullet point 2 b) to produce graphs containing ill-typed values is relaxed from a MUST to a SHOULD in the upcoming RDF 1.2 (3.4.2, bullet point 3.2). So an RDF 1.2 processor might drop those True|False|notnative tokens since they aren't in their respective value spaces. (But they shouldn't...)
pchampin
left a comment
There was a problem hiding this comment.
NB: my proposed change is just a suggestion, to respond to @davidlehn 's concern.
But I'm happy with the PR as it is.
Co-authored-by: Pierre-Antoine Champin <pierre-antoine@w3.org>
|
This was discussed during the #json-ld meeting on 10 June 2026. View the transcriptPull Request 669 Improve test fromRdf#t0027. (by davidlehn) [needs discussion]bigbluehat: approved by two people anatoly-scherbakov: could we setup an automerge after a given number of approval? bigbluehat: not sure about that; there are different kinds of approval pchampin: the reason I put the "needs discussion" label is that it was approved a long time ago, no reason to let it linger anatoly-scherbakov: the reason I suggest auto-merge is that the probability to merge is high if several people approve and no one objects bigbluehat: a reason we are slow is that PRs have been stacking up for a long time, which also takes us time to "restore context" <Zakim> TallTed, you wanted to speak antiautomerge TallTed: I'm usually on the side of letting automation help the human pchampin: +1 to what TallTed and bigbluehat have said bigbluehat: I would like to see us do this more often <TallTed> converting PR comments to new issues is a GREAT feature I've been using for some months if not years dlehn: we just merged a comment in an n-quads file, which previously had no comment. bigbluehat: I think we will figure out :) |
I was fixing jsonld.js for fromRdf#t0027 and thought the tests could use some work to increase covearge.
https://github.com/w3c/json-ld-api/blob/main/tests/fromRdf/0027-in.nq
https://github.com/w3c/json-ld-api/blob/main/tests/fromRdf/0027-out.jsonld
I initially mistakenly tried to add specific support for the "True"/"False" tests:
But those are, I think, just testing that any not-native value is passed through even though it may not match semantics of the type. I think some other value text should be used to avoid confusion. For consistency, it probably makes sense to have similar tests for integers and doubles. jsonld.js was dropping the type for non-integers typed as integers.
There might be other edge cases that should be tested here too. This does seem like an incremental improvement.
Possible relevant references:
https://w3c.github.io/json-ld-api/#algorithm-16
#555
#656
#619
#625
#662