registerFunctions: Register R functions as external Zorba functions

Description Usage Arguments Author(s) References See Also

Description

We can use R functions as part of Zorba queries by registering these R functions as external functions with the Zorba engine. We do this (in Zorba 1.0.0) by creating an external module and then associating it with a static context which is used in the evaluation of the Zorba query. The external module

We could have an external module that looks up the R object by name along the R search path (or within a particular R environment) and that does not require explicitly registering the functions by name. This is similar to RObjectTables.

Usage

1
2
3
4
5
6
7
8
registerFunctions(module, factory = itemFactory(), ...,
                  .funcs = list(...),
                   .deterministic = rep(TRUE, length(.funcs)),
                    fix = length(names(.funcs)) == 0 || any(names(.funcs) == ""))

createModule(urn = "urn:R", ctxt = makeContext(zorba()), e = new.env(), 
              obj = new("RExternalModule"), register = !missing(ctxt)) 
getEnvironment(from, ...) 

Arguments

module

the ExternalModule object in which these functions will be registered.

factory

the ItemFactory to use for the functions

...

the collection of functions specified individually in the call

.funcs

the collection of functions specified as a single list

.deterministic

a logical vector with as many elements as there are functions being registered. A value of FALSE indicates that the function should be called with two additional parameters - the static and dynamic Zorba context associated with the Zorba query being evaluated.

fix

a logical value indicating whether the functions need to be processed to determine their names.

from

the ExternalModule whose environment is being requested.

urn

the namespace for these functions

ctxt

the zorba::StaticContext in which to register these functions

e

the environment to use for the ExternalModule to house the R functions.

obj

the object that will be filled in when creating the ExternalModule.

register

whether to register the module with the specified context.

Author(s)

Duncan Temple Lang

References

XQuery http://www.w3.org/TR/xquery/

Zorba http://www.zorba-xquery.com/

See Also

xquery


omegahat/RXQuery documentation built on May 24, 2019, 1:55 p.m.