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

How to deal with JSON-LD contexts #5

Open
lambdakris opened this issue Jun 9, 2021 · 2 comments
Open

How to deal with JSON-LD contexts #5

lambdakris opened this issue Jun 9, 2021 · 2 comments

Comments

@lambdakris
Copy link
Contributor

I wanted to start a conversation about how to deal with JSON-LD contexts in Hydra.NET. As far as I can tell, there is no built-in way to generate JSON-LD contexts for classes/resources. Is this accurate?

Assuming that it is, I have resorted to using JsonLd.Entities which works well, but it has some down sides. First, it requires separate steps to utilize in addition to the use of Hydra.NET which could conceivably be consolidated. Second, it depends on Newtonsoft.Json while Hydra.NET depends on System.Text.Json. Third, the project has a number of out of date dependencies and it has not seen much activity in the past 2 years. As a result, I was wondering whether it was advisable to either:
1 - Contribute to or fork JsonLd.Entities to upgrade dependencies and port to System.Text.Json
2 - Port relevant JsonLd.Entities functionality into Hydra.NET (but targeting System.Text.Json)
3 - Start a new project for dealing with JSON-LD Context generation and other JSON-LD related stuff for the purposes of Hydra.NET

@mjhoffmeister
Copy link
Owner

You can use the Context class, but it has limitations. It doesn't support context terms that map to maps, as illustrated in this JSON-LD spec example, and you have to manually build up a dictionary of terms to pass to the constructor if you're not using an IRI reference (that is elegant enough in my opinion, but that's just one opinion.)

I might prefer augmenting the Context class, but only slightly. Porting relevant JsonLd.Entities functionality into Hydra.NET is a close second. What do you think?

@lambdakris
Copy link
Contributor Author

Yeah, I think it might be worthwhile to port over relevant functionality from JsonLD.Entities, specifically for building or generating contexts for POCOs. I was scanning the JsonLD.Entities code and it might not be too difficult to replicate with System.Text.Json and a bit of reflection (it might not be the fastest thing ever tho). I'll try to get an initial spike going this week!

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

No branches or pull requests

2 participants