A SQLite3 database, named X.sqlite, is constructed from X.xml. This database has only 1 table, named ‘X’.
Construct tab-delimited file ‘input.txt’ from X.xml:
php make_input.php ../../pywork/ap90.xml input.txt
This is straightforward. Think of each record of X.xml as:
and write a tab-delimited record to input.txt:
key \t lnum \t data
Use the sqlite3 command-line utility (from //www.sqlite.org ), to define the X database table, and to load ‘input.txt’ into this table:
sqlite3 X.sqlite < def.sql
The text file def.sql is:
DROP TABLE X; CREATE TABLE X ( key VARCHAR(100) NOT NULL, lnum DECIMAL(10,2) UNIQUE, data TEXT NOT NULL ); .separator "\t" .import input.txt X create index datum on X(key); pragma table_info (X); select count(*) from X; .exit
For displays of the dictionary, some random-access method of retrieving the data by headword is required. Any of the common SQL databases provide this functionality. SQLite is unique among the SQL databases in that it requires no database server; all that is required is the X.sqlite file. And, the same X.sqlite file is accessible in all operating systems. The standard libraries for Python and PHP contain methods for accessing the tables in a SQLite database; there are also open-source Java classes for this purpose. So, a SQLite database is excellent in terms of portability among operating systems and programming languages.
SQLite has the reputation of being a poor database choice for high-volume web sites. But this is a non-issue for Sanskrit dictionaries. Perhaps in some mythical future golden age, programmers will need to worry about high-volume Sanskrit dictionary web-sites!
The program is available for download from the download pages for each dictionary. Specifically, it is in the Xweb.zip and/or Xweb1.zip downloads. Within these downloads, it is in the ‘web/sqlite’ directory.