Rolog - calling Prolog from R - Replies

The package is now available on CRAN, so that users of the new R 4.2 can install it easily with

install.packages(“rolog”)

from R. Some use cases are described in the draft of the vignette, more will come.

This looks really cool! If i understand the README correctly, a separate installation of SWI prolog is not necessary (because SWI is embedded in Rolog)? I have tried the package real previously without success…

I installed the latest version of R (4.2.0) on MacOs 10.15.7 by doing:
remotes::install_github('mgondan/rolog', build_vignettes=TRUE)
But i got:

Running `R CMD build`...
* checking for file '/private/var/folders/08/z22wkgf50290q8chwb6cz7n00000gn/T/RtmpFsEvGs/remotes7c25365bc72d/mgondan-rolog-fb0a3bf/DESCRIPTION' ... OK
* preparing 'rolog':
* checking DESCRIPTION meta-information ... OK
* cleaning src
STDOUT:
* checking for file '/private/var/folders/08/z22wkgf50290q8chwb6cz7n00000gn/T/RtmpFsEvGs/remotes7c25365bc72d/mgondan-rolog-fb0a3bf/DESCRIPTION' ... OK
* preparing 'rolog':
* checking DESCRIPTION meta-information ... OK
* cleaning src
STDERR:
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_TIME failed, using "C" 
3: Setting LC_MESSAGES failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 
Error in loadVignetteBuilder(pkgdir, TRUE) : 
  vignette builder 'knitr' not found
Execution halted
Error: Failed to install 'rolog' from GitHub:
  Failed to `R CMD build` package, try `build = FALSE`.

real and Rserve_client do the connection the other way round, that is, they call R from prolog.

Rolog evaluates Prolog queries from R. There is a possibility to “ring back”, i.e. a predicate r_eval/2 that can be used for R → swipl → R, and the vignette shows a use case for this (but the main direction is from R to swipl).

So if your main program is written in R, and you need prolog support, rolog is interesting for you. If your main program is written in Prolog, and you need R support, use real or rserve_client.

1 Like

Thank you for the error report.

Please install the R package knitr (a and maybe also rmarkdown, DiagrammeR and DiagrammeRsvg) and try again.

I downloaded the packages you suggested, but now i get:

STDERR:
Error in loadVignetteBuilder(pkgdir, TRUE) : 
  vignette builder 'knitr' not found
Execution halted
Error: Failed to install 'rolog' from GitHub:
  Failed to `R CMD build` package, try `build = FALSE`.
Error: package or namespace load failed for ‘knitr’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘xfun’
starting httpd help server ... done

There seems to be a problem with knitr. I downloaded this package, but i not that in package manager in R i can’t select it to be loaded (it just says “not loaded”).

If you set build_vignettes=FALSE, knitr is not invoked. Then you won’t have the vignette with the nice usage examples, of course. But the vignette is a Rmd = markdown file, so it is also readable.

1 Like