ILOG JRules User Guide > Integrating Application Data > Reference > Mapping Between XML Schema and Dynamic Classes > Schema Types > Complex Type Restriction

In the following example, the complex type book represents a standard book and the complex type old-book is a restriction because a lexical pattern constraint (pattern value ="[0-9]{2}-[A-Z]{5}-[0-9]") has been added. The example includes a rule named processOldBook that matches "Hamlet" with the title of an OldBook object.

Note
The OldBook dynamic class does not redefine nor restrict the Book class attributes, even if the ident field is more restricted.

Here is the schema:

<complexType name= "book">
 <sequence>
   <element name="ident" type="string"/>
   <element name="title" type="string" />
 </sequence>
</complexType>
<complexType name="old-book">
 <complexContent>
  <restriction base="book">
    <sequence>
     <element name="ident">
      <simpleType>
        <restriction base="string">
          <pattern value="[0-9]{2}-[A-Z]{5}-[0-9]">
        </restriction>
      </simpleType>
     </element>
    </sequence>
  </restriction>
 </complexContent>
</complexType>

Here is the XOM representation:

class Book extends IlrXmlObject
{
   ...
     String ident;
     String title;
   ...
}
class OldBook extends Book
{
   ...
}

And here is the rule:

rule processOldBook
{
   when {
        OldBook ( title equals "Hamlet" );
   }
   then {
      ...
   }
}

In this Section

Built-in Simple Types
Simple Type Mapping
Simple Types Derived from Other Simple Types
List and Union Types
Local Simple Types Mapped onto Inner Classes
Complex Types
Complex Type Extension
Local Complex Types Mapped to Inner Classes
Default Constructor Dynamic Methods
Type Identifier Mapping