GreenDelta / olca-ipc.py

Mozilla Public License 2.0
29 stars 17 forks source link

Objects created by the Writer have no @context #10

Closed bkuczenski closed 3 years ago

bkuczenski commented 3 years ago

I'm not sure whether this is a problem or not- but in all the official OpenLCA JSON-LD zip files, each object has a @context property that is equal to 'http://greendelta.github.io/olca-schema/context.jsonld'. The ones created with pack.py do not.

It doesn't seem possible to add this using the normal machinery because it's not part of the schema. However, if every object should have it, then it could simply be included in the default Entity.to_json() method and get inherited by all.

msrocka commented 3 years ago

True. It could be added easily be modifying the code generator (the schema code is generated from the olca-schema model): https://github.com/GreenDelta/olca-ipc.py/blob/master/scripts/genmodel.py#L134

But I think it would not add much value. It is only useful when you want to expand the data to a full RDF graph (see https://json-ld.org/spec/latest/json-ld/#the-context). But nobody is really doing this (anymore; the JSON-LD export of openLCA was originally implemented to get RDF data out of openLCA for the LCA harmonization tool: https://github.com/USEPA/LCA-HT). Also, you can fetch the context without using the @context attribute for the graph expansion.

So I think this issue can be closed.