Nested Expression Constraints
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.
Constraint Operators
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.
<< (^ 700043003 |Example problem list concepts reference set| )
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.
As another example, the following expression constraint represents the set of all descendants of the | Finding site| of | Fracture of bone| .
< ( 125605004 |Fracture of bone| . 363698007 |Finding site| )
Because the | Finding site| of | Fracture of bone| is 272673000 | Bone structure| , the above expression constraint is equivalent to:
< 272673000 |Bone structure|
Please note that this is not the same as the expression constraint:
< 125605004 |Fracture of bone| . 363698007 |Finding site|
which refers to the set of | Finding site| values for any descendant of | Fracture of bone| , and is instead equivalent to:
(< 125605004 |Fracture of bone| ). 363698007 |Finding site|
See the subsection on dotted attributes for more information about expression constraints of this form.
MemberOf Function
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| .
^ (< 450973005 |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.
^ 450990004 |Adverse drug reactions reference set for GP/FP health issue|
OR ^ 450989008 |Allergies reference set for GP/FP health issue|
OR ^ 450985002 |Disorders and diseases reference set for GP/FP health issue|
OR ^ 450988000 |Family history reference set for GP/FP health issue|
OR ^ 450991000 |Processes and procedures reference set for GP/FP health issue|
OR ^ 450986001 |Results reference set for GP/FP health issue|
OR ^ 450992007 |Social history reference set for GP/FP health issue|
OR ^ 450984003 |Symptoms and signs reference set for GP/FP health issue|
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.
(< 404684003 |Clinical finding| :
363698007 |Finding site| = << 39057004 |Pulmonary valve structure| )
AND ^ 700043003 |Example problem list concepts reference set|
An equivalent expression constraint can be achieved by swapping the order of the operands, as shown below.
^ 700043003 |Example problem list concepts reference set|
AND (< 404684003 |Clinical finding| :
363698007 |Finding site| = << 39057004 |Pulmonary valve structure| )
Similarly, if both sides of the compound expression are complex expression constraints, then brackets may be required on both sides. For example:
(< 404684003 |Clinical finding| : 363698007 |Finding site| = << 39057004 |Pulmonary valve structure| )
AND (< 64572001 |Disease| : 116676008 |Associated morphology| = << 415582006 |Stenosis| )
Dotted Attributes
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| .
(<< 17636008 |Specimen collection| : 424226004 |Using device| = << 19923001 |Catheter| ) . 363701004 |Direct substance|
When executed against the 20170131 international edition of SNOMED CT, the above expression constraint matches the following three concepts:
Refinement
As mentioned in 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.
(<< 404684003 |Clinical finding (finding)| OR << 272379006 |Event (event)| ):
255234002 |After| = << 71388002 |Procedure (p
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| ).
<< 125605004 |Fracture of bone| :
[0..0] ((<< 410662002 |Concept model attribute| MINUS 363698007 |Finding site| )
MINUS 116676008 |Associated morphology| ) = *
Within this expression constraint, the subexpression:
(<< 410662002 |Concept model attribute| MINUS 363698007 |Finding site| ) MINUS 116676008 |Associated morphology|
-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]).
Attribute Values
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).
< 404684003 |Clinical finding| :
47429007 |Associated with| = (< 404684003 |Clinical finding| :
116676008 |Associated morphology| = << 55641003 |Infarct| )
In this example, brackets are required around the nested attribute value
" < 404684003 |Clinical finding| : 116676008 |Associated morphology| = << 55641003 |Infarct| "
.
Last updated