-
Notifications
You must be signed in to change notification settings - Fork 23
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
Clarification needed for expansion of terms with @container
set to @id
and a local context with a @base
#412
Comments
I think it's described using the following steps:
I think the algorithm is correct, but there are definitely a lot of moving parts. If you had passed the test suite other than this newly defined test, then that would indicate that the test coverage should be improved. Please go ahead and add a PR for the new expansion test (and corresponding toRdf test). |
I thought so too, but as my implementation is basically a transcription of the algorithm into Python (with some minor optimizations and refactored parts), I wondered why it didn't work. Apparently, step 13.8.3.4 occurs for expansion of the
The I believe this is why your (and now also my) implementation uses a |
Yes, my analysis started at the wrong point:
You're expecting that 13.8.3.4 would set expanded index using the property-scoped context which would result in "https://example.org/ns/Item" instead of "https://example.org/ns#Item". Indeed, my code creates container context at about 13.8.2 using the following Ruby code: # While processing index keys, if container includes @type, clear type-scoped term definitions
container_context = if container.include?('@type') && context.previous_context
context.previous_context
elsif container.include?('@id') && context.term_definitions[key]
id_context = context.term_definitions[key].context if context.term_definitions[key]
if id_context.nil?
context
else
log_debug("expand", depth: log_depth.to_i) {"id_context: #{id_context.inspect}"}
context.parse(id_context, base: @options[:base], propagate: false)
end
else
context
end At this point, it seems odd that I'd have such relatively complex code without something corresponding in the algorithm text. Definitely seems a substantive Erratum is in order. |
When expanding this compact data:
I cannot tell from the spec (step 13.8.3.7.4 of the expansion algorithm) whether the key
Item
will be resolved against the local context or not. Actually, reading the spec I see nothing that sets the active context to the local context of thetypeDescribed
before reaching 13.8.3.7.4, although I would expect that this is the intention. Both the JSON-LD Playground and the Ruby RDF Distiller do expand the above to this:In the Ruby code corresponding to step 13.8.2 and onwards, IIRC, a
container_context
is defined and from thereon used.Unless I've missed something in the algorithm that clarifies that something like this is required, I believe we should clarify this exhaustively in the spec, and add this test case (unless I've overlooked an existing one for this).
I've made a similar adjustment to TRLD to reflect this presumably desired behaviour.
The text was updated successfully, but these errors were encountered: