Karl Blessing
Programmer
I'm currently working on my church's website incorporating a couple versions of the bible into the site for an on-site searching and browsing capability. I currently already have King James, and some others from older text that I had (manually yikes!) parsed into the mysql database and actually got it working rather well on the site.
However I've come across a site called unbound bible which provides for free of use other versions of the bibles (mostly older translations no longer subject to copyright laws or were released for public use), some unicode downloads of those versions.
My current MySQL database is setup into three tables
Versions
Books
Verses
Versions are setup as
Books are setup as
and Verses are setup as (all are int except content)
Now a download from the unbound bible comes in mainly two usable files (without the mapping that is), the list of books titles, and then all the verses.
The books txt file is setup like...
where there are two digits followed by a letter (O = old, N = new, A = suplimental, but I'd just throw A in with the new testament, or add it to the enumeration)
And the verse file (for example English Standard UTF-8)
Basically going by BookID, Chapter, Verse and something called SubVerse and it's sort order.
The problem is I'm trying to figure out how to write a script in PHP to parse the two files, and insert them into my own database, also I can't use the same ID that are given to the books from the txt file, so I would probably have to manually insert the version first, then in the script somehow parse the books file first and assign to an array (ie: an array that would hold the ID of the book as it is in mysql, and an ID that it would show up in the verse text).
Then go and add in that manner.
But mainly having trouble getting an actual starting point.
Karl Blessing
However I've come across a site called unbound bible which provides for free of use other versions of the bibles (mostly older translations no longer subject to copyright laws or were released for public use), some unicode downloads of those versions.
My current MySQL database is setup into three tables
Versions
Books
Verses
Versions are setup as
Code:
+-----------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| shortname | varchar(32) | NO | | | |
| longname | varchar(64) | NO | | |
+-----------+---------------------+------+-----+---------+----------------+
Books are setup as
Code:
+-----------+-------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| title | varchar(64) | NO | | | |
| bookorder | int(2) unsigned | NO | | 0 | |
| testament | enum('Old','New') | NO | | Old | |
| version | int(10) unsigned | NO | | 0 | |
+-----------+-------------------+------+-----+---------+----------------+
and Verses are setup as (all are int except content)
Code:
+---------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| book | int(10) unsigned | NO | | 0 | |
| chapter | int(10) unsigned | NO | | 0 | |
| verse | int(10) unsigned | NO | | 0 | |
| content | text | NO | MUL | | |
+---------+------------------+------+-----+---------+----------------+
Now a download from the unbound bible comes in mainly two usable files (without the mapping that is), the list of books titles, and then all the verses.
The books txt file is setup like...
Code:
01O Genesis
02O Exodus
03O Leviticus
04O Numbers
where there are two digits followed by a letter (O = old, N = new, A = suplimental, but I'd just throw A in with the new testament, or add it to the enumeration)
And the verse file (for example English Standard UTF-8)
Code:
#name English: Basic English Bible
#filetype Unmapped-BCVS
#abbreviation ESV
#language eng
#note
#columns orig_book_index orig_chapter orig_verse orig_subverse order_by text
01O 1 1 10 At the first God made the heaven and the earth.
01O 1 2 20 And the earth was waste and without form; and it was dark on the face of the deep: and the Spirit of God was moving on the face of the waters.
01O 1 3 30 And God said, Let there be light: and there was light.
The problem is I'm trying to figure out how to write a script in PHP to parse the two files, and insert them into my own database, also I can't use the same ID that are given to the books from the txt file, so I would probably have to manually insert the version first, then in the script somehow parse the books file first and assign to an array (ie: an array that would hold the ID of the book as it is in mysql, and an ID that it would show up in the verse text).
Then go and add in that manner.
But mainly having trouble getting an actual starting point.
Karl Blessing