isknown

The isknown keyword tests whether a class attribute has an initialized value.

Purpose

This keyword is used in the condition part or in the action part of a rule or in a function to test whether the attribute has a value.

Context

Any expression

Syntax

[?var:] className (?attribute isknown);

Description

In the case of XML binding, an attribute has no value in the following cases:

  • When the value is not given in the XML file, or

  • When the value is given in the XML file and set to xsi:nil.

In the case of Java™ classes, the test always returns true because a Java attribute of a Java class is always considered initialized.

Example

rule TestknownValue {
   when {
      ?u: User(address isknown);
   } 
   then {
      sendToAddress(?u.address);
   }
};