ifnot

Purpose

The ifnot() function performs a logical test on the condition and calls the first argument if the condition evaluates to true and the second argument if the condition evaluates to false.

Syntax

ifnot(condition, false_value)

Arguments

Requires 2 arguments. The arguments' order is important:

  1. The first argument condition is the condition to be evaluated.

  2. The second argument false_value is the value to return if the condition in the first argument evaluates to false.

Arguments do not have to be values. They may be pdl-functions.

Returned Value

Either the value of the first or second argument of the corresponding data type.

Examples

The following rule checks whether the argument $m has synonyms (for the rule to work properly it is necessary to have a synonym dictionary switched on).

If the argument has a synonym or synonyms, those synonyms will be listed in the attribute.

If the argument has no synonyms, the value "no synonyms" will appear.

Dataset

XPDL-rule

Result

meerkat

rule: r1

{

query: {lemma(noun)}:m

result: Match = $m

attribute: Adjective = ifnot(tosynonym($m), "no synonyms")

}

suricate

duck

no synonyms