The Index Schema

Index Schemas

The structure of a book is defined in the Index schema. These schemas are trees made up of nodes.
In the Python code, these are nodes are instances of the class sefaria.model.schema.SchemaNode and its children. The trees are stored in the database and transmitted through the API in a serialized form.

Node Types for an Index schema tree

Index schemas are structured as trees, where in most cases the internal nodes of the tree are of type SchemaNode and the leaves of the tree are of typeJaggedArrayNode(which will be explained in the next section).

Below is a diagram of the class hierarchy that defines the various Index schema nodes.

Inheritance Hierarchy of Index Schema Nodes at Sefaria

Inheritance Hierarchy of Index Schema Nodes at Sefaria

Since not all of this information is immediately relevant to the majority of engineers engaging in projects with Sefaria data, we only elaborate on SchemaNode and JaggedArrayNode in these docs. For a deeper dive, you can explore more of the schema on GitHub.