6 Programming Interfaces

There are various ways to make your application programs access data in MonetDB/XQuery. The basic client-server programmers interface for MonetDB is Mapi; you can use it from C/C++. This is a fastest but also most low-level and MonetDB-specific interface that works with XQuery. While in principle Mapi bindings for other languages (perl, python, php) exist, these are currently focused on relational (MIL, MAL, SQL) access; some work is needed to make it possible to use them for XML (see contributing).

For high-performance (low-latency) applications such as web environments, we recommend using XRPC. MonetDB/XQuery comes with a built-in HTTP server that can service SOAP calls that execute an XQuery via the XRPC mechanism. Such SOAP requests invoke a XQuery Function that must be predefined in an XQuery Module. Such pre-defined functions are executed as canned queries, therefore can be very efficient (no query optimization time). We provide convenience APIs for posing XRPC SOAP queries from Java and Javascript (i.e. directly from web pages). The Administrative GUI of MonetDB/XQuery an example of an application entirely based on such AJAX-style web pages (see The Administrative GUI).

MonetDB/SQL also supports JDBC and this interface can also be used to pose XQuery queries to MonetDB/XQuery (passing a special language=xquery option at connection initialization).

For reference, we also provide the instructions for setting up mclient using CGI under the Apache web-server. However, we consider CGI superseded by XRPC for web-based applications.