Wiki

Clone wiki

lexikon2sqlite / Download

Download


At the moment when I am writting this wiki page there is no pre-built version of this application except Java source. The only way of using this application is by compiling yourself the source code.

Note: all the file names/paths in this document are written using the Unix filesystem style

Required tools


In order to be able to use this application you have download the source code and compile it. Therefore you need the following tools:

Installing and running


To get the application running on your system, the first thing you must do is to build the application from sources, resulting an Java JAR archive file that represents the program.

Once you have got it all you have to do is to run it like :

java -jar <your-jar-file>

Build by Eclipse IDE


If you are an Java developer and you are already using the Eclipse IDE then the installing process should be smooth.

  1. Open the Eclipse project from the lexikon2sqlite source folder.
  2. Right-click on lexikon2sqlite project then Properties -> Java Build Path -> Libraries -> Add External JARs, and choose the sqlite4java.jar that you have previously downloaded (it's a project requirement, remember?).
  3. Compile the lexikon2sqlite project.
  4. Export the JAR: File -> Export -> Runnable JAR file and enter the Export destination as /tmp/lexikon2sqlite.jar and check Package required libraries into generated JAR then press Finish
  5. Run the application from where you have exported, like: java -jar /tmp/lexikon2sqlite.jar

Build by hand


If you are little more adventurous and you like the freedom that the command line gives you then you could try to compile everything just using your preffered JDK toolkit. Open your terminal, and follow the instructions bellow:

  1. cd <lexikon2sqlite-directory>
  2. javac -sourcepath src/ -g:none -classpath <path-to-sqlite4java>/sqlite4java.jar -d bin/ src/*.java
  3. cd bin
  4. jar xf <path-to-sqlite4java>/sqlite4java.jar com javolution
  5. echo -e "Main-Class: Main\nClass-Path: com.almworks.sqlite4java.SQLite" > /tmp/Manifest.txt
  6. jar cfm /tmp/lexikon2sqlite.jar /tmp/Manifest.txt *.class com javolution

At this point you have your /tmp/lexikon2sqlite.jar which in fact is the lexikon2sqlite application packaged into a ZIP file (with .jar extension).

The next step is to run the .jar to get your job done.

Run lexikon2sqlite


If you will run the command: java -jar /tmp/lexikon2sqlite.jar -h

you will get an output like the following:

Lexicon2Sqlite v1.0-rc-0-g35a874e (2012-05-14)
Read an folkets-lexikon.csc.kth.se XML file and save do disk as xml,sql script or Sqlite database

Usage: java Main [-options]
where options include:
  -c,  --command=<xml|sql|sqlite|mp3> ; (mandatory) base on the input file generates an output xml|sql|mp3 file or a sqlite database
  -i,  --input=<value>                ; (mandatory) the input XML file to be processed
  -o,  --output=<value>               ; (mandatory) the output file according to choosen -c option
  -v,  --verbose                      ; (optional) output the progress status to screen
  -h,  --help                         ; (optional) show this help

Report bugs to <eugenmihailescux@gmail.com>

As you can see there are 3 mandatory arguments:

  • -c, --command : one of the following commands:
    • xml : the source XML file is read and saved back as XML output file
    • sql : the source XML file is read and saved as a SQL script output file; the script contains SQL statements for creating tables, indecs and to insert rows for each word (plus its dependencies) found on the source XML file
    • sqlite : will create a temporary SQL script (as the command 'sql') for the specified XML source file then will run that script in order to generate and to populate the output SQLite database file that will contain all the words within the XML source file
    • mp3 : the source XML file is read and saved as a Unix Bourne shell file (which can be executed on any *nix system) which will automate the following operations for every word found on the source XML file:
      • will download the .swf file as defined per word
      • will call ffmpeg for the downloaded .swf file, in order to copy the audio part of .swf and to save it to the output path as defined on the shell file (default /tmp)
  • -i, --input : a source XML dictionary to be used/converted
  • -o, --output : the output file where the converted/script file is saved

Updated