Upgrading to BaseX 13
This article summarizes the changes that may require adjustments when migrating existing projects from BaseX 12. Details are given in the linked articles, the highlights of the release are presented in BaseX 13, and all additions and updates are listed in the Changelog.
Critical Changes
The following changes can prevent BaseX from starting or clients from connecting, or change results without raising an error. Most other changes raise errors that point to the required adjustment.
- Java: Java 21 or later is required (see Startup).
- Configuration: Existing
.basexfiles are no longer rewritten: old values ofPARALLELandHTTPLOCALremain effective (see Configuration). - Server:
basexhttpno longer starts a database server on port 1984 (see Server and Clients). - Clients: Clients of BaseX 8 to 12 cannot connect, and users with
digesthashes can no longer log in (see Server and Clients). - Web application: A Jakarta EE 10 servlet container is required, and RESTXQ results other than a single element are sent as
text/plain(see Server and Clients). - Downgrades: Databases written by BaseX 13 may be rejected by BaseX 12 (see Compatibility).
- Databases:
STRIPWSpreserves whitespace in mixed content, anddb:createand related functions ignore options assigned withSETor in.basex(see Databases). - Options: Boolean options must be booleans:
fn:serialize($data, { 'indent': 'no' })raises an error (see Functions). - External resources: DTDs, entities, XInclude documents and schemas are only fetched if
TRUSTEXTERNALis enabled (see Functions). - Results:
http:send-requestreturns lower-case header names, the XHTML method serializes HTML5, and dates without timezone may shift by an hour (see Functions, Serialization and Language).
Configuration
- Entries of an existing
.basexfile take precedence over the new defaults: remove them, or delete the file to have a new one created. Removed local options (e.g.SPLITSIZE) are reported on every start until they are removed. - A
.basexor.basexhomefile in an ancestor of the user directory may now determine the home directory (see Configuration).
Databases
Compatibility
Databases created with BaseX 12 can be opened with BaseX 13, including their index structures, and vice versa. BaseX 12 rejects a database in the following cases:
- Updated indexes: With
UPDINDEX, which is now enabled by default, larger updates of indexed databases (beyond 100,000 nodes) are stored in a new index format. Optimize the database withOPTIMIZEordb:optimizeto make it readable again, or disable the option (see Updates). - Mixed content: The new
FTMIXEDoption is enabled and a full-text index exists. Drop the index, or disable the option and optimize the database. - Namespaces: The namespace structure has more than 4,096 entries. Such structures are stored in a compact format.
Changes
db:create,db:add,db:put,db:optimize,fetch:doc: Options are taken from$options, option declarations and pragmas, but no longer fromSETor.basex(see Create Options).STRIPWSpreserves whitespace in mixed content,UPDINDEXis enabled by default, andPARALLELdefaults to32.- Various options were removed, e.g.
MIXUPDATES,ADDCACHE,FORCECREATEandCHECKSTRINGS(see Options). db:putand related functions only replace the resource at the specified path.- Full-text terms with characters such as
ßoræare only found after the index has been rebuilt (see Full-Text Index).
Server and Clients
- Server: Start
basexhttpwith-Lor disableHTTPLOCALif Clients need to connect on port 1984. Servers can only be stopped from the same host, with the binaries of the same version. - Authentication: The Server Protocol uses salted authentication: third-party bindings must be updated, and clients of version 13 cannot connect to older servers. HTTP Digest authentication, the XML:DB API and the outdated clients were removed (see User Management).
- Permissions: CREATE was merged into ADMIN, and more functions and options require ADMIN (see User Management).
- Web Server: Jakarta EE 10 containers are supported, such as Tomcat 10.1, Jetty 12 or WildFly 27. Compare a custom
web.xmlwith the one of the distribution;jetty.xmlis optional, and the port is specified withHTTPPORT. Session cookies are sent withSameSite=Lax(see Web Application). - RESTXQ: Results without
media-typeandmethodare only sent asapplication/xmlif they are a single element; add%output:media-typeto keep the old type. Server-side forwarding was dropped, and unmatched requests and permission errors are answered with specific status codes (see RESTXQ). - WebSockets:
%ws:header-paramwas removed, error messages are only sent by%ws:errorfunctions, and connections are closed with their HTTP session (see WebSockets).
Language
The implementation follows the latest drafts of XQuery 4.0:
- Records have a fixed set of fields (no
field?or*), declared record types are nominative, and built-in record types have no constructor functions. gnode()was removed:node()matches XML nodes and JNodes, andxnode()XML nodes only. Values with multiple items are represented by a separate JNode.- The
%methodannotation was replaced by=?>, and the map and array filter, thenondeterministicprefix and the regular expression flagsj,!and;were removed. - Dates and times without timezone are adjusted with the implicit timezone: results may shift by an hour.
Functions
- Boolean options must be booleans: use
{ 'indent': false() }instead of{ 'indent': 'no' }. - External DTDs, entities, XInclude documents and schemas are only fetched if the
trust-externaloption orTRUSTEXTERNALis enabled, and modules loaded withfn:load-xquery-moduleare untrusted by default. - Renamed or removed:
fn:sequence-join→fn:insert-separator,fn:csv-to-arrays→fn:parse-csv,map:pairs→map:entries,map:of-pairs→map:build,hof:scan-left→fn:scan,convert:dayTime-to-integer→fn:duration-to-seconds,convert:binary-to-string→ Binary Functions,string:format→fn:pad-string, and more. The Higher-Order Functions Module andweb:forwardwere removed (see Changelog). - Options and parameters of various functions were renamed or removed, e.g. in the CSV Functions, JSON Functions and File Functions.
- Results change for
http:send-request(lower-case header names, fewer redirects),ft:thesaurus(one level),using fuzzy 0 errors(exact matching),fn:decode-from-uri(plus signs),file:delete(missing paths), CSV parsing (quotes in unquoted fields) and Cache Functions (expiry after 24 hours). job:execute: Jobs may only read databases that are read-locked by the calling query.
Serialization
- The
xhtmlmethod serializes HTML5 by default; specifyhtml-versionto get the old output. - The custom parameters
indents,newlineandtabulatorwere removed: useindent-unitandline-ending. - The adaptive method outputs doubles as JSON numbers, and the output of
fn:traceis dropped for users without ADMIN permission.
Graphical User Interface
Only a single GUI instance is opened per project directory, the fullscreen mode and the editing of nodes in the visualizations were removed, and the Map view is disabled by default (see Graphical User Interface).