Difference between revisions of "Java Examples"

From BaseX Documentation
Jump to navigation Jump to search
Line 34: Line 34:
 
==XQJ API==
 
==XQJ API==
  
Our current XQJ API is based on Charles Foster’s [http://xqj.net/basex/ XQJ implementation] (closed-source). It communicates with the BaseX server.
+
Charles Foster has provided an implementation of the [http://xqj.net/basex/ XQJ API] (closed-source). It is linked to the client/server architecture.
 
The basex-examples repository contains [https://github.com/BaseXdb/basex-examples/tree/master/src/main/java/org/basex/examples/xqj various examples] on how to use XQJ.
 
The basex-examples repository contains [https://github.com/BaseXdb/basex-examples/tree/master/src/main/java/org/basex/examples/xqj various examples] on how to use XQJ.
  

Revision as of 10:49, 6 June 2013

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.

Local Examples

Server Examples

XQuery Module Examples

  • FruitsExample.java
    demonstrates how Java classes can be imported as XQuery modules.
  • FruitsModule.java
    is a simple demo module called by FruitsExample.
  • ModuleDemo.java
    is a simple XQuery demo module that demonstrates how XQuery items can be processed from Java. It is derived from the QueryModule class.
  • QueryModule.java
    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 (see more).
 

XQJ API

Charles Foster has provided an implementation of the XQJ API (closed-source). It is linked to the client/server architecture. The basex-examples repository contains various examples on how to use XQJ.

Client API

REST API

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.