Changes

Jump to navigation Jump to search
441 bytes removed ,  10:42, 6 September 2020
no edit summary
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 [https://github.com/BaseXdb/basex-examples/tree/master/basex-examples/src/main/java/org/basex/examples / basex-examples] repository, in which you will find some more use cases.
<div style="float:left; width:48%;">
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/server/ServerConcurrency.java ServerConcurrency.java]<br/>runs concurrent queries.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/server/ServerQueries.java ServerQueries.java]<br/>shows how iterative queries can be performed.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/server/ServerEventsGUI.java ServerEventsGUI.java]<br/>is a little GUI example for demonstrating database events.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/server/UserExample.java UserExample.java]<br/>manages database users.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/module/FruitsModule.java FruitsModule.java]<br/>is a simple demo module called by {{Code|FruitsExample}}.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/module/ModuleDemo.java ModuleDemo.java]<br/>is a simple XQuery demo module that demonstrates how XQuery items can be processed from Java. It is derived from the {{Code|QueryModule}} class.
* [https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/QueryModule.java QueryModule.java]<br/>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 ().
</div><div style="float:left; width:4%;">&nbsp;
</div><div style="float:left; width:48%;">
 
==XQJ API==
 
The implementation of the [http://xqj.net/basex/ BaseX XQJ API] (closed-source) has been written by Charles Foster. It uses 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.
==[[Clients|Client API]]==
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/api/CreateExample.java CreateExample.java]<br/>shows how new databases can be created.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/api/AddExample.java AddExample.java]<br/>shows how documents can be added to databases, and how existing documents can be replaced.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/api/EventExample.java EventExample.java]<br/>demonstrates how to trigger and receive database events.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/api/BinaryExample.java BinaryExample.java]<br/>shows how binary resource can be added to and retrieved from the database.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/xmldb/XMLDBQuery.java XMLDBQuery.java]<br/>runs a query using XML:DB.
* [https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/xmldb/XMLDBInsert.java XMLDBInsert.java]<br/>inserts a document into a database using XML:DB.
 
==XQJ API (closed source)==
 
The implementation of the [http://xqj.net/basex/ BaseX XQJ API] has been written by Charles Foster. The basex-examples repository contains [https://github.com/BaseXdb/basex/tree/master/basex-examples/src/main/java/org/basex/examples/xqj various examples] on how to use XQJ.
</div>
 
[[Category:Developer]]
__NOTOC__
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu