-
Notifications
You must be signed in to change notification settings - Fork 35
Context overflow. #416
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
Context overflow. #416
Conversation
Tests marked with specVersion: json-ld-1.0 are typically incompatible with the 1.1 spec, and there are 1.1 versions where appropriate. |
👍
They are included for historical purposes, so that pure 1.0 processors still have tests available that were used for conformance reporting. 1.1 implementations are expected to not execute them.
No.
It changed because the semantics changed. Before, it was an array of remote contexts, which didn't account for legitimate repetition; thus, it changed to "context overflow" to allow for legitimate repetition. Really, it comes in with scoped contexts, where terms may be in different included contexts, which could legitimately reference each other. (similar issue for improved
We could put something about this in the tests/README, or index. Probably want to set some reasonably small limit when testing, but it should work with a larger limit, too.
These look good, and I currently fail 0124-0126, so I'll need to look at them more closely. I can push up toRdf versions. |
f6f22e4
to
ed754df
Compare
Actually, algorithm text needs to be modified to allow checking for such recursive scoped context. The logic for imported contexts is different, and doesn't allow recursion at the time of processing (testing is done after merge).
Note that these steps don't change the behavior of any existing tests, and stick to the intent of validating scoped contexts without infinite recursion introduced due to the validation, while continuing to perform the validation later on, implicitly. |
@davidlehn This will have some implications in the pre-loading of contexts in jsonld.js and pyld, but really just to defer the preload if processing a scoped context, so may require the addition of some state. @azaroth42 I believe we can consider this editorial, as it doesn't impact any existing tests and allows the usage patterns discussed in the syntax document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the changes I added.
I am not sure I fully grasp its impact. I see how it prevents an overflow in the three added tests. But it seems to me that it also does not completely validate a scoped context that would contain a URL. For example in {
"@context": {
"@version": 1.1,
"prop": {
"@id": "ex:prop",
"@context": "0125-context-2.jsonld"
},
"value": {
"@id": "ex:value"
}
}
} the context at |
Yes, it ends up postponing the validation until the context is used, which is somewhat contrary to the statement that the scoped context must be valid, but I see no other way to halt recursion. In your case, if "prop" were never used, then we could not detect that "0125-context-2.jsonld" was valid (although it could be eventually valid :) ). The intention is to allow chains of contexts which self reference, but validation needs to stop somewhere. Perhaps an alternative would be instead to halt dereferencing only if the referenced context is already in remote contexts. |
(Looks like a thought was cut off) By "changed", I mean in the JsonLdErrorCode section (and maybe others), the "context overflow" line doesn't have
I think we might want to add test support for this as I found a jsonld.js related bug. It was only checking for depth overflow, not total context overflow. Assuming an implementation has a knob to adjust limits, it wouldn't be hard to test depth and total limits. |
I updated the algorithm to process remote scoped contexts up to the point that they have already been processed. This should allow them to be checked when the context is evaluated, rather than when the property including the scoped context is actually expanded/compacted. |
- 1.0 expand: - e003 looked like e002. Made it use a level of indirection. - 1.1 expand: - Copy e002 and e003 to e052 and e053 and use newer "context overflow" code. - Add e054 cross linked sibling contexts test. - Add 0124, 0125, 0126 scoped context recursion tests.
…Context Processing algorithms used to limit recursive context processing when validating scoped contexts.
…the context is in the _remote contexts_ array, which allows for validating scoped contexts when the term is defined up to the point that it has already been processed.
be4b461
to
239c3eb
Compare
Preview | Diff