Skip to content

[enhancement] deprecate Cardinality _MANY#6005

Merged
line-o merged 1 commit intoeXist-db:develop-6.x.xfrom
reinhapa:6.x.x-deprecate-many-cardinality
Jan 15, 2026
Merged

[enhancement] deprecate Cardinality _MANY#6005
line-o merged 1 commit intoeXist-db:develop-6.x.xfrom
reinhapa:6.x.x-deprecate-many-cardinality

Conversation

@reinhapa
Copy link
Member

@reinhapa reinhapa commented Jan 8, 2026

Description:

Deprecate _MANY as it is not an available XPath indicator.

Use EMPTY_SEQUENCE and EXACTLY_ONE to achieve the same behavior if needed.

@adamretter
Copy link
Contributor

@reinhapa I think your code comment could benefit from being a little less assertive as _MANY has the value 4 whilst ONE_OR_MORE has the value 6. So it's unfortunately in most places not just a case of replacing one with the other, but instead at those call sites some changes may need to be made

@line-o line-o requested review from a team and line-o January 8, 2026 11:05
Copy link
Member

@line-o line-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_MANY will be removed without an (exposed) replacement. In places where _MANY is still used within the codebase it needs to be adapted to make use of ONE_OR_MORE instead.

I think the comment is good enough to transport that information

@adamretter
Copy link
Contributor

@line-o actually no, that's not how you would fix the call sites, which is why I commented that Patrick's comment in the code is incorrect/misleading

@reinhapa
Copy link
Member Author

reinhapa commented Jan 9, 2026

@reinhapa I think your code comment could benefit from being a little less assertive as _MANY has the value 4 whilst ONE_OR_MORE has the value 6. So it's unfortunately in most places not just a case of replacing one with the other, but instead at those call sites some changes may need to be made

@adamretter What would be your suggestion instead?

I had a look into the code and to occurrences of those values and for me at least there is a mix up between the following use cases

  • XML schema definition: ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE)
  • Function arguments: EXACTLY_ONE, ZERO_OR_MORE
  • Functions results: EMTY_SEQUENCE. EXATLY_ONE, ZERO_OR_MORE

IMHO this can not actually be captured in a single Enum in general.

@adamretter
Copy link
Contributor

I had a look into the code and to occurrences of those values and for me at least there is a mix up between the following use cases

XML schema definition: ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE)
Function arguments: EXACTLY_ONE, ZERO_OR_MORE
Functions results: EMTY_SEQUENCE. EXATLY_ONE, ZERO_OR_MORE

The cardinality Enum should only have the cardinalities applicable to XDM, i.e.:

  • EMTY_SEQUENCE ()
  • ZERO_OR_ONE (?)
  • EXACTLY_ONE
  • ONE_OR_MORE (+)
  • ZERO_OR_MORE (*)

My suggestion is to fix the calling code by refactoring it, the solution to fixing that is not to move those call sites to ONE_OR_MORE as that will just break the current behaviour.

@reinhapa
Copy link
Member Author

My suggestion is to fix the calling code by refactoring it, the solution to fixing that is not to move those call sites to ONE_OR_MORE as that will just break the current behaviour.

That is actually the plan. But I would suggest to move the discussion to #6007 ...

in preparation of replaceing _MANY with ONE_OR_MORE this enum is marked
for depecation

Signed-off-by: Patrick Reinhart <patrick@reini.net>
@reinhapa reinhapa force-pushed the 6.x.x-deprecate-many-cardinality branch from 313f014 to 47bb02c Compare January 13, 2026 05:57
@line-o line-o merged commit cea1b92 into eXist-db:develop-6.x.x Jan 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants