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

Fix type scoped terms. #312

Merged
merged 3 commits into from
May 13, 2019
Merged

Fix type scoped terms. #312

merged 3 commits into from
May 13, 2019

Conversation

dlongley
Copy link
Member

@dlongley dlongley commented May 8, 2019

This PR will cause @type scoped terms to be limited to objects that have a matching @type value. Without this patch, @type scoped terms also unexpectedly apply to anything nested (contained within the tree) of a typed object.

@dlongley dlongley requested a review from davidlehn May 8, 2019 16:51
@dlongley
Copy link
Member Author

dlongley commented May 8, 2019

Related to w3c/json-ld-syntax#174.

@dlongley dlongley force-pushed the fix-type-scoped-terms branch from 3c5eb62 to c9e8837 Compare May 8, 2019 17:16
@gkellogg
Copy link
Collaborator

How do you handle expansion test tm008? Previously, the context passed to expanding values includes those for the type index, but now the expansion algorithm removes those terms.

It seems to me that the object value needs to be changed before it's expanded to include the type index as a value of @type (or its alias) so that it will be considered there. This makes type map processing different than for other indexes.

@gkellogg
Copy link
Collaborator

FWIW, my solution was to pass a fromMap flag to expansion when expanding values of a map, which will note clear these term definitions.

@dlongley
Copy link
Member Author

@gkellogg,

FWIW, my solution was to pass a fromMap flag to expansion when expanding values of a map, which will not clear these term definitions.

Sorry, only just now seeing your question -- and I agree with your solution. I was previously passing a flag insideTypeContainer that would prevent the clearing of the term definitions, but it wasn't general enough for the new test case you added that combined indexes and type containers. I've updated my implementation to use an insideIndex flag that has the same meaning as your fromMap flag -- and jsonld.js now passes your new test as well. Thanks!

JFYI, I'm planning on merging this PR on Monday to move things forward with the VC @context.

@gkellogg
Copy link
Collaborator

I’ll have an update to the API PR today, probably won’t get to the syntax. Until after WWW.

@dlongley dlongley merged commit 25a06a6 into master May 13, 2019
@dlongley dlongley deleted the fix-type-scoped-terms branch May 13, 2019 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants