# Query Expressions

When postcoordinated expressions are used to represent clinical information, this data needs to be queried and analyzed in the same way as data recorded using precoordinated concepts.

Systems supporting postcoordination should thus ensure that analytics features are enabled to take advantage of SNOMED CT's hierarchy and explicit representation of defining properties. Furthermore, this facility should allow queries to be generated that combine SNOMED CT-specific selection criteria with other health record criteria.

Key analytics features that should be supported include:

* **Subsumption** which involves the determination of whether one concept (or expression) is a kind of another concept (or expression) is the fundamental capability enabled by SNOMED CT. For example, answering the question 'Which patients have an infectious disease?' involves finding all the patients with *any kind of* infectious disease (e.g. viral pneumonia, tuberculosis).
* **Selective retrieval** which involves using the properties (relationships) derived from classification to retrieve concepts (or expressions) matching specified criteria.

## Subsumption

Subsumption testing between expressions tests to see if the *candidate expression* (often recorded in a patient record) is subsumed by a *predicate expression* (typically part of the query being run across the patient record). To enable subsumption testing it is necessary to ensure that the expression is processed in the same way as the precoordinated content. This requires the expression to be positioned in the right coordinates of the SNOMED CT hierarchy (aka coordinated), as illustrated in the diagram below.

#### Consider the expression:

```
372244006 |Malignant melanoma| :
{ 363698007 |Finding site| =
( 16982005 |Shoulder region structure| : 272741003 |Laterality| = 24028007 |Right| ) }
```

Subsumption testing may be performed to test if this expression is a subtype of the concept [300848003 |Mass of body structure (finding)|](http://snomed.info/id/300848003) . This test could be required to identify a cohort of patients who have been diagnosed with some kind of lump in a body structure.

However, to enable systems to perform this test, the expression first needs to be classified with the precoordinated content to generate an inferred subtype hierarchy including both the postcoordinated expression and the query concept. If a classification is not performed, the software will not be able to automatically derive where the expression belongs in the SNOMED CT hierarchy relative to the query concept.

As illustrated in the image below, the candidate expression *is* subsumed by the predicate expression.

<figure><img src="/files/VmEKWdhqOVEzWhJQUZTI" alt=""><figcaption><p>Subsumption testing of expressions requires the expressions to be processed as if they were part of the released (precoordinated) SNOMED CT content.</p></figcaption></figure>

## Selective Retrieval

Systems supporting postcoordination should provide a mechanism to allow users to specify retrieval requirements based on the inferred properties of an expression. Attribute relationships in conjunction with the subtype hierarchies provide an efficient mechanism for specifying query criteria, e.g. a query for *"all diseases with a*[ *| Finding site|*](http://snomed.info/id/363698007) *of* [*| Shoulder region structure|*](http://snomed.info/id/16982005) *and an* [*| Associated morphology|*](http://snomed.info/id/116676008) *of* [*| Edema|*](http://snomed.info/id/79654002) *"*. As illustrated in the diagram below, the inferred properties can be used to identify the concepts and expressions matching these query criteria. However, as for subsumption testing, this kind of query feature demands for the expressions to be classified with the precoordinated concepts in order for the expressions to infer all necessary properties correctly.

<figure><img src="/files/SYhCQDXQ7z6zHKP8J3ml" alt=""><figcaption><p>Illustration of the principles of how the inferred properties of concepts and expressions can be utilized to specify query criteria selectively.</p></figcaption></figure>

## **Terminology services for Querying Expressions**

Enabling queries over expressions to be performed requires the availability of the following terminology services:

* **Query Expression** - Including both services to perform subsumption testing and selective retrieval of expressions

{% hint style="info" %}
More information about the Terminology Services requirements please see: [Terminology Services Requirements](/snomed-ct-practical-guides/snomed-ct-postcoordination-guide/expressions-in-a-terminology-server/requirements/terminology-services-requirements.md)
{% endhint %}

<a href="https://docs.google.com/forms/d/e/1FAIpQLScTmbZIf0UEQwYDkY27EEWBkaiYkHSbR0_9DmFrMLXoQLyL7Q/viewform?usp=pp_url&#x26;entry.1767247133=Postcoordination+Guide&#x26;entry.670899847=Query%20Expressions" class="button primary">Provide Feedback</a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snomed.org/snomed-ct-practical-guides/snomed-ct-postcoordination-guide/expressions-in-the-ehr/4.5-query-expressions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
