RBaseX: RBaseX

RBaseXR Documentation

RBaseX

Description

'BaseX' is a robust, high-performance XML database engine and a highly compliant XQuery 3.1 processor with full support of the W3C Update and Full Text extensions.

The client can be used in 'standard' mode and in 'query' mode. Standard Mode is used for connecting to a server and sending commands.

Details

'RBaseX' was developed using R6. For most of the public methods in the R6-classes, wrapper-functions are created. The differences in performance between R6-methods and wrapper-functions are minimal and slightly in advantage of the R6-version.

It is easy to use the R6-calls instead of the wrapper-functions. The only important difference is that in order to execute a query, you have to call ExecuteQuery() on a queryObject.

Methods

Public methods


Method new()

Initialize a new client-session

Usage
BasexClient$new(host, port = 1984L, username, password)
Arguments
host, port, username, password

Host-information and user-credentials


Method Command()

Execute a command

Usage
BasexClient$Command(command)
Arguments
command

Command

Details

For a list of database commands see https://docs.basex.org/wiki/Commands


Method Execute()

Execute a command

Usage
BasexClient$Execute(command)
Arguments
command

Command

Details

For a list of database commands see https://docs.basex.org/wiki/Commands. This function is replaced by 'Command' and is obsolete.


Method Query()

Create a new query-object

Usage
BasexClient$Query(query_string)
Arguments
query_string

Query-string

Details

A query-object has two fields. 'queryObject' is an ID for the new created 'QueryClass'-instance. 'success' holds the status from the last executed operation on the queryObject.

Returns

ID for the created query-object


Method Create()

Create a new database

Usage
BasexClient$Create(name, input)
Arguments
name

Name

input

Initial content, Optional

Details

Initial content can be offered as string, URL or file.


Method Add()

Add a new resouce at the specified path

Usage
BasexClient$Add(path, input)
Arguments
path

Path

input

File, directory or XML-string


Method put()

Add or replace resource, adressed by path

Usage
BasexClient$put(path, input)
Arguments
path

Path

input

File, directory or XML-string


Method Replace()

Replace resource, adressed by path. This function is deprecated and has been replaced by /'put/'.

Usage
BasexClient$Replace(path, input)
Arguments
path

Path

input

File, directory or XML-string


Method putBinary()

Store binary content

Usage
BasexClient$putBinary(path, input)
Arguments
path

Path

input

File, directory or XML-string

Details

Binary content can be retrieved by executing a retrieve-command


Method Store()

Store binary content

Usage
BasexClient$Store(path, input)
Arguments
path

Path

input

File, directory or XML-string

Details

Binary content can be retrieved by executing a retrieve-command. This function is deprecated and has been replaced by /'putBinary/'.


Method set_intercept()

Toggles between using the ´success'-field, returned by the Execute-command or using regular error-handling (try-catch).

Usage
BasexClient$set_intercept(Intercept)
Arguments
Intercept

Boolean


Method restore_intercept()

Restore the Intercept Toggles to the original value

Usage
BasexClient$restore_intercept()

Method get_intercept()

Get current Intercept

Usage
BasexClient$get_intercept()

Method get_socket()

Get the socket-ID

Usage
BasexClient$get_socket()
Returns

Socket-ID,


Method set_success()

Set the status success-from the last operation on the socket

Usage
BasexClient$set_success(Success)
Arguments
Success

Boolean

Details

This function is intended to be used by instances from the QueryClass


Method get_success()

Get the status success-from the last operation on the socket

Usage
BasexClient$get_success()
Returns

Boolean,


Method clone()

The objects of this class are cloneable with this method.

Usage
BasexClient$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

## Not run: 
    Session <- BasexClient$new("localhost", 1984L, username = "<username>", password = "<password>")
    Session$Execute("Check test")
    Session$Execute("delete /")
    # Add resource
    Session$Add("test.xml", "<root/>")

    # Bindings -----
    query_txt <- "declare variable $name external; for $i in 1 to 3 return element { $name } { $i }"
    query_obj <- Session$Query(query_txt)
    query_obj$queryObject$Bind("$name", "number")
    print(query_obj$queryObject$ExecuteQuery())

## End(Not run)

RBaseX documentation built on Dec. 2, 2022, 5:10 p.m.

Related to RBaseX in RBaseX...