Questions about best practices for development for my own plugin

Hi org-roam folks.

I’ve been building an org-roam extension to try and replicate my Obsidian Bible Study workflow. My workflow is largely inspired by this: Bible Study in Obsidian Kit (including the Bible in Markdown) - Share & showcase - Obsidian Forum
I’m kind of new to emacs and org-roam so please be patient if I’m misunderstanding something.

You can see the link to my repository here: GitHub - sroerick/dabar
(This isn’t really meant for public release, I simply share it here to provide context for my question) (The code is ugly and bad, I don’t know lisp)

The extension is a minor mode which loads in an XML bible, parses it, and then provides a rudimentary interface for opening and reading a bible chapter.

My primary design goal is to be able to link to bible verses as I take notes, and to be able to see any backlinks when I read a chapter.

I implemented a new type of link e.g. “[[bible:Genesis 1:1]]”, which lets me link to an org-roam file. This is kind of the crux of my problem, and the question I have regarding design relates to this.

To take notes, I created a “org-roam/Dabar/” folder in my repository. Notes are then categorized by chapter. - e.g. “org-roam/Dabar/Genesis/”. I settled on this schema because I wanted to follow the design pattern of not altering the org-roam database.

Currently, when I follow a “bible:” link, it opens the appropriate “Dabar” file. It then appends the chapter contents to the bottom of that file, which lets me browse efficiently. Refs are also created in order to show backlinking to a particular chapter.

I’ve been looking at ‘dtk’ package and others as well (Front end interface for ‘diatheke’ Sword cli tool)

Ultimately, I think I probably need to store information in a database. I’d like to be able to take any type of Bible reference - a single verse, a range of verses, a chapter, a book, etc. I’d like to dynamically load that reference, and to then see any backlinks to any portion of the text which had been dynamically loaded.

I’m pretty happy with my current workflow - I think I’ve basically recreated the functionality from Obsidian and I’m pleased. With that said, I think I’m hitting a bit of a functionality ceiling.

If I didn’t modify the schema of any existing tables, how problematic would it be for me to create new tables in the org-roam database? If I decided to go this route, should I just spin up my own SQLite DB?

Would it be extremely complicated to simply add additional information to the org-roam buffer?

It seems there’s a fair amount of complexity to any of these solutions and I’m still kind of learning the ecosystem. For example, I haven’t really figured out bibliographies and citations. So, there may very well be tools out there which would solve my workflow problems without building out a big custom thing. Let me know if you think this is the case!

Thanks for your time

My first impression is that you may not need SQL to achieve your requirements.

You already have highly structured database: XML from book number, chapter, to verse number. I feel that regex will let you go very far.

I don’t know the syntax you have defined for bible: link type, but let me assume you have something like this: bible:<book-number>:<chapter>:<verse-number> — e.g. bible:1:2:3 refers to book 1, chapter 2, verse 3.

To get backlins from book 1, chapter 2, verse 3 is to do regex-search the string bible:1:2:3 in all files in your bible notes directory: org-roam/Dabar. Grep can do this.

Getting backlinks for range of verses may require more thoughts and you’d need to refine your requirements a bit more precisely. For example, what do you really want to get if you are looking for backlinks for book 1, chapter 1, verse range from 2 to 5? Do you mean only the links that refer to the exact same range 2–5? Or any links to 2, 3, 4, and 5? How do you want to treat a range-link to 4–7? (I don’t know if these verses actually exist in chapter one, but I hope you see my point here).

Thanks for the response!

I didn’t think about using Grep but that’s a good idea. I’m pretty happy using reflinks, and just adding them as the link is created. That seems to be working pretty well! I didn’t think about using grep, though, I think that would work extremely well.

Sorry for not being clear, but I think you’re reading where I’m going. In your example, let’s say I open “1:1:2-5” in the buffer - I would ultimately want to see backlinks for any notes which were made at 1:1:2, 1:1:2-5, 1:1:4-5, or 1:1:4-7.

Currently, I load things a chapter at a time. Then, when I create or follow a ‘bible:’ link, it simply links to that chapter. Then it creates a reflink with the name of the link so that I can track backlinks. Again, I’m really happy with this workflow and it is feature-complete compared to my Obsidian markdown setup.

Ultimately, there’s a number of stretch goals which I would be interested in developing out, but I’m at a point where I’m pausing to kind of learn the ecosystem a little better.

  • For example, should I be using one of the citation libraries?
  • How could I support concordance references? Multiple languages? Dictionaries? (dtk package could solve many of these, I think, if I could get it working properly)
  • re: concordances - In some translations, every word is marked with a concordance reference. (e.g. H4251 is Hebrew word number 4251) I frequently reference these as part of a word study. This may never happen, but I would love to see backlinks for a single word as well. A concordance is really a list of backlinks to begin with, but it would be nice to simply see references in my notes / have a workflow which let me pull that word’s definition very quickly.
  • I don’t really fully understand how ref links are used, I got a proof of concept and then kind of backed away slowly
  • The big design question mark for me is ultimately how to handle notes and citations, as discussed
  • Creating “Proxy” files (org/dabar/Genesis/ is a little ‘hacky’ to simply store refs and see backlinks
  • Can I integrate notes as footnotes / annotations?
  • I’m not sure yet how I would add custom info into the org-roam buffer

Please don’t feel obligated to answer all these questions! Again, my code is a bit messy, but I’m in a very comfy place and am content with my current workflow. I could use it as is for many years. In the spirit of org-roam being “complete”, I’d much rather take my time and continue to learn the codebase than get carried away and make silly design mistakes.

Thank you for your response and thanks for your dedication to this community! It’s really an amazing thing.