Java Examples

From BaseX Documentation

Jump to: navigation, search

This page is part of the Developer Section. The following Java code snippets demonstrate how easy it is to run database commands, create collections, perform queries, etc. by integrating the BaseX code. Most examples are taken from our basex-examples repository, in which you will find some more use cases.

[edit] Local Examples

The following code snippets work in embedded mode; they do not rely on an additional server instance:

[edit] Server Examples

The examples below take advantage of the client/server architecture:

[edit] XQuery Module Examples

BaseX provides Java Bindings for accessing external Java code via XQuery functions. The following examples show how this feature can be utilized:

    demonstrates how Java classes can be imported as XQuery modules.
    is a simple demo module called by FruitsExample.
    is a simple XQuery demo module that demonstrates how XQuery items can be processed from Java. It is derived from the QueryModule class.
    is located in the BaseX core. Java query modules can extend this class to get access to the current query context and enrich functions with properties ().

[edit] XQJ API

The implementation of the BaseX XQJ API (closed-source) has been written by Charles Foster. It uses the client/server architecture. The basex-examples repository contains various examples on how to use XQJ.

[edit] Client API

[edit] REST API

[edit] XML:DB API (deprecated)

Note that the XML:DB API does not talk to the server and can thus only be used in embedded mode.

Personal tools