RuleSet
type (joe
)
A Nero rule set, as created by the ruleset
expression. A
rule set contains Nero rules and optionally some number of
base facts. A rule set can infer new facts given its rules,
base facts, and any input facts provided by the script.
- ruleSet.infer([inputs]) → Set
- ruleSet.isDebug() → Boolean
- ruleSet.isStratified() → Boolean
- ruleSet.setDebug(flag)
- ruleSet.toString() → String
Methods
ruleSet.infer()
ruleSet.infer([inputs]) → Set
Executes the Nero rule set given the inputs, and returns a
Set
of the inferred facts. If the rule set contains
export
directives, the relevant facts will be returned as
exported domain values; otherwise they will be Fact
values.
The inputs values are converted to Nero Fact
values;
infer
throws an error if given any input that cannot be converted
to a Fact
.
NOTE: By default, a rule set cannot infer facts of the same
types as the given inputs: infer(inputs)
throws an error
if any input fact's type name is the same as a relation used in
one of the rule set's rule heads or axioms.
ruleSet.isDebug()
ruleSet.isDebug() → Boolean
Returns the rule set's debug flag.
ruleSet.isStratified()
ruleSet.isStratified() → Boolean
Returns whether the rule set is stratified or not.
ruleSet.setDebug()
ruleSet.setDebug(flag)
Sets the rule set's debug flag. If enabled,
infer()
will output a detailed execution trace.
ruleSet.toString()
ruleSet.toString() → String
Returns the value's string representation.