The Structure of a Simple Text
Learn more about the index schema for "simple" texts in the Sefaria Library.
The Schema of a Simple Text
The simplest Index records in the system have schema trees with just one node: a content node. Specifically, they have a JaggedArrayNode, which is a type of content node.

A Single-Node Tree for a Simple Text
Each JaggedArrayNode has a corresponding JaggedArray on the Version containing the text (not included in the diagram).
Example: Genesis
An example of a simple schema is the book of Genesis. The text for Genesis is stored in a depth-2 JaggedArray, an array of arrays. Each array in the JaggedArray represents a chapter, and each element within the chapter is an array of strings, representing verses.
The content for this book looks like this:
[
["Verse 1:1", "Verse 1:2", ...] # Chapter 1
["Verse 2:1", "Verse 2:2", ...] # Chapter 2
[...]
]The Index schema describing the book of Genesis looks like this:
{
"title" : "Genesis",
"maps" : [],
"order" : [1, 1],
"categories" : ["Tanach", "Torah"],
"schema" : {
"titles" : [
{
"lang" : "en",
"text" : "Genesis",
"primary" : True
},
{
"lang" : "en",
"text" : "Bereishit"
},
{
"lang" : "he",
"text" : "בראשית",
"primary" : True
}
],
"nodeType" : "JaggedArrayNode",
"lengths" : [50, 1533],
"depth" : 2,
"sectionNames" : ["Chapter", "Verse"],
"addressTypes" : ["Integer", "Integer"],
"key" : "Genesis"
}
}Properties on the Schema
Let's take a look at the various properties found on this specific Index schema:
| Property | Value in
| Explanation |
|---|---|---|
key | Genesis | A text field. For a single-node schema like this, the value of key is the same as the value of the title" field on the Index record. |
nodeType | JaggedArrayNode | This corresponds to a related class in the Python code. The value JaggedArrayNode is currently the only one used for single-node classes. |
titles | | An array of dictionaries specifying titles for this node (for full description of how titles work, see Titles. Each title dictionary has two required keys:
|
depth | 2 | The depth of the JaggedArray. A two dimensional array (i.e. a list of lists) would have a depth of 2, and a three dimensional array (i.e. a list of lists of lists) would have a depth of 3, etc. |
addressTypes | ["Integer", "Integer"] | An array with depth number of values, each one indicating how that level of the JaggedArray is addressed. Most commonly, these values are Integer, but could also be Talmud, or some less common values defined in safaria.model.schema |
sectionNames | ["Chapter","Verse"] | Array with depth number of values, each one a string name for that level of the JaggedArray. |
toc_zoom | n/a | An Integer value primarily used to adjust the way we choose to organize commentaries around the base text (and therefore not present on the Usually, a commentary is organized by the segments of commentary on the verse of the base text it comments on. Adjusting the
An example of a commentary |
lengths(optional) | [50, 1533] | An array with up to depth number of values, each one an integer specifying how many element exist at that level of the JaggedArray. In this case, we see that Genesis has 50 chapters, and 1533 verses. |
Updated 5 months ago