incf-nidash / nidm-specs

Neuroimaging Data Model (NIDM): describing neuroimaging data and provenance
nidm.nidash.org
Other
33 stars 30 forks source link

Add JSON-LD 1.1 exports for NIDM-Results examples #479

Closed cmaumet closed 5 years ago

cmaumet commented 6 years ago

This PR converts all our turtle examples into JSON-LD using an automatically generated context (from the OWL file) with type-indexing (JSON-LD 1.1 feature) to ease readability of the NIDM documents.

cmaumet commented 6 years ago

@satra: Here is a complete demo. There is more cleanup to do, in particular with:

that are not condensed according to the context. Could this be an issue in the conversion ttl > JSON-LD via rdflib?

satra commented 5 years ago

@cmaumet - could we get the nidmr context creator merged in a separate PR, so that the jsonld documents created do not have to be embed the entire context?

satra commented 5 years ago

regarding xsd:string we should see why it's not behaving properly. for the spm case, i can see that the version is a number not a string, but in general we should force that to be a string, since we cannot guarantee appropriate versioning for all software.

cmaumet commented 5 years ago

@cmaumet - could we get the nidmr context creator merged in a separate PR, so that the jsonld documents created do not have to be embed the entire context?

For testing (and iterating), it was easier to have the entire context in the document. I would suggest that we keep it like this until we have a good first full JSON-LD document and then, yes, let's use a URL.

cmaumet commented 5 years ago

the version is a number not a string, but in general we should force that to be a string, since we cannot guarantee appropriate versioning for all software.

Yes, but I think this is true of all strings, not just SPM versioning. e.g. here. My guess is that maybe compacting does not work when typing is implicit (i.e. no ^^xsd::string)?

satra commented 5 years ago

is there a place you could just write the original jsonld file from conversion from rdflib (for one example), as well just the nidmr context file with @version (just for testing purposes)?

cmaumet commented 5 years ago

@satra: the context file is saved here: https://github.com/cmaumet/nidm/blob/jsonld_export/nidm/nidm-results/terms/nidmr.json (raw version).

cmaumet commented 5 years ago

(Also now linked to purl: http://purl.org/nidash/context)

cmaumet commented 5 years ago

Also pointed out by @mih

cmaumet commented 5 years ago

Hi everyone! I think that this long-lasting pull request is now ready to merge. Thank you to @natachaperez for providing so many fixes!

No changes have been made to the data model, this PR focuses exclusively on updating our set of examples for NIDM-Results.

More specifically, in this PR we:

To ease the conversion, a couple of changes have been made to the turtle templates (used to generate the examples) and the owl file:

Please let us know if you have any comments/feedback. If not, I'll merge at the end of the week. Thanks!

satra commented 5 years ago

@cmaumet and @natachaperez - nice work - the one thing i would suggest changing is to first have a PR that generates the context, merge that and then use the purl for that context in the example files. it would be nice to not have really large contexts embedded in the json files.

also to generate the cleanest looking files, you may need to tweak @context more, which means updating the converter. but first i would recommend simply playing with updating the context manually in the playground/python console to see the impact on the compact output.

cmaumet commented 5 years ago

@satra: Thanks that's a good point! This is now fixed (cf. 78dd6fd, ae60daf).

I'll update the context purl to redirect to master once this PR is merged.

cmaumet commented 5 years ago

Hi everyone! Last call: any additional comment on this PR? Or +1's for merge?

khelm commented 5 years ago

I only have a comment on the removal of the prov assignments. Is the assumption that you'll be able to tell whether the item is an entity, agent, or activity by tracing the term's parents up the tree, so it doesn't need to be explicit? (This is what I'm assuming in NIDM-E).

cmaumet commented 5 years ago

@khelm: yes, that's exactly right :)

cmaumet commented 5 years ago

I've just updated the context PURL: http://purl.org/nidash/context --now links to--> https://raw.githubusercontent.com/incf-nidash/nidm/master/nidm/nidm-results/terms/nidmr.json.