ECL Query Procedure
The eclQuery lists the conceptId and preferred term for each concept that conforms to a specified SNOMED CT expression constraint.
Notes
- The expression constraints supported do not cover the full ECL specification but are restricted as described below.
- This procedure will only run in MySQL version 8.0 or later. It uses some function which are not available in earlier versions (including the widely used MySQL version 5.7).
SQL Call to Procedure | ||||
call snap_eclQuery(p_ecl); | ||||
Parameter | Description | Data type | Examples | |
p_ecl | The ECL query text | text | (< 19829001 |disorder of lung|) OR (< 301867009 |edema of trunk|) '(< 19829001 |disorder of lung|) MINUS (< 301867009 |edema of trunk|)' '>> 40541001 |Acute pulmonary edema|' '>39057004 |pulmonary valve|' '>!39057004 |pulmonary valve|' | |
Example Procedure Call | ||||
call snap_eclQuery('< 19829001 |disorder of lung|:116676008 |Associated morphology| = 40829002 |Acute edema|'); | ||||
Result | ||||
conceptId | term | |||
10519008 | Acute pulmonary oedema due to fumes AND/OR vapours | |||
40541001 | Acute pulmonary oedema | |||
61233003 | Silo-fillers' disease | |||
233706004 | Drug-induced acute pulmonary oedema | |||
233709006 | Toxic pulmonary oedema | |||
233710001 | Chemical-induced pulmonary oedema | |||
233711002 | Oxygen-induced pulmonary oedema | |||
360371003 | Acute cardiac pulmonary oedema | |||
10674871000119105 | Pulmonary oedema caused by chemical fumes |
Expression Constraint Feature Support and Limitations
The following notes provide a brief summary of the extent to which this procedure supports evaluation of expression constraints. For a full and detailed understanding of SNOMED CT expression constraints see the specification of the SNOMED CT Expression Constraint Language.
ECL Operators and Examples
ECL Operator | Summary | Example | |
Symbol | Name | ||
< | Descendant of | The set of all subtypes of the given concept | < 404684003 |Clinical finding| |
<< | Descendant or self of | The set of all subtypes of the given concept plus the concept itself | << 73211009 |Diabetes mellitus| |
> | Ancestor of | The set of all supertypes of the given concept | > 40541001 |Acute pulmonary edema| |
>> | Ancestor or self of | The set of all supertypes of the given concept plus the concept itself | >> 40541001 |Acute pulmonary edema| |
<! | Child of | The set of all children of the given concept | <! 195967001 |Asthma| |
>! | Parent of | The set of all parents of the given concept | >! 195967001 |Asthma| |
^ | Member of | The set of referenced components in the given reference set | ^ 733990004 |Nursing activities reference set| |
* | Any | Any concept in the given SNOMED CT edition | * |
: | Refinement | Only those concepts whose defining relationships match the given attribute value pairs | < 404684003 |clinical finding|: 116676008 |associated morphology| = * |
AND | Conjunction | Only those concepts in both sets | (< 19829001 |disorder of lung|) AND (< 301867009 |edema of trunk|) |
OR | Disjunction | Any concept that belongs to either set | (< 19829001 |disorder of lung|) OR (< 301867009 |edema of trunk|) |
MINUS | Exclusion | Concepts in the first set that do not belong to the second set | (< 19829001 |disorder of lung|) MINUS (< 301867009 |edema of trunk|) |
Additional Notes on Limitations of the ECL Query Procedure
The following notes outline the extent to which this procedure supports the SNOMED CT expression constraints and highlights some of the most significant limitations of this procedure.
One or more constraints can be specified.
Each constraint must start with a focus concept constraint expressed as one of the following:
A single conceptId specifying that concept as the focus concept.
A single conceptId preceded by < (specifying subtypes only) or << (specifying self or subtypes)
A conceptId that identifies a reference set preceded by a ^ indicating members of that reference set.
An asterisk * (indicating any concept)
In all cases a concept Id may be followed by a term surrounded by pipe characters.
The term between pipes will be ignored for processing.
Spaces between any elements in the expression will be ignored
The focus constraint may optionally be followed by a refinement constraint separated from the focus constraint by a colon :
If present the refinement constraint must consist of one or more attribute-value-constraint pairs.
- The pair consists of an attribute-constraint and a value-constraint:
- The attribute-constraint must be separated from the value constraint by an = (equals) sign
- Both the constraints may be specified using any of the forms permitted for the focus concept constraint (see 1)
- Attribute attribute-value-constraint pairs must be separated by a comma from any following attribute-value-constraint pair
- NOTE: The procedure does not support:
- Nested refinement constraints
- Role grouping constraints
- Cardinality constraints
If more than one constraint is specified:
- Each constraint must be enclosed in brackets
- One of the following logical operators must be present between adjacent constraints
- OR The resulting set is the set of concepts that conform to either the constraint to the left or the constraint to the right (or both constraint).
- AND The resulting set is the set of concepts that conform to both the constraint to the left and the constraint on the right.
- MINUS The resulting set is the set of concepts that both conform to the constraint to the left and do not conform to the constraint on the right.
- NOTE: The procedure does not support the use of brackets to alter the order of evaluation of constraints in a set.
The set of constraints is evaluated from left to right and, as illustrated below, this is likely to affect the results.- (A) OR (B) AND (C) MINUS (D)
- Concepts in either (A) or (B) form temporary set (aT1)
- Concepts in (aT1) and also in (C) form temporary set (aT2)
- Concepts in (aT2) that are NOT in (D) form the final result set (aR)
- One outcome of this order is that concepts in (B) that are not in (C) or are in (D) will not appear in the result set.
- (A) MINUS (D) AND (C) OR (B)
- Concepts in (A) and NOT in (D) form temporary set (bT1)
- Concepts in (bT1) and also in (C) form temporary set (bT2)
- Concepts in either (bT2) or (B) for the final result set (bR)
- In this order all concepts that are in (B) with me in the result set.
- (A) OR (B) AND (C) MINUS (D)
Summary of Limitations of ECL Support for this Procedure
The Procedure does not support:
- Nested constraints
- Dotted attributes
- Nested refinement constraints
- Attribute group constraints
- Cardinality constraints
The Procedure also requires that:
- Even simple expression constraints must be enclosed by brackets when multiple constraints are combined.
Feedback