incf-nidash / nidmresults-spm

Export SPM results in a lightweight format
http://nidm.nidash.org/specs/nidm-results.html
1 stars 4 forks source link

Json export: ':' in attribute names #40

Open cmaumet opened 7 years ago

cmaumet commented 7 years ago

With @TomMaullin, we are looking at the json exports that SPM is generating and we were wondering if it would be possible to remove the ending ":" in the NIDM attribute names for the json export (but keep them in turtle). This would be similar to the behaviour of the Python rdflib.

The final ':' comes from this line: https://github.com/incf-nidash/nidmresults-spm/blob/master/exporter/spm_results_nidm.m#L1379.

gllmflndn commented 7 years ago

I came across the same issue this morning and, yes, we should harmonise the serialisations. Can we look at this together later this week? I also had to add a few calls to get_value.m and deal with bundles. There are also differences in the way Derivations are encoded (for peaks to find out in which clusters they belong to).

jbpoline commented 7 years ago

just curiosity: do we know why it was there in the first place ?

On 28 February 2017 at 03:57, Guillaume notifications@github.com wrote:

I came across the same issue this morning and, yes, we should harmonise the serialisations. Can we look at this together later this week? I also had to add a few calls to get_value.m and deal with bundles. There are also differences in the way Derivations are encoded (for peaks to find out in which clusters they belong to).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/incf-nidash/nidmresults-spm/issues/40#issuecomment-283020579, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQyaIw6fW7wUZmH0aPsiHY2_QIyqmjiks5rhAuvgaJpZM4MORsf .

cmaumet commented 7 years ago

@gllmflndn: Yes! Working on this together this week would be great.

@jbpoline: I think this is something we could update in the SPM exporter. The final : are needed for alphanumeric ids in the turtle serialisation but are not necessary for the json serialisation.

cmaumet commented 7 years ago

Hi @gllmflndn. I have also encountered this issue when trying to create a json file similar to this one in which I had are a lot of MATLAB-"invalid" characters in the json keys (e.g. -, :, /,...).

Do you think we have a way around this or we will definitely have to limit ourselves to json keys that are valid MATLAB keys in order to be able to read/write those files in Matlab? This seems quite a big constraint compared to the json specification... I would love to hear your thoughts on this. Thank you!

gllmflndn commented 7 years ago

Hello @cmaumet. To write such a JSON file, you have several options:

At the moment, the parsing of such files uses the underscore ReplacementStyle option: allowing hex is feasible but will be a bit more involved. Pull requests welcome at https://github.com/gllmflndn/JSONio

cmaumet commented 7 years ago

Thank you for all this @gllmflndn!

gllmflndn commented 7 years ago

I tried to add the ReplacementStyle option in jsonread: https://github.com/gllmflndn/JSONio/commit/755295ef85295d5b60895db1242d1b6146172646 A recompilation of MEX files is required.