Implement XQuery 4.0 core functions (fn:, array:, map:, math:)#6218
Open
joewiz wants to merge 5 commits intoeXist-db:developfrom
Open
Implement XQuery 4.0 core functions (fn:, array:, map:, math:)#6218joewiz wants to merge 5 commits intoeXist-db:developfrom
joewiz wants to merge 5 commits intoeXist-db:developfrom
Conversation
4 tasks
9302841 to
f4faa9f
Compare
Broadened signatures and improved compliance for existing functions:
- fn:compare: broadened to anyAtomicType, numeric total order,
duration/datetime ordering per QT4 spec
- fn:deep-equal: text node merging across comments/PIs, options map
support, BigInteger overflow fix for fn:round
- fn:head/fn:tail: expanded to fn:foot/fn:trunk (XQ4 aliases)
- fn:max/fn:min: duration comparison support, decimal precision
- fn:doc/fn:doc-available: security-gated file:// URI resolution,
fn:doc#2 overload
- fn:unparsed-text: BOM stripping, fn:unparsed-text-lines fix
- fn:matches/fn:replace/fn:tokenize: regex enhancements
- fn:path#2: output format parameter
- fn:analyze-string: reflection proxy for Saxon compatibility
- fn:parse-json: option validation, empty sequence args, xs:integer
for JSON integers
- fn:load-xquery-module: content option (XQ4)
- fn:format-number: negative exponent zero-padding, map overload,
char:rendition pattern
- fn:format-date/fn:format-time: comprehensive improvements
- Collations: supplementary codepoint comparison
- RangeSequence: primitive long storage optimization
- Error codes: W3C alignment across casting and value types
- JSON serialization: XDM mode bypass fix, duplicate key detection
Spec: QT4 XQuery 4.0 §14 (Functions and Operators)
XQTS: +111 tests across method-json, fn-compare, fn-deep-equal,
fn-round, fn-max/fn-min test sets
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New function implementations in the fn: namespace: Sequence functions: fn:characters, fn:identity, fn:void, fn:foot, fn:trunk, fn:slice, fn:items-at, fn:replicate, fn:insert-separator, fn:all-equal, fn:all-different, fn:duplicate-values, fn:index-where, fn:take-while, fn:distinct-ordered-nodes, fn:siblings Higher-order functions: fn:every, fn:some (function form), fn:highest, fn:lowest, fn:sort-by, fn:sort-with, fn:partition, fn:scan-left, fn:scan-right, fn:subsequence-where, fn:transitive-closure, fn:partial-apply, fn:op String/URI functions: fn:char, fn:graphemes, fn:decode-from-uri, fn:parse-uri, fn:build-uri, fn:expanded-QName, fn:parse-QName, fn:parse-integer, fn:divide-decimals Date/Time functions: fn:civil-timezone, fn:build-dateTime, fn:parts-of-dateTime, fn:unix-dateTime, fn:seconds Type functions: fn:schema-type, fn:atomic-type-annotation, fn:node-type-annotation, fn:element-to-map, fn:element-to-map-plan, fn:type-of, fn:is-NaN Context functions: fn:get, fn:collation, fn:collation-available, fn:message Parsing functions: fn:parse-html (Validator.nu HTML5 parser), fn:invisible-xml (Markup Blitz iXML parser), fn:parse-csv, fn:csv, fn:html-doc, fn:unparsed-binary Data functions: fn:hash, fn:function-annotations, fn:function-identity, fn:in-scope-namespaces Also: DeepEqualOptions class for fn:deep-equal options map support, FnModule registrations for all new functions. Spec: QT4 XQuery 4.0 §14 (Functions and Operators) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Array module (8 new functions):
- array:build, array:index-of, array:index-where, array:of-members,
array:split, array:sort-by, array:sort-with, array:slice
- Plus: array:get#3 with default value
Map module (5 new functions):
- map:build, map:items, map:entries, map:filter, map:keys-where
- Plus: map:get#3 with default value, map:empty
Math module (4 new functions):
- math:cosh, math:sinh, math:tanh, math:e
- Plus: math:pow edge case fixes
Spec: QT4 XQuery 4.0 §17 (Array Module),
QT4 XQuery 4.0 §16 (Map Module),
QT4 XQuery 4.0 §18 (Math Module)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Build configuration: - exist-parent/pom.xml: Add markup-blitz 1.10 (fn:invisible-xml), htmlparser 1.4.16 (fn:parse-html via Validator.nu) - exist-core/pom.xml: Add markup-blitz and htmlparser dependencies - .gitignore: Ignore iXML grammar cache files Format improvements: - FnFormatDates: comprehensive format-date/format-time improvements - FnFormatNumbers: map overload, char:rendition pattern, negative exponent zero-padding fix Tests: - fnXQuery40.xql: XQSuite tests for XQ4 functions - fnInvisibleXml.xqm: fn:invisible-xml test suite - format-number-map.xql: fn:format-number map overload tests - deep-equal-options-test.xq: fn:deep-equal options map tests - Updated: fnLanguage.xqm, json-to-xml.xql, replace.xqm Spec: QT4 XQuery 4.0 §14 (Functions and Operators) XQTS: 732/861 (85.0%) for XQ4-specific test sets Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d fn:tokenize Without the ! flag, empty-matching patterns raise FORX0003 in both XQ 3.1 and XQ 4.0 mode. With the ! flag in XQ 4.0, fn:replace uses the Java regex fallback and fn:tokenize tokenizes between each character. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
00e6756 to
17a7067
Compare
joewiz
added a commit
to joewiz/exist
that referenced
this pull request
Apr 14, 2026
… update statuses - Replace closed eXist-db#6213 (v2/jetty-12-upgrade) with eXist-db#6145 (feature/websocket-core) - Add CI Health Note explaining known noise: integration hangs, container image HTTP 502, XQTS runner Saxon 12 crash, and complementary empty-match failures in eXist-db#6212/eXist-db#6218 - Update XQTS runner: eXist-db#45 closed, eXist-db#49 is the active PR - Update cross-repo PR table accordingly - Update "Also Ready to Merge" table: mark eXist-db#6142, eXist-db#6146 merged; eXist-db#6186 superseded by eXist-db#6224; correct eXist-db#6087 approver; add status notes for eXist-db#6182, eXist-db#6184 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Apr 14, 2026
Member
Author
|
[This response was co-authored with Claude Code. -Joe] CI state: 6/9 checks pass. Of the 3 failures:
Dependencies: Wave 4. Must merge after all Wave 3 grammar PRs (particularly For full context on all 7.0 PRs and the merge order, see the Reviewer Guide. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
82 new or updated functions across fn:, array:, map:, and math: namespaces for XQuery 4.0. Includes fn:replace empty-match version gating (XQ4 behavior only in 4.0 mode).
What Changed
XQTS
Tests
Test plan
🤖 Generated with Claude Code