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

Cardinality for odml entities #361

Closed
mpsonntag opened this issue Feb 24, 2020 · 6 comments
Closed

Cardinality for odml entities #361

mpsonntag opened this issue Feb 24, 2020 · 6 comments
Assignees

Comments

@mpsonntag
Copy link
Contributor

mpsonntag commented Feb 24, 2020

Would it make sense to introduce cardinality for odml entities as a core feature?

Outline of such a cardinality feature would be

  • cardinality would be provided and parsed in the format 'n..n' with '0..n' as default.
  • Sections would feature cardinality for subsections and properties.
  • Properties would feature cardinality for values.
  • cardinality would always be checked via core validations on saving and loading.
@achilleas-k
Copy link
Member

Would it just be for validation or could it have other uses? And what would it refer to the number of Sections in general or of a specific type?
For instance would it restrict the number of subsections that a Section can have, or would it restrict the number of subsections of a given type that a Section can have?

@jgrewe
Copy link
Member

jgrewe commented Feb 24, 2020

in which form would you include it? as a class decorator?

@mpsonntag
Copy link
Contributor Author

All good questions, this is great!

  • I think the cardinality should not be a hard check that immediately invalidates an entity violating a defined cardinality. I think it should more be the option to define e.g. in a template how many Sections, Properties or values a specific Section or Property should be allowed to have in its context. A validation should then check and tell a user that a specific document violates some rules but should not inhibit the user from creating or working on a document.
  • it should only be used for the number of entities and not for specific types.

@mpsonntag
Copy link
Contributor Author

I am not sure what the best implementation would be, but

  • Section will need two different cardinalities for Sections and Properties and Properties will need one cardinality for value. I am not sure a class decorator could tackle both.
  • if a cardinality other than '0..n' is set, it also needs to be serialized to file and loaded back again so maybe dedicated attributes that are also included in the respective formats would be required. All suggestions here are welcome!

@achilleas-k
Copy link
Member

achilleas-k commented Apr 20, 2020

With basic cardinality rules implemented for Property -> Values, Section -> Properties, and Section -> Sections, the topic came up if we would also like to have more specific rules, especially for Section > Sections. One idea that came up is restricting the number of subsections of a specific type.

@mpsonntag
Copy link
Contributor Author

The issue has been closed with PR #384.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants