Database Structure:

The internal name of all QamIDEN SQLite3 databases is dictdata.

The data are conceived as “dictionaries” describing “languages”, but may be any kind of “headword → description” pair, e.g. a thesaurus or a person → address list. The text format is HTML.

Data may be “monolingual” or “bilingual”. In a monolingual database, Language_1_Headword (field or column name=“L1h”) is described by Language_1_Definition (“L1d”). In a bilingual database, Language_1_Headword (“L1h”) is described by Language_2_Definition (“L2d”), and Language_2_Headword (“L2h”) is described by Language_1_Definition (“L1d”). A further variant is an unpaired monolingual database, e.g. an ordinary text document with “Definitions” only (the Headword field [column] remains empty "", not  NULL).

Every record has three (monolingual) or five (bilingual) fields [columns]: a unique primary integer key “keyid”, plus two or four text fields: keyid  L1h  [L2h]  L1d  [L2d] , in that order. Both Headwords and Definitions consist of a single string of data with no line end; you may join multiple lines in source material with “\n”, to form one database string.

Bilingual databases may gather roughly equivalent data within the same record, e.g. English “word” and Spanish “palabra” might be mutually defined within one record. Examples:

INSERT INTO dictdata VALUES(1,'word','palabra','word','palabra');
    or
INSERT INTO dictdata VALUES(1,'word','palabra','word; a word of advice un consejo, I didn''t say a word! ijo no dije nada!','palabra; sin decir (una) palabra without a word');

Alternatively, if separate records for each “headword → definition” pair are used, then fields 3 and 4 (L2h and L1d), or 2 and 5 (L1h and L2d), are NULL. Examples:

INSERT INTO dictdata VALUES(1,'word',NULL,NULL,'palabra feminine, vocablo masculine (formal), voz feminine (formal)');
INSERT INTO dictdata VALUES(2,NULL,'palabra','word; plural words',NULL);

Record 0 (keyid=0 [zero], the first record in the database) always describes the database. Field L1h='[Database_Description]'. Field L1d contains the entire description (in a bilingual database, fields L2h and L2d are NULL). Field L1d consists of comma-separated “name:data” pairs. Monolingual example (the “names” are mandatory and literal; the data are examples):

title:Roget''s Thesaurus (1913) (single quotes, colons, and textual commas must be escaped: '' :: and ,,)
languages:1 (possible values: 1 or 2)
database:RogetThesaurus.qdb (database filename, no path; db is normally located in the same directory as QamIDEN)
fontfamily:default (if special font required, otherwise "default" [=MS Shell Dlg 2] or "pre" [L1d|L2d wrapped in "<pre>...</pre>" tags])
description:Synonyms (word(s) that characterize the description data; used literally in Results View if "Definitions" is checked)

If languages:2, three additional “name:data” pairs are required, e.g.:

title:English-Swahili-English Dictionary
languages:2
database:En-Sw.qdb
fontfamily:default,
description:Definitions
L1:Swahili - English (the literal text of Language_1 radio button)
L2:English - Swahili (ditto Language_2)
defaultChecked:L2 (default translation direction; possible values: L1 or L2)

Record 0 would be written in a monolingual database as follows:

INSERT INTO dictdata VALUES(
0,
'[Database_Description]','
title:Roget''s Thesaurus (1913),
languages:1,
database:RogetThesaurus.qdb,
fontfamily:default,
description:Synonyms
');

Record 0 in a bilingual database:

INSERT INTO dictdata VALUES(
0,
'[Database_Description]',
NULL,'
title:English-Swahili Dictionary,
languages:2,
database:EnSw-SwEn.qdb,
fontfamily:default,
description:Definitions,
L1:Swahili - English,
L2:English - Swahili,
defaultChecked:L2',
NULL
);

High-order characters >127 must be encoded as HTML named character entities (e.g. “è” = “&egrave;”) or numeric character references (e.g. “è” = [decimal] “&#232;” [hexadecimal] “&#xE8;”).

Database Header + Record 0 (bilingual statements):

PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
DROP INDEX IF EXISTS idx_L1h;
DROP INDEX IF EXISTS idx_L2h;
DROP TABLE IF EXISTS dictdata;
CREATE TABLE dictdata (
keyid INTEGER PRIMARY KEY AUTOINCREMENT,
L1h TEXT COLLATE NOCASE,
L2h TEXT COLLATE NOCASE,
L1d TEXT,
L2d TEXT ←↖ N.B. no comma if last line!
);
INSERT INTO dictdata VALUES(0,'[Database_Description]',
NULL,
'title:English-Swahili Dictionary,
languages:12,
database:En-Sw.qdb,
fontfamily:Arial Unicode MS,
description:Definitions,
L1:Swahili - English,
L2:English - Swahili,
defaultChecked:L2
',
NULL
);

Database Footer:

CREATE INDEX idx_L1h ON dictdata(L1h COLLATE NOCASE ASC);
CREATE INDEX idx_L2h ON dictdata(L2h COLLATE NOCASE ASC);
COMMIT;

The license (e.g. GPL) to use the dictionary, if any, should appear in Record 1, with L1h headword “LICENSE” in caps.

Construct databases in a text editor. sqlite3.exe is a Windows command line interpreter and compiler for SQLite3 databases. An important difference between sqlite3 and QamIDEN as intepreters is that sqlite3 returns all data as plain text, whereas QamIDEN interprets and displays data as HTML (thereby hiding embedded HTML tags and commands). As a compiler, sqlite3 can ".read" an SQL dumpfile or ".import" a CSV [note the .show and .separator commands] into .qdb format, with strong error-checking (among many pithy features – command .help for a summary):

sqlite3.exe filename.qdb (at command line; specify qdb file to which you will be writing, not the db sourcefile);
.read sourcefile
.quit (if no error)

To update a qdb with revised source data, using sqlite3.exe:

// ! Backup my.qdb and DbSource.txt first !
//   Delete my.qdb at command line; sqlite3 will recreate it
sqlite3.exe my.qdb
.read DbSource.txt // Write revised data into table dictdata
CREATE TEMP TABLE tmptbl (keyid INTEGER PRIMARY KEY AUTOINCREMENT,L1h TEXT,L2h TEXT,L1d TEXT,L2d TEXT);
INSERT INTO tmptbl (L1h,L2h,L1d,L2d) SELECT L1h,L2h,L1d,L2d FROM dictdata WHERE keyid != 0 ORDER BY L1h,L2h COLLATE NOCASE;
INSERT INTO tmptbl (keyid,L1h,L2h,L1d,L2d) SELECT keyid,L1h,L2h,L1d,L2d FROM dictdata WHERE keyid=0; // Force database descriptor = keyid 0
DROP TABLE dictdata;
CREATE TABLE dictdata (keyid INTEGER PRIMARY KEY AUTOINCREMENT,L1h TEXT,L2h TEXT,L1d TEXT,L2d TEXT);
INSERT INTO dictdata (keyid,L1h,L2h,L1d,L2d) SELECT keyid,L1h,L2h,L1d,L2d FROM tmptbl;
CREATE INDEX idx_L1h ON dictdata(L1h COLLATE NOCASE ASC);
CREATE INDEX idx_L2h ON dictdata(L2h COLLATE NOCASE ASC);
.output NewDbSource.txt // Filename must not exist!
.dump dictdata // Creates reordered database source file "NewDbSource.txt"
.quit

For more information about SQLite databases, consult http://www.sqlite.org/

You may compile QamIDEN from source for Linux | OS X | mobile devices (Symbian, WM7, Android [using Necessitas], i-Phone). Modifications, generally minor, may be necessary.

Sourcecode: http://sourceforge.net/projects/qamiden

Consult the Qt documentation: http://doc.qt.nokia.com/