-
Notifications
You must be signed in to change notification settings - Fork 29
Hotfix for jsonld context #782
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
would it be easier to review if the PR was made to the branch of #765? |
09f1564
to
dee76a9
Compare
bb5ac38
to
44e6f16
Compare
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.
This makes sense to me although it makes the contexts complicated - they are not, however, really meant to be human-readable so it's not a huge problem for me. Additionally it could be cleaned up if we published the contexts (together with SHACL from #767) then they don't have to be inlined like they are here but simply linked.
The entities cleanup/refactoring is also a welcome change. 👍 Thanks!
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.
LGTM. Thanks!
Makes
@context
in KG nested and type specific, solving issues of name collisions and missing triples.See https://www.w3.org/TR/json-ld11/#scoped-contexts for details on scoping contexts.
In-Depth description of problem&solution:
E.g.
Generation.entity
can refer to different python classes which can occur side by side. In order to process the KG, we need to combine all JSON values in the KG with their semantic type (coming from an Ontology). We have to deal with ambiguities, likesomething.project
referring toschema:project
in one place andsomethingelse.project
referring tofoaf:project
somewhere else. To deal with this, we need to use local, scoped contexts that are only applicable for a single class, not some global context that's applicable to everything. We achieve vertical scoping (A child class having the same property as parent but with different semantics) by nesting contexts following the same structure as the value graph. We can achieve horizontal scoping (A class in a collection having the same property name as a sibling but with different semantics) by scoping the nested contexts on @type of each class. Since scoping on types only works for single types, but most of our classes have more than one semantic type, we need to repeat the context for each semantic type of a class, making the context a bit of a mess and unwieldy, but allowing consistent and robust usage of the context everywhere.This PR is not based on master (!), but on PR #765 as it is needed to test that PR and I already started working on it there when I though there was a quick fix possible.
Closes #548