Skip to content

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

Merged
merged 9 commits into from
Nov 7, 2019
Merged

Hotfix for jsonld context #782

merged 9 commits into from
Nov 7, 2019

Conversation

Panaetius
Copy link
Member

@Panaetius Panaetius commented Oct 30, 2019

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, like something.project referring to schema:project in one place and somethingelse.project referring to foaf: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

@Panaetius Panaetius requested a review from a team as a code owner October 30, 2019 13:53
@Panaetius Panaetius changed the title [WIP] Hotfix for jsonld context Hotfix for jsonld context Oct 31, 2019
@Panaetius Panaetius mentioned this pull request Nov 4, 2019
@rokroskar
Copy link
Member

would it be easier to review if the PR was made to the branch of #765?

@rokroskar rokroskar changed the base branch from master to 99-import-dataset-from-renku-aware-repo November 5, 2019 07:47
@Panaetius Panaetius force-pushed the hotfix-jsonld-context branch from 09f1564 to dee76a9 Compare November 5, 2019 09:54
@Panaetius Panaetius changed the base branch from 99-import-dataset-from-renku-aware-repo to master November 5, 2019 09:54
Copy link
Member

@rokroskar rokroskar left a 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!

Copy link
Contributor

@mohammad-alisafaee mohammad-alisafaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@Panaetius Panaetius merged commit b8b1ae2 into master Nov 7, 2019
@Panaetius Panaetius deleted the hotfix-jsonld-context branch November 7, 2019 10:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in marshalling jsonld objects
4 participants