rulesSessionDrl: Creates a session of the rules engine

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/Rdrools.R

Description

The rulesSession creates a session that interfaces between R and the Drools engine. The session is utilized by the runRulesDrl function for executing a data frame against a set of rules

Usage

1
rulesSessionDrl(rules, input.columns, output.columns)

Arguments

rules

a character vector consisting of lines read from a rules file of format .drl (Drools rules file). This character vector is eventually collapsed into a character vector of length 1, so the way you read the file could potentially be just about anything

input.columns

a character vector of a set of input column, for example. input.columns<-c('name', 'class', 'grade', 'email')

output.columns

a character vector of a set of expected output columns, for example. output.columns<-c('address', 'subject', 'body')

Details

An active drools rules session. This promotes re-usability of a session, i.e. you can utilize the same session repetitively for different data sets of the same format.

Value

rules.session.object Returns a session to the rules engine

Note

Please have a look at the examples provided in the 'examples' section of the Rdrools. A sample data set and a set of rules have been supplied help you understand the package usage.

Author(s)

Ashwin Raaghav <ashwin.raaghav@mu-sigma.com>

SMS Chauhan <sms.chauhan@mu-sigma.com>

See Also

runRulesDrl, Rdrools

Other Interface Functions to Drools: executeRulesOnDataset, runRulesDrl

Examples

1
2
3
4
5
6
7
library(Rdrools)
data(class)
data(rules)
input.columns<-c('name', 'class', 'grade', 'email')
output.columns<-c('address', 'subject', 'body')
rulesSession<-rulesSessionDrl(rules, input.columns, output.columns)
output.df<-runRulesDrl(rulesSession, class)

Example output

Loading required package: rJava
Loading required package: Rdroolsjars
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Rdrools documentation built on May 2, 2019, 8:23 a.m.