Skip to content

Error in fromRdf/0027-out.jsonld #648

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

Open
marcelotto opened this issue Apr 5, 2025 · 4 comments · May be fixed by #650
Open

Error in fromRdf/0027-out.jsonld #648

marcelotto opened this issue Apr 5, 2025 · 4 comments · May be fixed by #650

Comments

@marcelotto
Copy link
Contributor

marcelotto commented Apr 5, 2025

The new fromRdf#t0027 test expects its result to be wrapped in a @graph container. Maybe I'm missing something, but that seems wrong to me.

Also: Why is the @type specified on the values of the boolean-native object, when the corresponding values in the input are valid boolean values? Same on number-native.

@anatoly-scherbakov
Copy link
Contributor

anatoly-scherbakov commented Apr 6, 2025

Hi @marcelotto, thanks for looking into this!

  1. I reviewed this against 8.4 Serialize RDF as JSON-LD Algorithm
    , I think you are right. Will check this out.

  2. 8.6 Data Round Tripping seems to override conversion of RDF literals into value objects indeed.

I will prepare a PR, we will maybe discuss this on the next meeting.


I was the one who wrote this test and I do remember that I was considering the two alternatives: value object vs a native JSON value and somehow I chose the former. I do not recall the details anymore.

@anatoly-scherbakov anatoly-scherbakov linked a pull request Apr 6, 2025 that will close this issue
@gkellogg gkellogg moved this to Discuss-Call in JSON-LD Management Apr 6, 2025
@anatoly-scherbakov
Copy link
Contributor

For reference, I think this is the PR #625

@w3cbot
Copy link

w3cbot commented Apr 9, 2025

This was discussed during the #json-ld meeting on 09 April 2025.

View the transcript

w3c/json-ld-api#648

<gb> Issue 648 Error in fromRdf/0027-out.jsonld (by marcelotto)

anatoly-scherbakov: when I was converting literals into JSON-LD
… when they used native types, I was converting them to Value Objects
… but that's not what the spec is going for
… the spec says to use native JSON types
… and I made a PR to address that

w3c/json-ld-api#650

<gb> Pull Request 650 #648 `0027-out.jsonld`: `@graph` and value objects (by anatoly-scherbakov)

gkellogg: the first sentence was about `@graph`
… it was always used in 1.0
… but generally eliminated in 1.1
… except for certain use cases
… if JSON-LD is a single object, then you would not expect to see an `@graph` containing it
… so I think there are two things in here
… the specifics of `@graph` and what types of JSON values are emitted vs. expanded values
… you basically want more review, correct?

anatoly-scherbakov: yes. exactly
… some re-review would also be appreciated

gkellogg: so the linked issue is 648

anatoly-scherbakov: and the PR is 650

gkellogg: thanks
… we do also have some things marked as propose close


@anatoly-scherbakov
Copy link
Contributor

I double checked the (2) above. Check out RDF to Object conversion → Algorithm

  1. If value is an IRI or a blank node identifier, return …
  2. Otherwise value is an RDF literal:
    2.1) Initialize a new empty map result.

    2.11) Return result.

There are no early returns between 2.1 and 2.11 which I can see. This indeed will be a value object. Test seems correct in that regard. Sorry for the confusion above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Discuss-Call
Development

Successfully merging a pull request may close this issue.

3 participants