> For the complete documentation index, see [llms.txt](https://docs.snomed.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snomed.org/implementation-guides/loinc-implementation-guide/technical-application/6.4-using-the-loinc-ontology/6.4.1-querying-the-loinc-ontology.md).

# Querying the LOINC Ontology

The integration of LOINC observable entity concepts into SNOMED CT follows a structured yet distinct approach, wherein LOINC concepts are incorporated as subtypes of |Observable entity| but maintain a flat hierarchical structure.

In the LOINC Ontology browser, the flat structure becomes evident, when searching for the concept |observable entity| and then exploring the large number of direct children of this concept.

While this design ensures comprehensive coverage of LOINC concepts, it inherently limits the effectiveness of simple subsumption-based retrieval, as concepts are not deeply nested within a hierarchical framework. However, this challenge is mitigated by the rich semantic modeling of LOINC concepts within SNOMED CT, which includes well-defined attributes and explicit logical definitions.

To facilitate efficient retrieval of LOINC concepts within SNOMED CT, the Expression Constraint Language (ECL) serves as a robust querying mechanism. ECL enables users to construct precise and attribute-driven queries, leveraging core LOINC attributes such as component, property, system (specimen), time aspect, and method. This capability allows for highly granular and targeted data extraction, supporting advanced clinical decision-making, analytics, and interoperability within healthcare systems.

For a detailed introduction and guidance to the SNOMED CT Expression Constraint Language, please refer to [Expression Constraint Language](https://docs.snomed.org/snomed-ct-specifications/snomed-ct-expression-constraint-language/).

## Simple Expression Constraints <a href="#id-6.4.1queryingtheloincontology-simpleexpressionconstraints" id="id-6.4.1queryingtheloincontology-simpleexpressionconstraints"></a>

The simplest form of an expression constraint consists of a focus concept, optionally preceded by a constraint operator. The focus concept represents a specific SNOMED CT term, while the constraint operator refines the selection. Simple expression constraints enable precise retrieval of concepts based on hierarchical relationships, making them fundamental for querying SNOMED CT data.

Examples

[174771010000107 |Mass concentration of glucose in blood at point in time (observable entity)|](http://snomed.info/id/174771010000107)

***→** Retrieves the exact concept |Mass concentration of glucose in blood at point in time (observable entity)|*

\
<< [174771010000107 |Mass concentration of glucose in blood at point in time (observable entity)|](http://snomed.info/id/174771010000107)

\
\&#xNAN;***→** Retrieves the exact concept |Mass concentration of glucose in blood at point in time (observable entity)| **and** all its descendants*

#### Key Operators for Simple Expression Constraints <a href="#id-6.4.1queryingtheloincontology-keyoperatorsforsimpleexpressionconstraints" id="id-6.4.1queryingtheloincontology-keyoperatorsforsimpleexpressionconstraints"></a>

<table data-full-width="true"><thead><tr><th width="137.8671875">Operator</th><th>Name</th><th>Description</th><th>Example (LOINC Observable Entities in SNOMED CT)</th></tr></thead><tbody><tr><td>Self</td><td>The expression constraint is satisfied only by the specified concept</td><td><em>Retrieves only the specified concept</em></td><td>593081010000107 |Aldosterone and renin activity panel - Plasma (observable entity)|</td></tr><tr><td>*</td><td>Any</td><td><em>Any concept in the substrate</em></td><td>All LOINC Ontology concepts (incl. concepts in dependent modules)</td></tr><tr><td>&#x3C;</td><td>Descendant of</td><td><em>Retrieves all descendants (subtypes) of the specified concept</em></td><td>&#x3C; 540081010000107 |Panel (observable entity)|</td></tr><tr><td>&#x3C;&#x3C;</td><td>Descendant or self of</td><td><em>Retrieves all descendants (subtypes) of the specified concept including the concept itself</em></td><td>&#x3C;&#x3C; 363787002 |Observable entity (observable entity)| → Includes all Observable entities</td></tr><tr><td>&#x3C;!</td><td>Child of</td><td><em>Retrieves all children (immediate subtypes) of the specified concept excluding the concept itself</em></td><td>&#x3C;! 363787002 |Observable entity (observable entity)| → Direct children like "Laboratory test result"</td></tr><tr><td>&#x3C;&#x3C;!</td><td>Child or self of</td><td><em>Retrieves all children (immediate subtypes) of the specified concept including the concept itself</em></td><td>&#x3C;&#x3C;! 363787002 |Observable entity (observable entity)| → "Laboratory test result" and itself</td></tr><tr><td>></td><td>Ancestor of</td><td><em>Retrieves all ancestors (supertypes) of the specified concept excluding the concept itself</em></td><td>> 234567001 (Hemoglobin measurement) → Retrieves "Laboratory test result"</td></tr><tr><td>>></td><td>Ancestor or self of</td><td><em>Retrieves all ancestors (supertypes) of the specified concept including the concept itself</em></td><td>>> 234567001 (Hemoglobin measurement) → Retrieves itself and ancestors</td></tr><tr><td>>!</td><td>Parent of</td><td><em>Retrieves all parents (immediate supertypes) of the specified concept excluding the concept itself</em></td><td>>! 123456001 (Blood glucose level) → Retrieves "Laboratory test result"</td></tr><tr><td>>>!</td><td>Parent or self of</td><td><em>Retrieves all parents (immediate supertypes) of the specified concept including the concept itself</em></td><td>>>! 123456001 (Blood glucose level) → Retrieves itself and immediate parent</td></tr><tr><td>^</td><td>Member of</td><td><em>Retrieves the referencedComponentId of all (active) members of a reference set</em></td><td>^ 735981007 (LOINC Reference Set in SNOMED CT) → Retrieves all members of the LOINC refset</td></tr></tbody></table>

## Expression Constraints with Refinements <a href="#id-6.4.1queryingtheloincontology-expressionconstraintswithrefinements" id="id-6.4.1queryingtheloincontology-expressionconstraintswithrefinements"></a>

Expression constraints with refinements extend simple expression constraints by specifying additional criteria to refine the selection of concepts. A refinement consists of an attribute-value pair, where the attribute represents a defining characteristic, and the value specifies the required condition. This allows for more precise querying of SNOMED CT concepts.

In the LOINC Ontology, expression constraints with refinements allow for more precise retrieval of LOINC terms based on specific attributes, such as Component, Site, or Technique. A refinement consists of an attribute-value pair, where the attribute defines a characteristic, and the value specifies the required condition.

Refinement Example

<< 363787002 : 370130000 = 117363000

\
→ Retrieves all **Observable entity** (363787002) terms where **Property** (370130000) is **Mass concentration** (117363000), such as *Glucose \[Mass/volume] in Blood*.

The following page of the [Expression Constraint Language](https://docs.snomed.org/snomed-ct-specifications/snomed-ct-expression-constraint-language/) Specification and Guide details the different kinds of refinements that are supported by the Expression Constraint Language: [Refinements](/snomed-ct-specifications/snomed-ct-expression-constraint-language/behaviour-specification-with-examples/6.2-refinements.md)

### Refinement Examples <a href="#id-6.4.1queryingtheloincontology-refinementexamples" id="id-6.4.1queryingtheloincontology-refinementexamples"></a>

By applying refinements, users can precisely query **LOINC-based Observable entities** in SNOMED CT, ensuring they meet specific laboratory or clinical criteria.

The table below lists example ECL queries that can be performed to retrieve a set of concepts that matches the criteria delineated in the ECL expression.

<table data-full-width="true"><thead><tr><th>ECL Query</th><th width="252.30206298828125">Text Description of Query</th><th>Example Results</th></tr></thead><tbody><tr><td>&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> : <a href="http://snomed.info/id/246501002">246501002 |Technique (attribute)|</a> = *</td><td><strong>Query for all observable entity concepts which have a</strong> <a href="http://snomed.info/id/246501002">246501002 |Technique (attribute)|</a></td><td>>7000 concepts including: <a href="http://snomed.info/id/154831010000100">154831010000100 |Substance concentration of pro-brain natriuretic peptide in serum or plasma at point in time by immunoassay (observable entity)|</a></td></tr><tr><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> : <a href="http://snomed.info/id/246093002">246093002 |Component (attribute)|</a> = &#x3C;&#x3C; <a href="http://snomed.info/id/68498002">68498002 |Antibody (substance)|</a> AND <a href="http://snomed.info/id/704327008">704327008 |Direct site (attribute)|</a> = &#x3C;&#x3C; <a href="http://snomed.info/id/122592007">122592007 |Acellular blood (serum or plasma) specimen (specimen)|</a></td><td><strong>Query for all observable entity concepts where</strong> <a href="http://snomed.info/id/246093002">246093002</a></td><td>>8400 concepts including:<br><a href="http://snomed.info/id/859931010000102">859931010000102 |Arbitrary concentration of spermatozoa IgM in serum at point in time (observable entity)|</a></td></tr><tr><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> : <a href="http://snomed.info/id/246093002">246093002 |Component (attribute)|</a> = &#x3C;&#x3C; <a href="http://snomed.info/id/68498002">68498002 |Antibody (substance)|</a> AND <a href="http://snomed.info/id/704327008">704327008 |Direct site (attribute)|</a> = <a href="http://snomed.info/id/122592007">122592007 |Acellular blood (serum or plasma) specimen (specimen)|</a></td><td><strong>Query for all observable entity concepts where</strong> <a href="http://snomed.info/id/246093002">246093002</a></td><td>>629 concepts, including:<br><a href="http://snomed.info/id/856191010000105">856191010000105 |Presence of Zika virus IgM in serum or plasma at point in time by immunoassay (observable entity)|</a></td></tr><tr><td>> <a href="http://snomed.info/id/80151010000108">80151010000108 |Mass concentration of monoclonal IgG in serum at point in time (observable entity)|</a></td><td><strong>Query for all ancestors of</strong> <a href="http://snomed.info/id/80151010000108">80151010000108 |Mass concentration of monoclonal IgG in serum at point in time (observable entity)|</a></td><td>3 concepts, including: <a href="http://snomed.info/id/132201010000103">132201010000103 |Mass concentration of immunoglobulin G in serum or plasma at point in time (observable entity)|</a></td></tr><tr><td>>! <a href="http://snomed.info/id/176671010000107">176671010000107 |Arbitrary concentration of Afipia felis IgG in serum at point in time (observable entity)|</a></td><td><strong>Query for parent of</strong> <a href="http://snomed.info/id/176671010000107">176671010000107 |Arbitrary concentration of Afipia felis IgG in serum at point in time (observable entity)|</a></td><td><a href="http://snomed.info/id/253191010000109">253191010000109 |Arbitrary concentration of immunoglobulin G in serum at point in time (observable entity)|</a></td></tr><tr><td>&#x3C; <a href="http://snomed.info/id/96371010000104">96371010000104 |Arbitrary concentration of alphafetoprotein in body fluid at point in time (observable entity)|</a></td><td><strong>Query for all descendants of</strong> <a href="http://snomed.info/id/96371010000104">96371010000104 |Arbitrary concentration of alphafetoprotein in body fluid at point in time (observable entity)|</a></td><td>4 concepts including: <a href="http://snomed.info/id/137271010000105">137271010000105 |Arbitrary concentration of alphafetoprotein in pleural fluid at point in time (observable entity)|</a></td></tr><tr><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> : <a href="http://snomed.info/id/370130000">370130000 |Property (attribute)|</a> = &#x3C;&#x3C;<a href="http://snomed.info/id/705057003">705057003 |Presence (property) (qualifier value)|</a></td><td><strong>Query for all observable entity concepts where the property attribute is</strong>  <a href="http://snomed.info/id/705057003">705057003 |Presence (property) (qualifier value)|</a> (or a subtype)</td><td>~11000 concepts including <a href="http://snomed.info/id/6270001000004106">6270001000004106 |Presence of ulcer in primary malignant melanoma of skin (observable entity)|</a></td></tr><tr><td>&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> {{ C definitionStatus = defined }}</td><td><strong>Query for all sufficiently defined observable entity concepts</strong></td><td>>18000 concepts including: <a href="http://snomed.info/id/219541010000104">219541010000104 |Presence of hepatitis B virus rRNA in specimen at point in time by nucleic acid hybridization probe (observable entity)|</a></td></tr><tr><td>&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> {{ C definitionStatusId = <a href="http://snomed.info/id/900000000000074008">900000000000074008 |Primitive|</a> }} : <a href="http://snomed.info/id/370130000">370130000 |Property (attribute)|</a> = &#x3C;&#x3C; <a href="http://snomed.info/id/705057003">705057003 |Presence (property) (qualifier value)|</a></td><td><strong>Query for all primitive observable entity concepts where the property is</strong> <a href="http://snomed.info/id/705057003">705057003 |Presence (property) (qualifier value)|</a> <strong>(or a subtype thereof)</strong></td><td>>1200 concepts, including:<br> <a href="http://snomed.info/id/2060001000004105">2060001000004105 |Presence of tumor bud in primary <sub>malignant</sub> neoplasm of colon (observable entity)|</a></td></tr><tr><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> : <a href="http://snomed.info/id/246093002">246093002 |Component (attribute)|</a> = &#x3C;&#x3C; <a href="http://snomed.info/id/29246005">29246005 |Immunoglobulin G (substance)|</a> OR <a href="http://snomed.info/id/246093002">246093002 |Component (attribute)|</a> = &#x3C;&#x3C; <a href="http://snomed.info/id/74889000">74889000 |Immunoglobulin M (substance)|</a></td><td><strong>Query for all observable entity concepts with a component of some sort of Immunoglobulin G or M</strong></td><td>~4100 concepts including <a href="http://snomed.info/id/859751010000109">859751010000109 |Titer of Coxiella burnetii phase 2 IgM in serum at point in time (observable entity)|</a></td></tr><tr><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> : <a href="http://snomed.info/id/246093002">246093002 |Component (attribute)|</a> = &#x3C;&#x3C; <a href="http://snomed.info/id/29246005">29246005 |Immunoglobulin G (substance)|</a> AND <a href="http://snomed.info/id/246093002">246093002 |Component (attribute)|</a> != &#x3C;&#x3C; <a href="http://snomed.info/id/712606001">712606001 |Monoclonal immunoglobulin G (substance)|</a></td><td><strong>Query for all observable entity concepts with a component as some sort of Immnunoglobulin G, but NOT a subtype or self of</strong> <a href="http://snomed.info/id/712606001">712606001 |Monoclonal immunoglobulin G (substance)|</a> </td><td><p>>2800 concepts, including:</p><p><a href="http://snomed.info/id/859421010000105">859421010000105 |Presence of interferon beta IgG in serum at point in time (observable entity)|</a></p></td></tr><tr><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> :<br>[1..1] <a href="http://snomed.info/id/370130000">370130000 |Property (attribute)|</a> = *,<br>[1..1] <a href="http://snomed.info/id/704327008">704327008 |Direct site (attribute)|</a>  = *,<br>[1..1] <a href="http://snomed.info/id/246093002">246093002 |Component (attribute)|</a>  = *,<br>[0..0] <a href="http://snomed.info/id/370132008">370132008 |Scale type (attribute)|</a> = *,<br>[0..0] <a href="http://snomed.info/id/370134009">370134009 |Time aspect (attribute)|</a> =*</td><td><strong>Query for LOINC Groupers:</strong><br>By using cardinality to require Property, Direct site, and Component, and <em>exclude</em> Scale type and Time aspect, this query identifies generalized observables  (<a href="/pages/E3rWDeGhYDVPLpg07LS7">groupers</a>), defining shared features without constraining time or scale.</td><td>>2100 concepts, including:<br><a href="http://snomed.info/id/733141010000107">733141010000107 |Measurement of free cortisol in urine (observable entity)|</a></td></tr></tbody></table>

## Expression Constraints with Filters <a href="#id-6.4.1queryingtheloincontology-expressionconstraintswithfilters" id="id-6.4.1queryingtheloincontology-expressionconstraintswithfilters"></a>

Expression constraints with filters enhance concept selection by applying additional conditions based on metadata or external attributes rather than defining characteristics. Filters enable more flexible and targeted queries by constraining results based on criteria such as term status, module, effective time, or description type.

In the LOINC Ontology, expression constraints with filters allow for refined retrieval of LOINC terms based on metadata attributes such as versioning, language, or active status. By applying filters, users can narrow down results to match specific implementation requirements, ensuring more relevant and precise data retrieval.

The following pages of the [Expression Constraint Language](https://docs.snomed.org/snomed-ct-specifications/snomed-ct-expression-constraint-language/) Specification and Guide details the different kinds of filters that can be used to refine a query:

* [Description Filters](/snomed-ct-specifications/snomed-ct-expression-constraint-language/behaviour-specification-with-examples/6.8-description-filters.md)
* [Concept Filters](/snomed-ct-specifications/snomed-ct-expression-constraint-language/behaviour-specification-with-examples/6.9-concept-filters.md)
* [Member Filters](/snomed-ct-specifications/snomed-ct-expression-constraint-language/behaviour-specification-with-examples/6.10-member-filters.md)
* [History Supplements](/snomed-ct-specifications/snomed-ct-expression-constraint-language/behaviour-specification-with-examples/6.11-history-supplements.md)

The table below provides some examples of key filters for querying the LOINC Ontology content

<table data-full-width="true"><thead><tr><th>Filter</th><th>ECL Query</th><th>Text Description of Query</th></tr></thead><tbody><tr><td>Module Filter</td><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> {{ C moduleId = <a href="http://snomed.info/id/11010000107">11010000107 |LOINC Extension module|</a> }}</td><td>This ECL is satisfied by all concepts that are descendants or self of observable entities belonging to the LOINC extension module. Applying this module filter will ensure that only concepts belonging to the LOINC extension are returned.</td></tr><tr><td>Description Filter</td><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> {{ term = "glucose"}}{{ C moduleId = <a href="http://snomed.info/id/11010000107">11010000107 |LOINC Extension module|</a> }}</td><td><p>This ECL adds the description filter {{ term = "glucose"}}.</p><p>This ECL is satisfied by all concepts that are descendants or self of observable entities belonging to the LOINC extension module and has a description including the term 'glucose'</p></td></tr><tr><td><p>Description Filter</p><p>Word-prefix-any-order</p></td><td>&#x3C;&#x3C; <a href="http://snomed.info/id/363787002">363787002 |Observable entity (observable entity)|</a> {{ term = "hydr uri"}} {{ C moduleId = <a href="http://snomed.info/id/11010000107">11010000107 |LOINC Extension module|</a> }}</td><td><p>This ECL adds the description filter {{ term = "hydr uri"}}.</p><p>This example demonstrats the word-prefix-any-order search that is the default behaviour:</p><p><em>By default, term filters match using a word-prefix-any-order match technique. This means that each string value in the search term must match the start of a word in the concept's description term, but that these words may appear in any order.</em></p></td></tr></tbody></table>

## Query using the SNOMED CT Browser <a href="#id-6.4.1queryingtheloincontology-queryusingthesnomedctbrowser" id="id-6.4.1queryingtheloincontology-queryusingthesnomedctbrowser"></a>

To execute expression constraints using the SNOMED LOINC Browser, please follow these instructions:

1. Navigate to the LOINC Ontology browser: <https://browser.loincsnomed.org/>
2. Enter the "Expression constraints Queries" in the panel to the right, as shown here:
3. Copy an expression constraint from the examples above
4. Paste the expression constraint into the Expression Constraints Query text box, as shown here:
5. Click Execute (green button below the textbox)
6. View results

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.snomed.org/implementation-guides/loinc-implementation-guide/technical-application/6.4-using-the-loinc-ontology/6.4.1-querying-the-loinc-ontology.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
