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

matnwb does not support spaces in names #35

Open
bendichter opened this issue Jul 4, 2018 · 5 comments
Open

matnwb does not support spaces in names #35

bendichter opened this issue Jul 4, 2018 · 5 comments
Assignees
Labels
status: todo something needs to be done topic: nwb-schema related to nwb-schemas, namespaces and type implementations

Comments

@bendichter
Copy link
Contributor

Since names are used as field names of objects, matnwb does not allow them to have spaces. pynwb does allow spaces. Maybe a compromise would be to automatically replace all spaces with underscores in matnwb.

@lawrence-mbf
Copy link
Collaborator

lawrence-mbf commented Jul 5, 2018

I believe spaces work with open Sets (basically, any Group structure that can have 0 or more items in it) as they are Map-backed. The only other place that could include spaces would be at the YAML level (core schema and extensions) which will definitely require some work.

Is there a bug where this doesn't work, or are you experiencing a use case that breaks this?

@bendichter
Copy link
Contributor Author

bendichter commented Jul 21, 2018

Yes, the problem I was having with specifically with the names in an extension YAML, but I think the best solution would be to enforce no spaces on the pynwb side

@lawrence-mbf
Copy link
Collaborator

So I see two thing needing work to get extensions with spaces working:

  1. Add a check when generating files to replace spaces in property values. This should be fairly simple.
  2. Do a check before reading a compound data type, recreate the compound type using new member names, then reading it as normal.

This will "allow" spaces for class properties and makes compound data types readable if they have spaces.

I'll look into this.

@ehennestad ehennestad added the status: need more info unclear what the issue is or what needs to be done label Oct 31, 2024
@ehennestad
Copy link
Collaborator

@bendichter Is this still relevant?

If yes, can you clarify what is meant here:

Since names are used as field names of objects
Does the schema allow for spaces in object property names?

Could you also point me to an example scenario which illustrates this problem?

@bendichter
Copy link
Contributor Author

bendichter commented Nov 1, 2024

@ehennestad
Yes, this issue is still relevant. Let me explain with a concrete example:

When creating a trials table in MatNWB, you use dot notation like this:

nwbfile.trials = DynamicTable(...)

This syntax pattern appears whenever you're working with Datasets or Containers in the schema that have set names. While this works fine for the core schema (which doesn't have this issue), we run into a potential problem when set names contain spaces.

The issue doesn't occur in the core schema, but it's not currently enforced as a rule, meaning it could appear in extensions. If an extension defines a Container or Dataset that has a sub-Container or Dataset with a space in its set name, we hit a compatibility problem.

There are two potential solutions we could consider:

  1. Enforce a rule that prohibits spaces in set names in the hdmf schema language
  2. Implement a workaround in MatNWB (for example, automatically replacing spaces with underscores)

While I can't recall the specific instance where we encountered this, it remains a potential issue that we should address.

@ehennestad ehennestad added status: todo something needs to be done topic: nwb-schema related to nwb-schemas, namespaces and type implementations and removed status: need more info unclear what the issue is or what needs to be done labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: todo something needs to be done topic: nwb-schema related to nwb-schemas, namespaces and type implementations
Projects
None yet
Development

No branches or pull requests

4 participants