RBaseX | R Documentation |
'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.
'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.
new()
Initialize a new client-session
BasexClient$new(host, port = 1984L, username, password)
host, port, username, password
Host-information and user-credentials
Command()
Execute a command
BasexClient$Command(command)
command
Command
For a list of database commands see https://docs.basex.org/wiki/Commands
Execute()
Execute a command
BasexClient$Execute(command)
command
Command
For a list of database commands see https://docs.basex.org/wiki/Commands. This function is replaced by 'Command' and is obsolete.
Query()
Create a new query-object
BasexClient$Query(query_string)
query_string
Query-string
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.
ID for the created query-object
Create()
Create a new database
BasexClient$Create(name, input)
name
Name
input
Initial content, Optional
Initial content can be offered as string, URL or file.
Add()
Add a new resouce at the specified path
BasexClient$Add(path, input)
path
Path
input
File, directory or XML-string
put()
Add or replace resource, adressed by path
BasexClient$put(path, input)
path
Path
input
File, directory or XML-string
Replace()
Replace resource, adressed by path. This function is deprecated and has been replaced by /'put/'.
BasexClient$Replace(path, input)
path
Path
input
File, directory or XML-string
putBinary()
Store binary content
BasexClient$putBinary(path, input)
path
Path
input
File, directory or XML-string
Binary content can be retrieved by executing a retrieve-command
Store()
Store binary content
BasexClient$Store(path, input)
path
Path
input
File, directory or XML-string
Binary content can be retrieved by executing a retrieve-command. This function is deprecated and has been replaced by /'putBinary/'.
set_intercept()
Toggles between using the ´success'-field, returned by the Execute-command or using regular error-handling (try-catch).
BasexClient$set_intercept(Intercept)
Intercept
Boolean
restore_intercept()
Restore the Intercept Toggles to the original value
BasexClient$restore_intercept()
get_intercept()
Get current Intercept
BasexClient$get_intercept()
get_socket()
Get the socket-ID
BasexClient$get_socket()
Socket-ID,
set_success()
Set the status success-from the last operation on the socket
BasexClient$set_success(Success)
Success
Boolean
This function is intended to be used by instances from the QueryClass
get_success()
Get the status success-from the last operation on the socket
BasexClient$get_success()
Boolean,
clone()
The objects of this class are cloneable with this method.
BasexClient$clone(deep = FALSE)
deep
Whether to make a deep clone.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.