Home > Data Model Assistant
Define Simple Constraints
In this section, we will see how to enrich the model with simple constraints natively supported by XML Schema.
See the simple constraints supported by EBX.Platform for more informations.
For this section and the following chapters, we use the example of a publications model.
The publications model consists of four tables:

Here is a brief description of each table:
-
The Publishers table contains the identification numbers, names, cities, and states of publishing companies.
-
The Authors table contains an identification number, first and last name, address information, and contract status for each author.
-
The Titles table contains the book ID, name, type, publisher ID, price, advance, royalty, year-to-date sales, comments, and publication date for each book.
-
The Royalties table lists the unit sales ranges and the royalty connected with each range. The royalty is some percentage of the total sales.
We will add to the publishers table the following attributes and constraints:
-
pub_id , mandatory 4-character string element and following a specific pattern,
-
name , mandatory 40-character string element,
-
city , optional 20-character string element.
-
country , optional 20-character string element.
Let’s start with the pub_id attribute. In the data structure tree, select the pub_id attribute, then the Simple Constraints section:

To specify that the
pub_id attribute is mandatory, the value of its
minOccurs property has to be set to 1 or higher. The
mandatory property can also be specified while creating the attribute. On the opposite, an attribute is declared optional if its
minOccurs property is not set, or if it is set to 0.
At this step, we specify that the pub_id attribute has to contain at most 4 characters and must follow a specific pattern:

Note: Depending on the type of the element, some other constraints may be available, e.g. it is possible to define restrictions on integers such as the minimum or the maximum allowed value.
Home > Data Model Assistant