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

Playground does not give expected result for expansion test c037 #568

Open
zoggy opened this issue Jun 20, 2023 · 4 comments
Open

Playground does not give expected result for expansion test c037 #568

zoggy opened this issue Jun 20, 2023 · 4 comments

Comments

@zoggy
Copy link

zoggy commented Jun 20, 2023

Hi,

from expansion algorithm, I don't understand how nesting is supposed to work, especially when step 14.2.2 specifies to "Recursively repeat steps 13 and 14 using nested value for element", but steps 13 and 14 do not modify the active context, so nested values are expanded using the current active context, not the context associated to the nesting key.

I must precise that I'm implementing in a functional language, and it it not clear to me from the wording of the algorithm if active context is passed by reference along recursive calls. By now I assume that it is not the case but I way be wrong. It may be useful to indicate for each algorithm which arguments are passed by rerefence.

@zoggy
Copy link
Author

zoggy commented Jun 23, 2023

Well,in fact it seems that either expansion test c037 is wrong, or jsonld.js implementation is wrong.

Input of c037 is

{
  "@context": {
    "@version": 1.1,
    "@vocab": "http://example.org/",
    "nest": {
      "@id": "@nest",
      "@context": {
        "@vocab": "http://example.org/nest/"
      }
    }
  },
  "nest": {
    "property": "should be in /nest"
  }
}

Expected output of c037 output is:

[{
  "http://example.org/nest/property": [{"@value": "should be in /nest"}]
}]

But JSON-LD Playground expands input to:

[
  {
    "http://example.org/property": [
      {
        "@value": "should be in /nest"
      }
    ]
  }
]

My implementation gives the same result as the playground, but this is not the expected result. Who is right ?

@zoggy zoggy changed the title Question regarding expansion of @nest Playground does not give expected result for expansion test c037 Jun 23, 2023
@zoggy
Copy link
Author

zoggy commented Jun 23, 2023

Same for expansion test c038.

@gkellogg
Copy link
Member

gkellogg commented Aug 8, 2023

Might be an issue for jsonld.js. @davidlehn?

@davidlehn
Copy link
Contributor

Looks like those tests are not passing in jsonld.js right now and are currently marked to be skipped. I don't recall the specific reasons why. Needs someone to look into what the fix should be.
https://github.com/digitalbazaar/jsonld.js/blob/main/tests/test.js#L174

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

No branches or pull requests

3 participants