mff-uk / dataspecer

https://dataspecer.com
MIT License
19 stars 7 forks source link

Include JSON-LD context in the JSON example #383

Open jakubklimek opened 5 months ago

jakubklimek commented 5 months ago

Primarily, we use the generated JSON examples together with JSON-LD context to generate data in RDF. However, now this includes manually combining the JSON-LD context with the JSON example every time.

I propose adding a configuration option to the JSON example artifact (enabled by default) to include the JSON-LD context (the expanded one) in the generated JSON example, so that it does not need to be inserted every time manually.

I suspect this functionality is part of the test data generation anyway, so it would be just moving it.

LadyMalande commented 4 months ago

What do you mean when you say "the expanded one" when referring to json-ld context? I know how expanded json-ld document looks like, but I am not sure what the expanded json-ld context is. Is there any option in Dataspecer how to configure the json-ld generator to generate expanded contexts? Or am I supposed to transform the generated context to the expanded form?

jakubklimek commented 4 months ago

I mean that for JSON-LD to work properly with unpublished specifications, you need the whole JSON-LD context in the JSON file. In case where one specification reuses another one, there would be a link to an external context, and this would not be resolved in the JSON-LD to RDF transformation and therefore the sample data would not work properly. In Dataspecer, you may choose to "dereference" those contexts (the same goes for Schemas) and then everything is included. image

LadyMalande commented 4 months ago

Thank you for explanation, dereferencing added to the json-example generator for the added context. Changes will be commited with next git push.