# Transitive Closure Files

{% hint style="info" %}
**Important Note**

<mark style="color:red;">**Transitive Closure Files are not distributed in the SNOMED CT International Release**</mark>\
The file structures documented here are points of reference for those generating transitive closure table from release data. SNOMED International provides a script file that can be used to generate the Snapshot Transitive Closure file from the snapshot Relationship File.
{% endhint %}

The Transitive Closure is the complete set of relationships between every concept and each of its super-type concepts, in other words both its parents and ancestors.

A transitive closure table is one of the most efficient ways to test for subsumption between concepts.

## Snapshot Transitive Closure File

Transitive Closure Perl scripts can be used to generate a snapshot view of the transitive closure from the snapshot release of the Relationship. The output of such a script would usually adhere to the following file structure. Note that the primary key for this table consists of both columns.

***

**Transitive Closure File - Detailed Specification**

<table data-full-width="true"><thead><tr><th width="117.14453125">Field</th><th width="105.59375">Data type</th><th width="599.5805053710938">Purpose</th><th>PK*</th></tr></thead><tbody><tr><td>subtypeId</td><td>SCTID</td><td>Id of the concept playing the subtype role. Set to an Identifier of a concept.</td><td><mark style="color:green;"><strong>YES</strong></mark></td></tr><tr><td>supertypeId</td><td>SCTID</td><td>Id of the concept playing the supertype role. Set to an Identifier of a concept.</td><td><mark style="color:green;"><strong>YES</strong></mark></td></tr></tbody></table>

{% hint style="info" %}
PK\* indicates if the attribute is part of the primary key for that file/table.
{% endhint %}

***

## Versioned Transitive Closure

A versioned view of the Transitive Closure can also be generated by combining the snapshot views for different effective times and removing redundant rows (e.g. where the transitive closure has not changed between release versions). The generated file could then be represented using the example specification below. Note that the unique key for this file would consist of the **subtypeId**, **supertypeId** and **effectiveTime**.

***

**Versioned Transitive Closure File - Example Specification**

<table data-full-width="true"><thead><tr><th width="128.40234375">Field</th><th width="114.9312744140625">Data type</th><th width="607.9649047851562">Purpose</th><th>PK*</th></tr></thead><tbody><tr><td>subtypeId</td><td>SCTID</td><td>Id of the concept playing the subtype role. Set to an Identifier of a concept.</td><td><mark style="color:green;"><strong>YES</strong></mark></td></tr><tr><td>supertypeId</td><td>SCTID</td><td>Id of the concept playing the supertype role. Set to an Identifier of a concept.</td><td><mark style="color:green;"><strong>YES</strong></mark></td></tr><tr><td>effectiveTime</td><td>Time</td><td>Specifies the inclusive date at which the transitive closure record was added or changed its active state.</td><td><mark style="color:green;"><strong>YES</strong></mark></td></tr><tr><td>active</td><td>Boolean</td><td>Specifies whether at the transitive closure represented by the subtypeId and supertypeId became valid (active) or invalid (inactive) from the point in time specified by the effectiveTime.</td><td><mark style="color:red;"><strong>NO</strong></mark></td></tr></tbody></table>

{% hint style="info" %}
PK\* indicates if the attribute is part of the primary key for that file/table.
{% endhint %}

***

<a href="https://docs.google.com/forms/d/e/1FAIpQLScTmbZIf0UEQwYDkY27EEWBkaiYkHSbR0_9DmFrMLXoQLyL7Q/viewform?usp=pp_url&#x26;entry.1767247133=Release+File+Specification&#x26;entry.670899847=Transitive%20Closure%20Files" 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-specifications/snomed-ct-release-file-specification/component-release-file-specification/4.2-file-format-specifications/4.2.5-transitive-closure-files.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.
