Xquery 3.0 69 Higher-Order Functions 75 Full-Text 82 Full-Text/Japanese 85 Xquery Update 87 Java Bindings 91 Packaging 92 Xquery Errors 95 Serialization 105
Total Page:16
File Type:pdf, Size:1020Kb
BaseX Documentation Version 7.2 PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information. PDF generated at: Sat, 24 Mar 2012 17:30:37 UTC Contents Articles Main Page 1 Getting Started 3 Getting Started 3 Startup 4 Startup Options 6 Start Scripts 13 User Interfaces 16 Graphical User Interface 16 Shortcuts 20 Database Server 23 Standalone Mode 26 Web Application 27 General Info 30 Databases 30 Binary Data 32 Parsers 33 Commands 37 Options 50 Integration 64 Integrating oXygen 64 Integrating Eclipse 66 Query Features 68 Querying 68 XQuery 3.0 69 Higher-Order Functions 75 Full-Text 82 Full-Text/Japanese 85 XQuery Update 87 Java Bindings 91 Packaging 92 XQuery Errors 95 Serialization 105 XQuery Modules 108 Cryptographic Module 108 Database Module 113 File Module 120 Full-Text Module 125 HTTP Module 128 Higher-Order Functions Module 131 Index Module 133 JSON Module 135 Map Module 140 Math Module 144 Repository Module 148 SQL Module 149 Utility Module 153 XSLT Module 157 ZIP Module 160 ZIP Module: Word Documents 162 Developing 164 Developing 164 Integrate 165 Git 166 Maven 172 Releases 174 Translations 175 HTTP Services 176 REST 176 REST: POST Schema 184 RESTXQ 185 WebDAV 189 WebDAV: Windows 7 190 WebDAV: Windows XP 192 WebDAV: Mac OSX 195 WebDAV: GNOME 197 WebDAV: KDE 199 Client APIs 201 Clients 201 Standard Mode 202 Query Mode 203 PHP Example 205 Server Protocol 206 Server Protocol: Types 210 Java Examples 212 Advanced User's Guide 214 Advanced User's Guide 214 Configuration 215 Catalog Resolver 216 Statistics 218 Backups 222 User Management 222 Transaction Management 224 Logging 225 Events 226 Indexes 228 Execution Plan 230 References Article Sources and Contributors 231 Image Sources, Licenses and Contributors 233 Article Licenses License 234 Main Page 1 Main Page Welcome to the documentation of BaseX! BaseX [1] is both a light-weight, high-performance and scalable XML Database and an XPath/XQuery Processor with full support for the W3C Update and Full Text extensions. It focuses on storing, querying, and visualizing large XML and JSON documents and collections. A visual frontend allows users to interactively explore data and evaluate queries in realtime (i.e., with each key click). BaseX is platform-independent and distributed under the free BSD License (find BaseX GUI more in Wikipedia [2]). This documentation is based on BaseX 7.1.1. Features that have recently been changed are flagged in red (e.g.: Version 7.2). Getting Started The Getting Started Section gives you a quick introduction to BaseX. We suggest you to start with the Graphical User Interface as this is the easiest way to access your XML data, and to get an idea of how XQuery and BaseX works. Categories: Beginners XQuery Portal More information on using the wide range of XQuery functions and performing XPath and XQuery requests with BaseX can be found in our XQuery Portal. Categories: XQuery Developer Section The Developer Section provides useful information for developers. Here you can find information on various alternatives to integrate BaseX into your own project. Categories: Developer, HTTP, API Advanced User's Guide Information for advanced users can be found in our Advanced Usage Section, which contains details on the BaseX storage and the Server architecture, and presents some more GUI features. Categories: Internals You are invited to contribute to our Wiki: it's easy to get a new account. If you have questions and are looking for direct contact to developers and users, please write to our mailing list [3] ([email protected]). Main Page 2 References [1] http:/ / basex. org [2] http:/ / en. wikipedia. org/ wiki/ BaseX [3] http:/ / basex. org/ open-source/ 3 Getting Started Getting Started This page is one of the Main Sections of the documentation. It gives a quick introduction on how to start, run, and use BaseX. Getting Started • Startup: How to get BaseX running • Startup Options: See which command-line flags exist User Interfaces • Graphical User Interface: Working with the GUI (see available Shortcuts) • Database Server: Working with the client/server architecture • Standalone Mode: Working with the BaseX console on local databases • Web Application: Working with the HTTP server architecture General Info • Databases: Describes how Databases are created, populated and deleted in BaseX • Parsers: Describes how to convert different input formats to XML • Commands: Commands for managing BaseX and the databases • Options: Overview on all settable options Integration • Integrating oXygen: Use BaseX within the oXygen XML Editor • Integrating Eclipse: Use BaseX within Eclipse Startup 4 Startup This article is part of the Getting Started Guide. It tells you how to get BaseX running. Requirements BaseX Please download [1] the latest BaseX version from our homepage. The official releases include the BaseX JAR file, libraries and optional Start Scripts. If you do not use an installer, we recommend to manually add the project’s bin directory to your path environment; this way, you will be able to run BaseX from everywhere in your shell/terminal. Java A Runtime Environment of Java 1.6 [2] (JRE) is needed to run BaseX. BaseX is platform independent and runs on any system that provides a Java Virtual Machine. BaseX has been tested on Windows (2000, XP, Vista, 7), Max OS X (10.x), Linux(SuSE xxx, Debian, Ubuntu) and OpenBSD (4.x). GUI/Standalone vs. Client/Server The standalone client and the GUI of BaseX are not synchronized with other BaseX instances. If you plan to concurrently write to the same database instances, the client/server architecture is mandatory! You may encounter unexpected behavior, and your databases might even get corrupt, if you use BaseX instances that run in different Java VMs. BaseX GUI The GUI is the visual interface to the features of BaseX. It can be used to create new databases, perform queries or interactively explore your XML data. The GUI can be started as follows (get more information on all Startup Options): • Double click on the BaseX.jar file. • Run one of the basexgui or basexgui.bat scripts. • Execute the following command: java -cp BaseX.jar org.basex.BaseXGUI • On Windows: Double click on the BaseX GUI icon. • For Maven users: type in mvn exec:java in the main directory of the basex project. BaseX Standalone The Standalone Mode can be used to enter database commands, or execute automated database operations and queries, on command line. The standalone version can be started as follows (get more information on all Startup Options): • Run one of the basex or basex.bat scripts. • Execute the following command: java -cp BaseX.jar org.basex.BaseX • On Windows: Double click on the BaseX icon. Startup 5 BaseX Server The Database Server comes into play if BaseX is to be used by more than one user (client). It handles concurrent read and write transactions, provides user management and logs all user interactions. By default, the server listens to the port 1984. There are several ways of starting and stopping the server (get more information on all Startup Options): • Run one of the basexserver or basexserver.bat scripts. Add the stop keyword to gracefully shut down the server. • Execute the following command: java -cp BaseX.jar org.basex.BaseXServer. Again, the stop keyword will ensure a graceful shutdown. • On Windows: Double click on the BaseX Server icon, which will also start the HTTP Server, or the BaseX Server (stop) icon. Pressing Ctrl+c will close all connections and databases and shut down the server process. BaseX Client The BaseX Client interface can be used to send commands and queries to the server instance on command line. It can be started as follows (get more information on all Startup Options): • Run one of the basexclient or basexclient.bat scripts. • Execute the following command: java -cp BaseX.jar org.basex.BaseXClient • On Windows: Double click on the BaseX Client icon. The default admin user can be used to connect to the server: • Username: admin • Password: admin The password should be changed with the PASSWORD command after the first login. Please check out the article on the Database Server for more details. BaseX HTTP Server The HTTP Server gives access to the REST, RESTXQ and WebDAV Services of BaseX. By default, it starts an instance of the Jetty Web Server [3], which listens to the port 8984, and the BaseX Server, which listens to 1984. The HTTP Server can be started as follows (get more information on all Startup Options): • Run one of the basexhttp or basexhttp.bat scripts. Add the stop keyword to gracefully shut down the server. • On Windows: Double click on the BaseX Server or BaseX Server (stop) icon. • For Maven users: type in mvn jetty:run in the main directory of the basex-api project, and press Ctrl+c to shut down the process. • You may also want to deploy BaseX as a Web Application. Startup 6 Changelog Version 7.0 • Updated: the BaseXJAXRX has been replaced with BaseXHTTP References [1] http:/ / basex. org/ download [2] http:/ / www. java. com [3] http:/ / jetty. codehaus. org/ jetty/ Startup Options This article is part of the Getting Started Guide. It gives more details on the command-line options of all BaseX start scripts. BaseX GUI Launch the GUI $ basexgui [file] One or more XML and XQuery files can be passed on as parameters. If an XML file is specified, a database instance is created from this file, or an existing database is opened. XQuery files are opened in the XQuery editor. BaseX Standalone Launch the console mode $ basex