[jsword-svn] r1203 - in trunk: bibledesktop/etc/bin jsword/src/main/java/org/crosswire/jsword/book jsword/src/main/java/org/crosswire/jsword/index jsword/src/main/java/org/crosswire/jsword/index/query jsword-web/src/web
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Mon Dec 11 15:14:43 MST 2006
Author: dmsmith
Date: 2006-12-11 15:14:42 -0700 (Mon, 11 Dec 2006)
New Revision: 1203
Modified:
trunk/bibledesktop/etc/bin/BibleDesktop.sh
trunk/jsword-web/src/web/design.html
trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.java
trunk/jsword/src/main/java/org/crosswire/jsword/index/query/AbstractBinaryQuery.java
trunk/jsword/src/main/java/org/crosswire/jsword/index/query/package.html
Log:
Improved documentation, launching shell script and fixed a minor bug.
Modified: trunk/bibledesktop/etc/bin/BibleDesktop.sh
===================================================================
--- trunk/bibledesktop/etc/bin/BibleDesktop.sh 2006-12-11 04:34:55 UTC (rev 1202)
+++ trunk/bibledesktop/etc/bin/BibleDesktop.sh 2006-12-11 22:14:42 UTC (rev 1203)
@@ -15,7 +15,7 @@
;;
esac
-if [ -z "$JSWORD" ] ; then
+if [ -z "$JSWORD_HOME" ] ; then
## resolve links - $0 may be a link to jsword's home
PRG="$0"
progname=`basename "$0"`
@@ -29,26 +29,29 @@
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
- PRG="$link"
+ PRG="$link"
else
- PRG=`dirname "$PRG"`"/$link"
+ PRG=`dirname "$PRG"`"/$link"
fi
done
- JSWORD=`dirname "$PRG"`
+ JSWORD_HOME=`dirname "$PRG"`
cd "$saveddir"
# make it fully qualified
- JSWORD=`cd "$JSWORD" && pwd`
+ JSWORD_HOME=`cd "$JSWORD_HOME" && pwd`
fi
-cd $JSWORD
+cd $JSWORD_HOME
+# Root contains Java directory with JREs, modules and mods.d
+ROOT=`dirname $JSWORD_HOME`
+
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
- [ -n "$JSWORD" ] &&
- JSWORD=`cygpath --unix "$JSWORD"`
+ [ -n "$JSWORD_HOME" ] &&
+ JSWORD_HOME=`cygpath --unix "$JSWORD_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
@@ -64,9 +67,12 @@
JAVACMD="$JAVA_HOME/bin/java"
fi
else
- JAVACMD=`which java 2> /dev/null `
+ JAVACMD=`ls -d $ROOT/Java/linux/jre*/bin/java 2> /dev/null`
if [ -z "$JAVACMD" ] ; then
+ JAVACMD=`which java 2> /dev/null `
+ if [ -z "$JAVACMD" ] ; then
JAVACMD=java
+ fi
fi
fi
fi
@@ -81,8 +87,14 @@
LOCALCLASSPATH="$CLASSPATH"
fi
+# define the location of the jar files
+JSWORD_LIB="$JSWORD_HOME"
+if [-e "${JSWORD_LIB}/lib"] ; then
+ JSWORD_LIB=$JSWORD_HOME
+fi
+
# This is redundant if we are using the endorsed.dirs method
-for i in "${JSWORD}/"*.jar
+for i in "${JSWORD_LIB}"*.jar
do
# if the directory is empty, then it will return the input string
# this is stupid, so case for it
@@ -97,13 +109,19 @@
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
- JSWORD=`cygpath --windows "$JSWORD"`
+ JSWORD_HOME=`cygpath --windows "$JSWORD_HOME"`
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
CYGHOME=`cygpath --windows "$HOME"`
fi
-# "-Djava.endorsed.dirs=${JSWORD}/lib"
-# -classpath "${JSWORD}/resource"
-"$JAVACMD" -classpath "${LOCALCLASSPATH}" org.crosswire.bibledesktop.desktop.Desktop
+# "-Djava.endorsed.dirs=${JSWORD_LIB}"
+# -classpath "${JSWORD_HOME}/resource"
+# Note: We always pass the "apple" arguments, even when not on a mac.
+JSWORD_PROPERTIES=-Dapple.laf.useScreenMenuBar=true
+JSWORD_PROPERTIES="$JSWORD_PROPERTIES -Dcom.apple.mrj.application.apple.menu.about.name=BibleDesktop"
+[-e "$JSWORD_HOME/JSword"] && JSWORD_PROPERTIES="$JSWORD_PROPERTIES -Djsword.home=$JSWORD_HOME/JSword"
+[-e "$ROOT/mods.d"] && JSWORD_PROPERTIES="$JSWORD_PROPERTIES -Dsword.home=$ROOT"
+
+"$JAVACMD" -classpath "${LOCALCLASSPATH}" $JSWORD_PROPERTIES org.crosswire.bibledesktop.desktop.Desktop
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
===================================================================
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.java 2006-12-11 04:34:55 UTC (rev 1202)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManager.java 2006-12-11 22:14:42 UTC (rev 1203)
@@ -27,7 +27,7 @@
import org.crosswire.jsword.book.BookException;
/**
- * A way of managing a way of creating a search index for a book.
+ * Manages the life-cycle of an Index.
*
* @see gnu.lgpl.License for license details.
* The copyright to this program is held by it's authors.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/query/AbstractBinaryQuery.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/query/AbstractBinaryQuery.java 2006-12-11 04:34:55 UTC (rev 1202)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/query/AbstractBinaryQuery.java 2006-12-11 22:14:42 UTC (rev 1203)
@@ -29,7 +29,7 @@
* The copyright to this program is held by it's authors.
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
-public abstract class AbstractBinaryQuery implements Query
+public abstract class AbstractBinaryQuery implements BinaryQuery
{
/**
* Create a query consisting of two queries.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/query/package.html
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/query/package.html 2006-12-11 04:34:55 UTC (rev 1202)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/query/package.html 2006-12-11 22:14:42 UTC (rev 1203)
@@ -2,8 +2,62 @@
<body>
<p>
- Abstraction of a Query.
+ The Query package provides JSword with the ability to construct a search request against an Index.
+ The specific syntax of a query is an implementation detail.
+</p>
+<h2>Query</h2>
+<p>
+ The search request consists of one of the following:
+</p>
+<ul>
+ <li><code>Query</code>: search for a single atom, or</li>
+ <li><code>BinaryQuery</code>: search consisting of a left query and a right query joined by an operator, or</li>
+ <li><code>NullQuery</code>: search for nothing, returning nothing.</li>
+</ul>
+<p>
+ Note: an atom is the smallest unit of search that can be handled directly by the index.
+</p>
+<p>
+ The typical binary operators are:
+</p>
+<ul>
+ <li><code>AndQuery</code>: All that is common between the left and the right.</li>
+ <li><code>OrQuery</code>: All that is in both the left and the right.</li>
+ <li><code>AndNotQuery</code>: All that is in the left minus what is in the right.</li>
+</ul>
+<p>
+ The uncommon binary operators are:
+</p>
+<ul>
+ <li><code>RangeQuery</code>: There are two types of ranges: within a and without.
+ <ul>
+ <li>Within: All the results that are <em>within</em> a Range of Keys.</li>
+ <li>Without: All the results that are <em>outside</em> a Range of Keys.</li>
+ </ul>
+ </li>
+ <li><code>BlurQuery</code>: Like an AndQuery except that the right query is first blurred by a requested amount.</li>
+</ul>
+<h2>Query Parsing</h2>
+<p>
+ The <code>QueryBuilder</code> takes a search request as a string and generates a Query from it.
+ The primary characteristic of the Query builder is to determine the atoms of search and construct
+ a Query appropriately.
</p>
-
+<h2>Query Decorations</h2>
+<p>
+ Beyond the above queries, most modern query languages allow for specialized
+ searching using notation that is peculiar to it. The <code>QueryDecorator</code>
+ allows for phrases to be decorated in a way that is appropriate for the Index.
+ The following are the decorations that are currently defined:
+</p>
+<ul>
+ <li>Phrase decoration - find the phrase.</li>
+ <li>Spelling decoration - find words that sound like or are similar to the one that is given</li>
+ <li>Start With decoration - find words that start with the given words.</li>
+ <li>All Words decoration - an AndQuery decorator</li>
+ <li>Any Words decoration - an OrQuery decorator</li>
+ <li>Not Words decoration - an AndNotQuery decorator</li>
+ <li>Range decoration - decorates an AND range</li>
+</ul>
</body>
</html>
Modified: trunk/jsword-web/src/web/design.html
===================================================================
--- trunk/jsword-web/src/web/design.html 2006-12-11 04:34:55 UTC (rev 1202)
+++ trunk/jsword-web/src/web/design.html 2006-12-11 22:14:42 UTC (rev 1203)
@@ -37,14 +37,15 @@
Before we look at what BookData and Key looks like, a Book will need to be
able to do 2 other things:<br/>
Firstly tell us about itself: what it is called, where it comes from and so
- on - MetaData about the Book itself. Secondly help us to find stuff by searching.
+ on - BookMetaData about the Book itself. Secondly help us to find stuff by searching.
</p>
<pre>interface Book
{
BookData getData(Key ptr);
- BookMetaData getMetaData();
- Key search(Search word);
+ String getRawData(Key ptr);
+ BookMetaData getBookMetaData();
+ Key find(SearchRequest request);
}</pre>
<p>
@@ -62,7 +63,7 @@
an AbstractFactory:
</p>
-<pre>interface Books
+<pre>interface BookList
{
List getBooks();
List getBooks(BookFilter filter);
@@ -74,18 +75,70 @@
Both getBooks() methods allow you to iterate over the Books known to the whole
system (Books), and to Filter out the uninteresting Books. There is a BookFilters
class that contains a set of default implentations.<br/>
- The List returned by getBooks() contains BookMetaData objects and not the Books
- themselves because creating a Book may be a time and memory consuming process
- (indexes to be loaded etc) So these BookMetaData objects need to be able to
- give access to the Book they represent.
+ A Book contains BookMetaData, which provides information about a Book:
</p>
-<pre>interface BookMetaData
+<pre>interface BookMetaData extends Comparable
{
- Book getBook();
+ // Get various, different ways that this Book is known.
+ String getName();
+ String getInitials();
+ String getOsisID();
+ String getFullName();
+
+ // Get general info about any Book
+ BookCategory getBookCategory();
+ String getLanguage();
+ boolean isLeftToRight();
+ boolean isSupported();
+ boolean isQuestionable();
+
+ // get other information about a book
+ boolean hasFeature(FeatureType feature);
+ Map getProperties();
+ String getProperty(String key);
+
+ ... Other methods ...
}</pre>
<p>
+ Book largely replicates this interface and it is expected that methods of the same name
+ are delegated to the Book's BookMetaData. The reason for this delegation is that from
+ a developer's perspective, these are integral characteristics of a Book and in most
+ cases there is no reason to care that they are meta data. However, each Sword module
+ has a conf file which contains this information and this is taken as the Book's meta
+ data.
+</p>
+
+<pre>interface Book
+{
+ BookData getData(Key ptr);
+ String getRawData(Key key);
+ BookMetaData getBookMetaData();
+ Key find(SearchRequest request);
+
+ // Get various, different ways that this Book is known.
+ String getName()
+ String getInitials()
+ String getOsisID()
+ String getFullName()
+
+ // Get general info about any Book
+ BookCategory getBookCategory();
+ String getLanguage();
+ boolean isLeftToRight();
+ boolean isSupported();
+ boolean isQuestionable();
+
+ // get other information about a book
+ boolean hasFeature(FeatureType feature);
+ Map getProperties();
+ String getProperty(String key);
+
+ ... Other methods ...
+}</pre>
+
+<p>
Before we move on to what BookData and Key look like, I have intentionally
ignored 2 issues: Encrypted works - some works will need to be encrypted -
however the finding of keys or deobfustication will be done within the Driver
More information about the jsword-svn
mailing list