This section provides a quick reference to the key syntax features of the Expression Constraint Language.
Syntax Overview
The following table summarises the key symbols used in the Expression Constraint Language's brief syntax.
Symbol | Name | Notes |
---|---|---|
| | Pipe | Used on either side of a concept's term for human readability |
* | Any | Retrieves all concepts in the substrate |
^ | Member of | Retrieves all (active) members of a reference set identified by a specified reference set concept |
< | Descendant of | Retrieves all descendants (subtypes) of the specified concept excluding the concept itself |
<< | Descendant or self of | Retrieves all descendants (subtypes) of the specified concept including the concept itself |
<! | Child of | Retrieves all children (immediate subtypes) of the specified concept excluding the concept itself |
<<! | Child or self of | Retrieves all children (immediate subtypes) of the specified concept including the concept itself |
> | Ancestor of | Retrieves all ancestors (supertypes) of the specified concept excluding the concept itself |
>> | Ancestor or self of | Retrieves all ancestors (supertypes) of the specified concept including the concept itself |
>! | Parent of | Retrieves all parents (immediate supertypes) of the specified concept excluding the concept itself |
>>! | Parent or self of | Retrieves all parents (immediate supertypes) of the specified concept including the concept itself |
AND | Conjunction | Retrieves the intersection of the results of each sub-expressions |
OR | Disjunction | Retrieves the union of the results of each sub-expressions |
MINUS | Exclusion | Retrieves the members of the first expression and excludes the members returned by the second expression |
: | Refinement | Used before one or more attribute-value pairs to refine the set of concepts retrieved |
[1..3] | Cardinality | Used to indicate the minimum and maximum number of occurrences of attributes or relationship groups |
R | Reverse flag | Retrieves the set of attribute values (i.e. destination concepts) of a specified attribute for a specified set of concepts |
. | Dot notation | Retrieves the set of attribute values (i.e. destination concepts) of a specified attribute for a specified set of concepts |
Examples
The following table provides some examples of each of the key syntax features of the Expression Constraint Language.
Notes:
- In the table above:
- 'id' represents a single SNOMED CT concept identifier,
- 'term' represents a term associated with the concept identified by 'id',
- 'x', 'y' and 'v' each represent either a single concept or a set of concepts defined using an expression constraint,
- 'z' represents either a single concept or a set of concepts that are a subtype of 900000000000455006 | Reference set| ,
- 'a' and 'b' each represent either a single concept or a set of concepts that are a subtype of 410662002 | Concept model attribute| , and
- 'min' and 'max' are two numeric values that represent the minimum and maximum cardinality allowed.
- The default substrate, to which expression constraints are applied, includes all concepts, active relationships, active descriptions and active reference set members of a chosen SNOMED CT versioned edition.
Simple expression constraints | |||
Syntax | Evaluation Notes | Example | Example Expansion Concepts |
---|---|---|---|
id | term | | Only the concept with the identifier 'id' | ||
* | All concepts in the given substrate | * | Any concept in the given substrate |
^ z | The set of concepts which are members of the reference sets in z | ||
< x | The set of all descendants (both direct and indirect) of x | < 73211009 |Diabetes mellitus| < 73211009 |Diabetes mellitus)| | |
<< x | The set of all descendants (both direct and indirect) of x, plus x itself | ||
<! x | The set of all immediate children of x | ||
<<! x | The set of all immediate children of x, plus x itself | ||
> x | The set of all ancestors (both direct and indirect) of x | ||
>> x | The set of all ancestors (both direct and indirect) of x, plus x itself | ||
>! x | The set of all immediate parents of x | ||
>>! x | The set of all immediate parents of x, plus x itself | ||
Conjunction, Disjunction and Exclusion | |||
Syntax | Evaluation Notes | Example | Example Expansion Concepts |
x AND y | The set of concepts that are both in x and in y (i.e. the intersection of x and y) | ||
x OR y | The set of concepts that are either in x or in y (i.e. the union of x and y) | ||
x MINUS y | The set of concepts that are in x but are not in y (i.e. x excluding concepts in y) | ||
Refinement | |||
Syntax | Evaluation Notes | Example | Example Expansion Concepts |
x : a = y | The set of concepts in x, which have a necessary relationship with an attribute in a and a value in y | ||
x : a = y, b = v | The set of concepts in x, which have both a necessary relationship with an attribute in a and a value in y, and also have a necessary relationship (either the same one or a different one) with an attribute in b and a value in v | ||
x : { a = y, b = v } | The set of concepts in x, which have a role group that contains both a necessary relationship with an attribute in a and a value in y, and also have a necessary relationship (either the same one or a different one) with an attribute in b and a value in v | ||
Cardinality | |||
Syntax | Evaluation Notes | Example | Example Expansion Concepts |
x : [min .. max] a = y | The set of concepts in x, which have between min and max necessary relationships with an attribute in a and a value in y | ||
x : [min .. max] { a = y } | The set of concepts in x, which have between min and max role groups that contain a necessary relationship with an attribute in a and a value in y |
| |
Reversed Attributes | |||
Syntax | Evaluation Notes | Example | Example Expansion Concepts |
y : R a = x | The set of concepts in y, which are the destination (ie attribute value) of a necessary relationship on a source concept in x with an attribute in a |
395939008 |Clavulanic acid (substance)| | |
x . a | The set of attribute values (ie destination concepts) of all necessary relationships on a source concept in x with an attribute in a |
Feedback