Difference between revisions of "Clients"

From BaseX Documentation
Jump to navigation Jump to search
 
(89 intermediate revisions by 4 users not shown)
Line 1: Line 1:
We provide clients in several programming languages. With the following light-weight bindings,
+
{{Announce|The conventions for the client functions were revised:}}
you will be able to connect to a running BaseX server instance, execute all database
+
 
commands and perform queries.
+
* The {{Code|replace}} and {{Code|store}} functions have been renamed to {{Code|put}} and {{Code|putBinary}}.
+
* The {{Code|RETRIEVE}} command has been replaced by {{Command|BINARY GET}}.
* [[Standard Mode]]: Description of the usage of the standard mode.  
+
* Existing client implementations are working without changes unless they haven’t been upgraded.
* [[Query Mode]]: Description of the usage of the query mode.
+
 
 +
This page is part of the [[Developer Section]]. It describes how to communicate with BaseX
 +
from other programming languages.
 +
 
 +
You can use the following light-weight language bindings to connect to a running BaseX server
 +
instance, execute database commands and evaluate XQuery expressions.
 +
 
 +
Most clients provide two modes:
 +
 
 +
* [[Standard Mode]]: connecting to a server, sending commands
 +
* [[Query Mode]]: defining queries, binding variables, iterative evaluation
 +
 
 +
Please see the [[Server Protocol]] for more information on the available commands. Currently, we offer bindings for the following programming languages:
 +
 
 +
<table width='100%'>
 +
  <tr>
 +
    <td width='50%' valign='top'>'''BaseX 7.x, BaseX 8.x and later'''
 +
* [https://github.com/BaseXdb/basex/tree/main/basex-examples/src/main/java/org/basex/examples/api Java]: The default implementation
 +
* [https://github.com/bsella/BaseX_CppClient C++]: contributed by Karim Salama (based on SDL2_net)
 +
* [https://github.com/JohnLeM/BasexCPPAPI/ C++]: contributed by Jean-Marc Mercier (based on libboost)
 +
* [https://github.com/BaseXdb/basex/tree/main/basex-api/src/main/c%23 C#], contributed by the BaseX Team and Martín Ferrari
 +
* [https://github.com/BaseXdb/basex/tree/main/basex-api/src/main/c C], contributed by the BaseX Team
 +
* [https://github.com/programaths/go-basex Golang]: contributed by Christian Baune
 +
* [https://github.com/zadean/basexerl/blob/main/src/bxe_client.erl Erlang]: contributed by Zachary Dean
 +
* [https://github.com/apb2006/basex-node node.js]: contributed by Andy Bunce
 +
* [https://github.com/BaseXdb/basex/tree/main/basex-api/src/main/perl Perl], contributed by the BaseX Team
 +
* [https://github.com/BaseXdb/basex/tree/main/basex-api/src/main/php PHP]: updated by James Ball
 +
* [https://github.com/BaseXdb/basex/tree/main/basex-api/src/main/python Python]: contributed by Hiroaki Itoh
 +
* [https://github.com/lucalianas/pyBaseX Python], using BaseX REST services: contributed by Luca Lianas
 +
* [https://github.com/BenEngbers/RBaseX R]: contributed by Ben Engbers
 +
* [https://github.com/BaseXdb/basex/tree/main/basex-api/src/main/raku Raku]: contributed by Wayland
 +
* [https://github.com/BaseXdb/basex/tree/main/basex-api/src/main/ruby Ruby], contributed by the BaseX Team
 +
* [https://github.com/eptx/v-basex V], contributed by Erik Peterson
  
Currently, we offer bindings for the following programming languages (bindings for other languages are welcome):
+
With <b>Version 8.0</b>, authentication has changed. Some language bindings have not been updated yet. The update is rather trivial, though ([[Server_Protocol#Authentication|see here]] for more details); patches are welcome.
; Imperative:
+
    </td>
: [https://github.com/BaseXdb/basex-api/tree/master/src/main/c C]
+
    <td width='50%' valign='top'>'''BaseX 7.x''' (outdated)
; Object oriented:
+
* [https://github.com/BaseXdb/basex/tree/7.9/basex-api/src/main/as ActionScript]: contributed by Manfred Knobloch
: [https://github.com/BaseXdb/basex-api/tree/master/src/main/c%23 C#], [https://github.com/BaseXdb/basex-api/tree/master/src/main/vb VB], [https://github.com/BaseXdb/basex-api/tree/master/src/main/java Java], [https://github.com/BaseXdb/basex-api/tree/master/src/main/scala Scala]
+
* [https://github.com/BaseXdb/basex/tree/7.9/basex-api/src/main/haskell Haskell]: contributed by Leo W&ouml;rteler
: [https://github.com/BaseXdb/basex-api/tree/master/src/main/qt Qt] (contributed by Hendrik Strobelt)
+
* [https://github.com/BaseXdb/basex/tree/7.9/basex-api/src/main/lisp Lisp]: contributed by Andy Chambers
; Scripting
+
* [https://github.com/hanshuebner/simple-basex node.js]: contributed by Hans Hübner (deviating from client API)
: [https://github.com/BaseXdb/basex-api/tree/master/src/main/php PHP], [https://github.com/BaseXdb/basex-api/tree/master/src/main/python Python], [https://github.com/BaseXdb/basex-api/tree/master/src/main/perl Perl], [https://github.com/BaseXdb/basex-api/tree/master/src/main/ruby Ruby]
+
* [https://github.com/BaseXdb/basex/tree/7.9/basex-api/src/main/qt Qt]: contributed by Hendrik Strobelt
: [https://github.com/BaseXdb/basex-api/tree/master/src/main/rebol Rebol] (contributed by Sabu Francis)
+
* [https://github.com/BaseXdb/basex/tree/7.9/basex-api/src/main/rebol Rebol]: contributed by Sabu Francis
; Functional:
+
* [https://github.com/delving/basex-scala-client Scala]: contributed by Manuel Bernhardt
: [https://github.com/BaseXdb/basex-api/tree/master/src/main/lisp Lisp] (contributed by Andy Chambers)
+
* [https://github.com/BaseXdb/basex/tree/7.9/basex-api/src/main/scala Scala] (simple implementation)
: [https://github.com/BaseXdb/basex-api/tree/master/src/main/haskell Haskell] (contributed by Leo W&ouml;rteler)
+
* [https://github.com/BaseXdb/basex/tree/main/basex-api/src/main/vb VB], contributed by the BaseX Team
 +
    </td>
 +
  </tr>
 +
</table>
 
   
 
   
Most of the interfaces contain at least the following six files:
+
Many of the interfaces contain the following files:
* <code>BaseXClient</code> contains the actual code for creating a session, sending and executing commands and receiving results. Furthermore there is an inner class called <code>query</code> which offers the evaluation of queries in an iterative manner.  
+
* <code>BaseXClient</code> contains the code for creating a session, sending and executing commands and receiving results. An inner <code>Query</code> class facilitates the binding of external variables and iterative query evaluation.
 
* <code>Example</code> demonstrates how to send database commands.
 
* <code>Example</code> demonstrates how to send database commands.
 
* <code>QueryExample</code> shows you how to evaluate queries in an iterative manner.
 
* <code>QueryExample</code> shows you how to evaluate queries in an iterative manner.
Line 27: Line 62:
 
* <code>AddExample</code> shows how documents can be added to a database by using streams.
 
* <code>AddExample</code> shows how documents can be added to a database by using streams.
  
The interfaces Java and C# also support [[Events]]:
+
=Changelog=
* <code>EventExample</code> demonstrates how to watch and unwatch events.
+
 
+
;Version 10.0
Please check out [https://github.com/BaseXdb/basex-api/blob/master/src/main/readme.txt readme.txt]
+
* Updated: The {{Code|replace}} and {{Code|store}} functions have been renamed to {{Code|put}} and {{Code|putBinary}}.
for more information on the client/server protocol.
 
  
[[Category:Developer]]
+
;Version 8.0
[[Category:Server]]
+
* Updated: cram-md5 replaced with digest authentication.
[[Category:API]]
 

Latest revision as of 16:29, 29 June 2023

The conventions for the client functions were revised:

  • The replace and store functions have been renamed to put and putBinary.
  • The RETRIEVE command has been replaced by BINARY GET.
  • Existing client implementations are working without changes unless they haven’t been upgraded.

This page is part of the Developer Section. It describes how to communicate with BaseX from other programming languages.

You can use the following light-weight language bindings to connect to a running BaseX server instance, execute database commands and evaluate XQuery expressions.

Most clients provide two modes:

  • Standard Mode: connecting to a server, sending commands
  • Query Mode: defining queries, binding variables, iterative evaluation

Please see the Server Protocol for more information on the available commands. Currently, we offer bindings for the following programming languages:

BaseX 7.x, BaseX 8.x and later
  • Java: The default implementation
  • C++: contributed by Karim Salama (based on SDL2_net)
  • C++: contributed by Jean-Marc Mercier (based on libboost)
  • C#, contributed by the BaseX Team and Martín Ferrari
  • C, contributed by the BaseX Team
  • Golang: contributed by Christian Baune
  • Erlang: contributed by Zachary Dean
  • node.js: contributed by Andy Bunce
  • Perl, contributed by the BaseX Team
  • PHP: updated by James Ball
  • Python: contributed by Hiroaki Itoh
  • Python, using BaseX REST services: contributed by Luca Lianas
  • R: contributed by Ben Engbers
  • Raku: contributed by Wayland
  • Ruby, contributed by the BaseX Team
  • V, contributed by Erik Peterson

With Version 8.0, authentication has changed. Some language bindings have not been updated yet. The update is rather trivial, though (see here for more details); patches are welcome.

BaseX 7.x (outdated)
  • ActionScript: contributed by Manfred Knobloch
  • Haskell: contributed by Leo Wörteler
  • Lisp: contributed by Andy Chambers
  • node.js: contributed by Hans Hübner (deviating from client API)
  • Qt: contributed by Hendrik Strobelt
  • Rebol: contributed by Sabu Francis
  • Scala: contributed by Manuel Bernhardt
  • Scala (simple implementation)
  • VB, contributed by the BaseX Team

Many of the interfaces contain the following files:

  • BaseXClient contains the code for creating a session, sending and executing commands and receiving results. An inner Query class facilitates the binding of external variables and iterative query evaluation.
  • Example demonstrates how to send database commands.
  • QueryExample shows you how to evaluate queries in an iterative manner.
  • QueryBindExample shows you how to bind a variable to your query and evaluates the query in an iterative manner.
  • CreateExample shows how new databases can be created by using streams.
  • AddExample shows how documents can be added to a database by using streams.

Changelog[edit]

Version 10.0
  • Updated: The replace and store functions have been renamed to put and putBinary.
Version 8.0
  • Updated: cram-md5 replaced with digest authentication.