Contributed by Jonathan Pool on 2009-06-14.
One goal of the PanLex project is to facilitate the development of multiple user interfaces to the PanLex database. For example, because it is a panlingual resource, it is designed to encourage the development and use of interfaces in all languages.
This document describes one of the many possible PanLex interfaces. It is an interface designed by Jonathan Pool for the retrieval and modification of PanLex data. Hereafter, it is named “PanLem”.
The principle underlying PanLem is to use PanLex itself to translate the UI labels into the user’s preferred language. For this purpose, PanLem limits its labels to lemmata (words in their citation forms found in dictionaries). The original lemma for each label is in the artificial “PanLex” language, and the UI translates it into other languages’ lemmata at run-time.
The PanLem code is located on the host uf.utilika.org, contained in the CGI script /var/www/cgi-bin/plxu.cgi, written in Perl 5, and in additional files included at run-time as needed. The additional files (“state routines”, consisting of “input” and “output” routines) are located in /var/www/local/panlex/u, within a subdirectory named for the current version of PanLem. For version 2.1, the subdirectory is named “21”.
Subroutines called by the code in multiple state routines are factored out of them into the main script.
Perl 5.8.8, the version included with Red Hat Enterprise Linux 5, was found in 2010 to be classifying some characters incorrectly. In December 2010 we installed Perl 5.12.2 into /opt/perl (without threads support). In order to support PanLem, we also needed to install the DBI and DBD::Pg modules.
Each pair of a client request and a server response is self-contained. Requests use the POST method to submit form data via the standard input. The browser client submits a PanLem form, which provides all necessary data to identify the current state in a session and the current values of all variables that are applicable to that state. The main script imports an “input routine” (with a name ending in “r.pl”) that validates form submissions in that state and determines which state’s reply the server should give and with what parameter values. The main script then imports and executes the next state’s “output routine” (with a name ending in “w.pl”) to produce the content of the reply. If you are using a browser to examine PanLem and you want to see the applicable state code, look at the state identifier in gray text in the upper-right corner. If, for example, the identifier is “lvviz1w”, then that page was produced with “lvviz1w.pl”, and when you submit that form it will be validated and processed with “lvviz1r.pl”.
The intimate relationship between PanLem and PanLex is temporary. It is intended that PanLem starting in 2010 will be located on a host distinct from the host containing the PanLex database and will use only publicly available means for access to the database.