Expression constraints can be nested in a variety of ways to form nested expression constraints. These nested expression constraints use subexpressions, enclosed in round brackets, in the place of a simple concept reference.
Nested expression constraints can be created by:
- Applying constraint operators to an expression constraint
- Applying the memberOf function to an expression constraint
- Combining expression constraints using binary operators
- Adding dotted attributes to expression constraints
- Adding refinements to expression constraints
- Using expression constraints to represent valid attribute names
- Using expression constraints to represent valid attribute values
In this section, we describe each of these approaches to creating nested expression constraints.
When a constraint operator is applied to an expression constraint, the resulting set of matching expressions is the union of applying the constraint operator to each of its members.
For example, the following expression constraint represents all the members of the |Example problem list concepts reference set| plus the union of the descendants of each of these members.Please note that the brackets in the above expression constraint are optional. In this particular case, removing the brackets does not change the meaning of the constraint. |Finding site| of |Fracture of bone| is 272673000 |Bone structure|, the above expression constraint is equivalent to: Please note that this is not the same as the expression constraint: which refers to the set of |Finding site| values for any descendant of |Fracture of bone|, and is instead equivalent to: See the subsection below on Dotted Attributes for more information about expression constraints of this form.
The memberOf function may also be applied to an expression constraint that returns a set of concept-based reference set concepts. When this is done, the nested expression constraint (to which the memberOf function is applied) must always be enclosed in round brackets.
For example, the expression constraint below is satisfied by the set of concepts which are members of any subtype of |GP/FP health issue reference set|. In other words, it represents the union of applying the memberOf function to each of the descendants of |GP/FP health issue reference set|.The expression constraint above evaluates to the same set of concepts as applying the memberOf function to each individual subtype of 450973005 |GP/FP health issue reference set| and then taking the union of these sets. Therefore, when applied to the 20170131 international edition of SNOMED CT, the above expression constraint evaluates to the same set of concepts as the following expression constraint.
Compound Expression Constraints
When conjunction (i.e. AND), disjunction (i.e. OR) or exclusion (i.e. MINUS) are applied to one or more complex subexpression constraints, brackets are usually required to nest the subexpression constraints.
For example, the following expression constraint uses brackets around the first complex operand ( < 404684003 |Clinical finding| : 363698007 |Finding site| = << 39057004 |Pulmonary valve structure| ) to apply the 'AND' operator to two expression constraints.An equivalent expression constraint can be achieved by swapping the order of the operands, as shown below. Similarly, if both sides of the compound expression are complex expression constraints, then brackets may be required on both sides. For example:
Dotted attributes can also be applied to a nested subexpression constraint. When this is done, the resulting subexpression represents the union of the values of the given dotted attribute for any expression that matches the given nested subexpression constraint.
For example, the following expression constraint represents the set of all substances that are the |Direct substance| of a |Specimen collection| procedure that is |Using device| equal to a subtype (or self) of |Catheter|.When executed against the 20170131 international edition of SNOMED CT, the above expression constraint matches the following three concepts:
As mentioned in 6.2 Refinements, it is possible to apply refinements to nested expression constraints. When a refinement is applied to a complex subexpression constraint, the subexpression constraint must be enclosed in brackets.
For example, the expression constraint below represents the set of all clinical findings and events which occur after some procedure.Attribute Names
In some cases, the valid set of attribute names can be represented using an expression constraint. For example, the expression constraint below represents the set of bone fractures that have no additional defining attributes (besides |Finding site| and |Associated morphology|).Within this expression constraint, the subexpression: represents the set of attributes that must match the given refinement condition (in this case, these attributes must not appear in the concept definition of matching concepts due to the cardinality of [0..0]).
Similarly to the SNOMED CT Compositional Grammar, it is also possible to nest expression constraints within an attribute value. Please note that when the attribute value is a simple expression constraint (as per the above examples), brackets are not required around the value. However, when the attribute value is either an expression constraint with a refinement, or a compound expression constraint with a binary operator, then brackets must be placed around the attribute value. For example, the following expression constraint represents the set of clinical findings which are associated with another clinical finding that has an associated morphology of 'infarct' (or subtype).In this example, brackets are required around the nested attribute value " < 404684003 |Clinical finding| : 116676008 |Associated morphology| = << 55641003 |Infarct| ".