To view or edit a constraint's properties, double-click its Browser or list entry. The property sheet tabs and fields listed here are those available by default, before any customization of the interface by you or an administrator.
The General tab contains the following properties:
Property |
Description |
---|---|
Name/Code/Comment |
Identify the object. The name should clearly convey the object's purpose to non-technical users, while the code, which is used for generating code or scripts, may be abbreviated, and should not normally include spaces. Neither the name nor code should contain colons. You can optionally add a comment to provide more detailed information about the object. By default the code is generated from the name by applying the naming conventions specified in the model options. To decouple name-code synchronization, click to release the = button to the right of the Code field. |
Stereotype |
Extends the semantics of the object. You can enter a stereotype directly in this field, or add stereotypes to the list by specifying them in an extension file. |
ID |
Specifies the ID of the object, which must be unique within the model. |
Reference |
[keyrefs] Specifies the key or unique constraint being referenced. Select a constraint defined in the current model (or another model with a specified namespace). |
Selector (XPath) |
Enter an XPath expression that selects a set of elements across which the values specified in the Fields tab must be unique. There can only be one selector. |
Keywords |
Provide a way of loosely grouping objects through tagging. To enter multiple keywords, separate them with commas. |
The Fields tab lists XPath expressions used to define the constraint. If more than one field is listed, the combination of fields must be unique.
The XPath expressions permitted to define constraint selectors and fields are limited to a subset of the full XPath language defined in the W3C Recommendation XML Path Language 1.0:
Syntax |
Description |
---|---|
/ |
Root node of the XML document. It is the root element with its ramifications |
. |
Selects the context node. It is the current element (on which an identity constraint is defined) with its ramifications |
.. |
Selects the context node parent |
* |
Selects all the child elements of the context node |
employee |
Selects all the employee child elements of the context node |
s:employee |
Selects all the employee child elements of the context node, defined in the namespace with the "s" prefix |
@numEmployee |
Selects the numEmployee attribute of the context node |
@* |
Selects all the attributes of the context node |
../@numEmployee |
Selects the numEmployee attribute of the context node parent |
employee[1] |
Selects the first employee child element of the context node |
employee[last()] |
Selects the last employee child element of the context node |
*/employee |
Selects all the employee grandchildren of the context node |
//employee |
Selects all the employee descendants of the root node |
.//employee |
Selects the employee descendants of the context node |
company//employee |
Selects the employee descendants of the company child elements of the context node |
//company/employee |
Selects all the employee elements with company as parent element in the context node |
/book/chapter[2]/section[3] |
Selects the third section in the second chapter of the book |
employee[@dept="doc"] |
Selects all the employee child elements of the context node with a dept attribute set to doc |
employee[@dept="doc"][3] |
Selects the third employee child element of the context node with a dept attribute set to doc |
employee[3][@dept="doc"] |
Selects the third employee child element of the context node only if it has a dept attribute set to doc |
chapter[title] |
Selects the chapter child elements of the context node with at least one title child element |
chapter[title="About this book"] |
Selects the chapter child elements of the context node with at least one title child element with a text content set to About this book |
employee[@numEmployee and @dept] |
Selects all the employee child elements of the context node with the numEmployee and dept attributes |
text() |
Selects all the child nodes of the text context node |
The General tab of a selector or field property sheet contains the following properties:
Property |
Description |
---|---|
XPath |
For a selector: An XPath expression relative to the parent element being declared. It identifies the child elements to which the identity applies For a field: An XPath expression relative to each element selected by the selector of the constraint. It identifies a single element (with a simple type) whose content or value is used for the constraint |
Stereotype |
Extends the semantics of the object. You can enter a stereotype directly in this field, or add stereotypes to the list by specifying them in an extension file. |
ID |
Specifies the ID of the object, which must be unique within the model. |