|
From: Juri L. <no...@gi...> - 2026-10-13 09:22:57
|
Branch: refs/heads/develop Home: https://github.com/eXist-db/exist Commit: bf9a3e4289d21ccaa95ca5ea4a1ecd41aa0d2d11 https://github.com/eXist-db/exist/commit/bf9a3e4289d21ccaa95ca5ea4a1ecd41aa0d2d11 Author: Joe Wicentowski <jo...@gm...> Date: 2026-10-09 (Fri, 09 Oct 2026) Changed paths: M exist-core/src/main/java/org/exist/xquery/functions/fn/FunMatches.java A exist-core/src/test/java/org/exist/xquery/FunMatchesCardinalityTest.java Log Message: ----------- [bugfix] Raise XPTY0004 when fn:matches is given more than one item fn:matches is declared matches($input as xs:string?, ...), so a sequence of two or more items is a type error. eXist accepted one and tested only its first item, because Sequence.getStringValue() returns the first item's value and discards the rest. That is why matches(('x','a'), 'a') answered false: it tested 'x'. Reported in 2013 as issue 59, along with the predicate case below. The check goes in the path that evaluates the argument as a value, which covers both a literal sequence and a multi-item node sequence bound to a variable. This does not close issue 59. Inside a predicate over persistent nodes fn:matches is an index-backed node filter -- returnsType() reports NODE there -- so //e[matches(v,'a')] still selects existentially rather than raising. Enforcing cardinality on that path is not a matter of adding a check: when the optimizer has preselected, the argument is evaluated with preloaded data so that it yields only the nodes that already matched, and the siblings that would make the sequence too long are never materialized. Counting them would mean the scan the index exists to avoid. What changed is that the conformant spelling of the existential test, //e[some $v in v satisfies matches($v,'a')] now reaches the same range index, as of the preceding commit. So whether to tighten the predicate path is now a decision about compatibility rather than about performance, which is what issue 59 has been waiting on. Co-Authored-By: Claude Opus 5 <no...@an...> Commit: 068e48d843a43e066f241c6bce4a32448a0af989 https://github.com/eXist-db/exist/commit/068e48d843a43e066f241c6bce4a32448a0af989 Author: t <t@t> Date: 2026-10-09 (Fri, 09 Oct 2026) Changed paths: M exist-core/src/test/java/org/exist/xquery/FunMatchesCardinalityTest.java Log Message: ----------- [test] Migrate FunMatchesCardinalityTest to JUnit 5 Develop now runs on JUnit 5 only. Co-Authored-By: Claude Opus 5.5 (1M context) <no...@an...> Commit: 8007b0843c16c7a246c04e7960b2c53286154ad8 https://github.com/eXist-db/exist/commit/8007b0843c16c7a246c04e7960b2c53286154ad8 Author: t <t@t> Date: 2026-10-12 (Mon, 12 Oct 2026) Changed paths: M exist-core/src/main/java/org/exist/xquery/functions/fn/FunMatches.java M exist-core/src/test/java/org/exist/xquery/FunMatchesCardinalityTest.java Log Message: ----------- [bugfix] Address review of the fn:matches cardinality check Use hasMany() rather than getItemCount() to detect a multi-item input, so a lazily evaluated node set is not expanded just to be compared with 1; the count is still reported in the error message, on the failing path only. The existential behavior that remains is narrower than "inside a predicate": fn:matches is a node filter only as the whole predicate or as an operand of and/or in it. Elsewhere in a predicate, e.g. as the argument of fn:not, the argument is evaluated as a value and a multi-item argument now raises XPTY0004. The Javadoc says so, and tests pin both sides: the whole predicate, and/or operands, and fn:not. Co-Authored-By: Claude Opus 5.5 (1M context) <no...@an...> Claude-Session: https://claude.ai/code/session_01TLXqAfAP6kHAcWM99TFrxa Commit: 957f4a0cbd20473d333c828104feef3da3b523aa https://github.com/eXist-db/exist/commit/957f4a0cbd20473d333c828104feef3da3b523aa Author: Juri Leino <gi...@li...> Date: 2026-10-13 (Tue, 13 Oct 2026) Changed paths: M exist-core/src/main/java/org/exist/xquery/functions/fn/FunMatches.java A exist-core/src/test/java/org/exist/xquery/FunMatchesCardinalityTest.java Log Message: ----------- Merge pull request #6745 from joewiz/bugfix/59-matches-cardinality [bugfix] Raise XPTY0004 when fn:matches is given more than one item Compare: https://github.com/eXist-db/exist/compare/b57ae3255d3f...957f4a0cbd20 To unsubscribe from these emails, change your notification settings at https://github.com/eXist-db/exist/settings/notifications |