A null constant value.
Setting a value to null may be useful to indicate that no value applies.
<?xml version="1.0" encoding="UTF-8"?>
<RuleSet name="Example_null"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.curamsoftware.com/CreoleRulesSchema.xsd">
<Class name="Pet">
<Initialization>
<Attribute name="name">
<type>
<javaclass name="String"/>
</type>
</Attribute>
</Initialization>
</Class>
<Class name="Person">
<!-- This Person's favorite Pet, or
null if the Person owns no pet. -->
<Attribute name="favoritePet">
<type>
<ruleclass name="Pet"/>
</type>
<derivation>
<specified/>
</derivation>
</Attribute>
<!-- The name of this Person's
favorite Pet, or null if
the Person owns no pet.
We have to test for the favoritePet
being null before performing the
(simple) calculation.-->
<Attribute name="favoritePetsName">
<type>
<javaclass name="String"/>
</type>
<derivation>
<choose>
<type>
<javaclass name="String"/>
</type>
<when>
<!-- if this Person has no
favorite pet, then calculate the
name of the favorite pet as null. -->
<condition>
<equals>
<reference attribute="favoritePet"/>
<null/>
</equals>
</condition>
<value>
<null/>
</value>
</when>
<otherwise>
<value>
<!-- get the name of the favorite pet -->
<reference attribute="name">
<reference attribute="favoritePet"/>
</reference>
</value>
</otherwise>
</choose>
</derivation>
</Attribute>
</Class>
</RuleSet>