Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "rserve_client"

Title:R Rserve client
Rating:Not rated. Create the first rating!
Latest version:1.1.4
SHA1 sum:c6ef865f1cd9fe393213dd273fce13e96e4cb249
Author:Jan Wielemaker <jan@swi-prolog.org>
Maintainer:Jan Wielemaker <jan@swi-prolog.org>
Packager:Jan Wielemaker <jan@swi-prolog.org>
Home page:https://github.com/JanWielemaker/rserve_client
Download URL:https://github.com/JanWielemaker/rserve_client.git
Requires:prolog:c_cxx(_44856)

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.246310b7553b1bcea4b957f856bdd4516bbe7e0971https://github.com/JanWielemaker/rserve_client/archive/V0.2.zip
0.340e71bc7e1efcf71f7c0fb89759f1bc14e20125a1https://github.com/JanWielemaker/rserve_client/archive/V0.3.zip
0.473ef987f7955bdda8e239a449cdb3456cf84f4032https://github.com/JanWielemaker/rserve_client/archive/V0.4.zip
0.5a391ec6ab3783a71972cdfe557759eb55bc6e41d3https://github.com/JanWielemaker/rserve_client/archive/V0.5.zip
0.70fdc8eb6cbedeb24ff4e61736b90efd9044bbb895https://github.com/JanWielemaker/rserve_client/archive/V0.7.zip
82b2328e072367f5bd082d139667b9f96069ea281https://github.com/frnmst/rserve_client.git
83276460873cbead2fc934f59ff38dfbfb96a23f4https://github.com/JanWielemaker/rserve_client.git
0.826918c699e79e752e00af8079cab1be4cf65eb1714https://github.com/JanWielemaker/rserve_client/archive/V0.8.zip
92fb162eadf53c09bc9bc437aff0f4aa6709860f1https://api.github.com/repos/JanWielemaker/rserve_client/zipball/V0.8
1.0.024af60f47df090d593015ed24c97cfefdb9a24d81https://api.github.com/repos/JanWielemaker/rserve_client/zipball/V1.0.0
1.1.02af6c08fb1b59709dbc48b44f339b06f1217b4a51https://github.com/mgondan/rserve_client.git
48f335240fbb3e2a1fb493053b05fc8bd5f41aaf5https://github.com/JanWielemaker/rserve_client/archive/V1.1.0.zip
72838bbfa3976a83d19fb38bdae04378e30f4b0d1https://github.com/JanWielemaker/rserve_client.git
befdfab843d71bdabbe9574348697a6fe5be4fc31https://github.com/JanWielemaker/rserve_client.git
e761657f25828dc4d493ae3bb0c8f926cf19a2431https://github.com/JanWielemaker/rserve_client.git
eb438f8d3d2eb51b5d1ffa5e35b1fba167860ef016https://api.github.com/repos/JanWielemaker/rserve_client/zipball/V1.1.0
1.1.1d87e9f35cebc630b624b3f88bc934c375c94adf131https://github.com/JanWielemaker/rserve_client/archive/V1.1.1.zip
1.1.282cd0e1e65ebf3c0d48bebdd01e7ad5d4848b8a13https://github.com/JanWielemaker/rserve_client/archive/V1.1.2.zip
1.1.4c6ef865f1cd9fe393213dd273fce13e96e4cb2491https://github.com/JanWielemaker/rserve_client.git

Rserve client for SWI-Prolog/SWISH

Rserve R-package:

Compiling this package

This library is configured as a SWI-Prolog pack. It can be installed using the command below. The installation requires git, autoconf and the common C++ build tools.

?- pack_install('rserve_client').

This is tested on Ubuntu (14.04 and 16.04). It performs these steps:

  • Clone my fork of Rserve (some extensions to the C++ client)
  • Configure and build the C++ client library
  • Build the SWI-Prolog interface rserve.so

Using this package

This package is primarily intended for accessing R in server environments such as SWISH. We created a Docker container that runs Rserve in a sandbox. The container exposes Rserve using a Unix-domain socket at the following address:

/home/rserve/socket

With SWISH and is interface installed in adjacent directories, i.e., below the same parent, R may be linked to SWISH doing

:- use_module(lib/r_swish).

Now, R is not safe. You should either run Rserve in a tight OS container and load library(r/r_sandbox) or run SWISH in authenticated mode by loading lib/authenticate.pl.

Libraries provided

User libraries

library(r/r_call)
Defines basic user API to R
library(r/r_data)
Utilities to create and fetch R data frames

Implementation libraries

library(r/r_expand_dot)
Allow for dots in atoms and functors without quotes.
library(r/r_grammar)
R Parser utilities (lexer) that support R quasi quotations
library(r/r_term)
DCG non-terminal to translate a term into an R command string
library(r/r_sandbox)
Declare the R API sandbox-safe
library(r/r_serve)
Low-level level communication library

Status

This is just a proof of context. Obviously missing functionality:

  • Cover more Prolog term --> R translations, following Real.
  • Support OOB (Out Of Band) communication introduced in recent versions of Rserve to deal with R I/O.

Related projects

This interface is inspired by Real by Nicos Angelopoulos. Main differences:

  • Real is embedded in SWI-Prolog. This is more productive for local deployment as the communication is faster and R has access to its default environment. Thus, R can open graphical windows and can read and write files. Real is also much more mature, notably in the supporting a much larger part of the R syntax from Prolog.
  • Rserve runs typically using a different user in a different environment. The R environment cannot easily communicate with your local development environment. When used in a (web) server environment this comes with several advantages. We can seriously sandbox the R executable, each query in SWISH gets its own R instance and information can thus nog leak between queries and users.

Contents of pack "rserve_client"

Pack contains 13 files holding a total of 78.4K bytes.