Primary Key and Foreign Key in XSD
You can define a uniqueness constraint (primary key) and map this constraint with one or several foreign keys. In this way, elements containing this foreign key cannot exist unless their key takes its value from among those proposed by the primary key.
The primary key is modeled by a constraint of "XSD Key Reference" stereotype. The foreign key is modeled by a constraint of "XSD Key Reference" stereotype. To characterize the fact that a foreign key depends on a primary key, this foreign key is linked to the primary key.
Example:
In the "Enterprise" schema, the "Employee" element defines a "REFPerson" secondary key. This key references the "IDPerson" primary key.
Uniqueness of the secondary key defines a uniqueness constraint on an element. Attributes of this element must have same values as the attributes of elements carrying the primary key.
To connect a secondary key to an element:
1. Select the element in the schema editor navigator.
2. In its properties dialog box, select the XSD Keys tab.
3. Select "Constraint".
4. To connect an existing constraint, click the Connect button and find the constraint.
To create a constraint, click the Create button and assign the "XSD Key Reference" stereotype to the constraint.
5. Then open the properties dialog box of the constraint.
6. Select the Text tab.
7. Select "XSD Constraint" and add a uniqueness text.
8. Click OK.
Then indicate to which primary key the secondary key is connected.

Under the name of the secondary key, select Referenced Constraint".

Click the
Button and find the primery key to be referenced.