new Rule(arity)
- Description:
Implements an abstract rule based mechanism, based on belief calculation.
- A rule is implemented by overloading the
getTau()
andgetOutput()
functions. - A rule is validated by the the
isValid()
function. - A rule is used through the
Rules
mechanism, which provides examples of construction - via a macro or
- as a derived class.
- A rule is implemented by overloading the
Parameters:
Name | Type | Description |
---|---|---|
arity |
uint | The rule arity, actually, the implementation considers rules of arity 1, 2 or 3. |
Methods
getName()
- Description:
Returns the rule name.
getArity()
- Description:
Returns the rule arity.
getTau(subject_1, predicate_1, object_1, subject_2opt, predicate_2opt, object_2opt, subject_3opt, predicate_3opt, object_3opt) → {Belief}
- Description:
Returns the tau value given triples.
- This method is
- to be overloaded to implement the rule, depending on the arity;
- not expected to be called directly, but though the apply function.
- This method is usually built using the algo::sim() and algo::conj() functions.
- This method is
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
subject_1 |
Symbol | The 1st triple subject. |
|
predicate_1 |
Symbol | The 1st triple predicate. |
|
object_1 |
Symbol | The 1st triple object. |
|
subject_2 |
Symbol |
<optional> |
The 2nd triple subject. |
predicate_2 |
Symbol |
<optional> |
The 2nd triple predicate. |
object_2 |
Symbol |
<optional> |
The 2nd triple object. |
subject_3 |
Symbol |
<optional> |
The 3rd triple subject. |
predicate_3 |
Symbol |
<optional> |
The 3rd triple predicate. |
object_3 |
Symbol |
<optional> |
The 3rd triple object. |
Returns:
The rule evaluation of the belief.
- Type
- Belief
isValid(belief)
- Description:
Returns true if the level of belief is valid for this rule.
- This method is to be overloaded to implement a specific validity criterion.
- The default implementation returns
belief.tau > 2 * belief.sigma
.
Parameters:
Name | Type | Description |
---|---|---|
belief |
Belief | A |
setOutput(output)
- Description:
Returns the output the rule given the input triples.
- This method is
- to be overloaded to implement the rule;
- not expected to be called directly, but though the apply function.
- In order to calculate the output triples, this method access to the protected:
tau
belief value, previously calculated;- the protected pointers to input values
*subject_i
,*predicate_i
,*object_i
, previously set. A typical implementation writes:
virtual void(RelationalMap& output) { output.add(subject_0, predicate_0, object_0); // where these arguments correspond to an output value }
- This method is
Parameters:
Name | Type | Description |
---|---|---|
output |
RelationalMap | A |