# Importing the Bible to Roam - Final Solution
In this post I will present my final solution for getting the Bible imported into [Roam Research](https://roamresearch.com/). I have finally found a way to drastically decrease the size of the imported Roam graph, but still have a reasonable solution for accessing multiple translations and cross references. I will share my thoughts on performance and potential next steps for making the Bible work even better in Roam. If you are interested in the topic, I have two other posts on the subject. Links are at the end.
- You can download the Roam .EDN archive for the Bible from here: [ASV.edn](https://zsviczian.github.io/ASV.edn)
- For a real time demonstration of the full import process within 3 minutes check out [this video](https://youtu.be/bFyXjWHLcz4).
- **WARNING: by restoring the ASV.edn into your graph, all other data in your graph will be lost!**
- The source code for the converter is here: [Roam.json Bible importer with BUTTON for verse numbers v1.ipynb](https://colab.research.google.com/drive/1D7AjtZB0tV5bTmTu_s3nKxpRmspAVeiW#offline=true&sandboxMode=true)
- Use this if the primary translation you'd like to use in Roam is not the American Standard Version. Also you can tweak how the verses are formatted and whatever else you might want to change on the import.
If you haven't watched my other video about the Bible in Roam, I recommend watching that also. There I briefly show how you can add your own notes into your Roam Bible, and how it can become a powerful Study-Bible where you'll be able to find your notes and reflections when you revisit a verse in the future. Follow this link: [Roam Bible Tour - YouTube](https://www.youtube.com/watch?v=-CoqihWe5lk&t=1s). Also be sure to read my other post as it explains some of the logic for how I intend this Bible to be used: [Study Bible or ePub Books in Roam? My Roller Coaster Ride with Roam JSON](https://www.zsolt.blog/2020/12/Bible-and-ePub-Roam-json-import-part-2.html)
# Roam is not ready for handling a large body of text
In its current state Roam does not seem to be ready for handling a large text-corpus. In my previous attempts with importing the Bible I tried loading 33 000 pages and 96 000 blocks into Roam. The loading process took days... and as I was reaching 70 000 blocks in the graph, the import speed dropped to well below one block per second. More concerningly the graph took minutes to open and was very sluggish to work with even on a reasonably powerful desktop PC. Access from a tablet or phone were simply out of the question.
**Based on this experiment, my conclusion is not to load full-text books into my main graph.** I also advise keeping the Bible in a separate Study-Bible Roam graph, ring fenced from your other notes.
Additionally, the local Roam graph is distinctively slower than online Roam. While this version of the Bible works well in an online Roam database, working in a local graph I ran into performance problems.
# Scaling down the size of the Bible graph
I did two things to drastically reduce the size of the Bible graph.
**1. No pages for verses**
I decided against creating a page for each verse. e.g. [[Genesis 1:1]]. This approach seemed convenient for linking multiple translations of the same verse and to store cross references, but also accounted for ~32000 pages and ~32000 blocks in the graph. Since I am only importing a single translation this is not need.
**2. No cross references**
Cross references created enormous number of backlinks in the database and also accounted for an additional ~32000 blocks. Cross references are also not crucial to the Bible-study workflow in Roam. Also, there are plenty of powerful search tools on the internet with extensive Bible cross references. Where Roam shines is not the cross referencing of the text-corpus but the cross referencing of your own notes built around that text.
# Lean approach to accessing other translations, searchability and more...
I believe the ability to search for a verse is important. You want to be able to enter "MAT 1:1" and find Matthew chapter 1 verse 1. Easy access to different translations of a verse would still be preferred as well as access to cross references.
I solved this challenge by adding the verse reference for each verse as a custom Roam button instead of a page link to the verse: {{1:BIBLE:MAT 1:1}}. This approach provides almost unlimited flexibility by putting what ever logic you may want into a {{[[roam/js]]}} script. Also the text in the button is indexed by Roam, thus entering "MAT 1:1" in the search bar yields Matthew 1:1.
For now, I created a simple event handler that opens up bible.com at the verse specified in the button. This script can be easily further customized to pull up cross references either from a file on the internet using roam/js, or to call an internet service for cross references. Your imagination and coding skills are really the only limit.
Here's my script. Note Roam42 is a prerequisite. Also the script is largely based on code I took from Roam42. Thanks [@RoamHacker](https://twitter.com/roamhacker)! You need to put this code into a code-block nested under {{[[roam/js]]}}.
```js
window.bible = {
async event(e) {
if(e.target.tagName=='BUTTON') {
var block = e.target.closest('.roam-block');
if (!block) {
return;
}
var blockInfo = (await roam42.common.getBlockInfoByUID(block.id.substring( block.id.length -9)))[0][0].string;
if(blockInfo.includes(e.target.textContent + ':BIBLE:' )) {
const regex = '{{\\d+:BIBLE:(.{3})\\s(\\d+).(\\d+)}}';
var v = blockInfo.match(regex);
if(v.length == 4) {
window.open('https://www.bible.com/bible/547/'+v[1]+'.'+v[2]+'.'+v[3]+'.KJVAE','_blank');
}
}
}
}
}
document.addEventListener('click', window.bible.event);
```
# Import range of verses into your Daily Notes using Roam42 SmartBlocks
The Verses SmartBlock is already included in the ASV.edn available for download above. If you are doing your own import using JSON then you can use the SmartBlock available on GitHub: [Import range of Bible verses as block references · Issue #159 · roamhacker/SmartBlocks](https://github.com/roamhacker/SmartBlocks/issues/159)
# More about Roam
- [[Read Books in Roam - A Detailed How To Guide for Importing and Using ePub in Roam]]
- [[Study Bible or ePub Books in Roam - My rollercoaster ride with Roam JSON]]
- [[My Adventures with Roam.JSON]]