[Mulgara-svn] r957 - in trunk: . jxdata/iTQL/standard_queries src/jar/itql/java/org/mulgara/itql src/jar/query src/jar/query/java/org/mulgara/connection src/jar/query/java/org/mulgara/server src/jar/resolver/java/org/mulgara/resolver src/jar/server-beep/java/org/mulgara/server/beep src/jar/server-rmi/java/org/mulgara/server/rmi tools/src/org/mulgara/tools

alexhall at mulgara.org alexhall at mulgara.org
Thu May 22 19:21:07 UTC 2008


Author: alexhall
Date: 2008-05-22 12:21:05 -0700 (Thu, 22 May 2008)
New Revision: 957

Modified:
   trunk/build.xml
   trunk/jxdata/iTQL/standard_queries/queryResult19.txt
   trunk/jxdata/iTQL/standard_queries/test.jxu
   trunk/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java
   trunk/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java
   trunk/src/jar/query/build.xml
   trunk/src/jar/query/java/org/mulgara/connection/Connection.java
   trunk/src/jar/query/java/org/mulgara/connection/ConnectionFactory.java
   trunk/src/jar/query/java/org/mulgara/connection/DummyConnection.java
   trunk/src/jar/query/java/org/mulgara/connection/SessionConnection.java
   trunk/src/jar/query/java/org/mulgara/server/Session.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
   trunk/src/jar/server-beep/java/org/mulgara/server/beep/BEEPSession.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java
   trunk/tools/src/org/mulgara/tools/Sparql.java
Log:
Synchronize ConnectionFactory for concurrent access by multiple clients.

Modified: trunk/build.xml
===================================================================
--- trunk/build.xml	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/build.xml	2008-05-22 19:21:05 UTC (rev 957)
@@ -1,1994 +1,1995 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE project>
-
-  <!-- =================================================================== -->
-  <!--                       Project definition                            -->
-  <!-- =================================================================== -->
-  <project name="Mulgara" default="help" basedir=".">
-
-  <!-- =================================================================== -->
-  <!--                      Property Definitions                           -->
-  <!-- =================================================================== -->
-  <property file="common.properties"/>
-  <property file="build.properties"/>
-
-  <property file="${jar.src.dir}/ant-task/ant-task-build.properties"/>
-  <property file="${jar.src.dir}/client-jrdf/client-jrdf-build.properties"/>
-  <property file="${jar.src.dir}/config/config-build.properties"/>
-  <property file="${jar.src.dir}/demo/demo-build.properties"/>
-  <property file="${jar.src.dir}/demo-mp3/demo-mp3-build.properties"/>
-  <property file="${jar.src.dir}/content-mbox/content-mbox-build.properties"/>
-  <property file="${jar.src.dir}/content-mp3/content-mp3-build.properties"/>
-  <property file="${jar.src.dir}/content-n3/content-n3-build.properties"/>
-  <property file="${jar.src.dir}/content-rdfxml/content-rdfxml-build.properties"/>
-  <property file="${jar.src.dir}/content-rio/content-rio-build.properties"/>
-  <property file="${jar.src.dir}/descriptor/descriptor-build.properties"/>
-  <property file="${jar.src.dir}/driver/driver-build.properties"/>
-  <property file="${jar.src.dir}/dtd/dtd-build.properties"/>
-  <property file="${jar.src.dir}/itql/itql-build.properties"/>
-  <property file="${jar.src.dir}/jrdf/jrdf-build.properties"/>
-  <property file="${jar.src.dir}/query/query-build.properties"/>
-  <!--property file="${jar.src.dir}/rdql/rdql-build.properties"/-->
-  <property file="${jar.src.dir}/resolver/resolver-build.properties"/>
-  <property file="${jar.src.dir}/resolver-null/resolver-null-build.properties"/>
-  <property file="${jar.src.dir}/resolver-file/resolver-file-build.properties"/>
-  <property file="${jar.src.dir}/resolver-filesystem/resolver-filesystem-build.properties"/>
-  <property file="${jar.src.dir}/resolver-gis/resolver-gis-build.properties"/>
-  <property file="${jar.src.dir}/resolver-http/resolver-http-build.properties"/>
-  <property file="${jar.src.dir}/resolver-jar/resolver-jar-build.properties"/>
-  <property file="${jar.src.dir}/resolver-lucene/resolver-lucene-build.properties"/>
-  <property file="${jar.src.dir}/resolver-memory/resolver-memory-build.properties"/>
-  <property file="${jar.src.dir}/resolver-spi/resolver-spi-build.properties"/>
-  <property file="${jar.src.dir}/resolver-store/resolver-store-build.properties"/>
-  <property file="${jar.src.dir}/resolver-url/resolver-url-build.properties"/>
-  <property file="${jar.src.dir}/resolver-view/resolver-view-build.properties"/>
-  <property file="${jar.src.dir}/resolver-xsd/resolver-xsd-build.properties"/>
-  <property file="${jar.src.dir}/resolver-test/resolver-test-build.properties"/>
-  <property file="${jar.src.dir}/resolver-nodetype/resolver-nodetype-build.properties"/>
-  <property file="${jar.src.dir}/resolver-prefix/resolver-prefix-build.properties"/>
-  <property file="${jar.src.dir}/resolver-relational/resolver-relational-build.properties"/>
-  <property file="${jar.src.dir}/resolver-distributed/resolver-distributed-build.properties"/>
-  <property file="${jar.src.dir}/server/server-build.properties"/>
-  <property file="${jar.src.dir}/server-beep/server-beep-build.properties"/>
-  <property file="${jar.src.dir}/server-http/server-http-build.properties"/>
-  <property file="${jar.src.dir}/server-local/server-local-build.properties"/>
-  <property file="${jar.src.dir}/server-rmi/server-rmi-build.properties"/>
-  <property file="${jar.src.dir}/sofa/sofa-build.properties"/>
-  <property file="${jar.src.dir}/krule/krule-build.properties"/>
-  <property file="${jar.src.dir}/rules/rules-build.properties"/>
-  <property file="${jar.src.dir}/sparql-protocol/sparql-protocol-build.properties"/>
-  <property file="${jar.src.dir}/sparql-interpreter/sparql-interpreter-build.properties"/>
-  <property file="${jar.src.dir}/store/store-build.properties"/>
-  <property file="${jar.src.dir}/store-xa/store-xa-build.properties"/>
-  <property file="${jar.src.dir}/store-nodepool/store-nodepool-build.properties"/>
-  <property file="${jar.src.dir}/store-nodepool-memory/store-nodepool-memory-build.properties"/>
-  <property file="${jar.src.dir}/store-nodepool-xa/store-nodepool-xa-build.properties"/>
-  <property file="${jar.src.dir}/store-stringpool/store-stringpool-build.properties"/>
-  <property file="${jar.src.dir}/store-stringpool-memory/store-stringpool-memory-build.properties"/>
-  <property file="${jar.src.dir}/store-stringpool-xa/store-stringpool-xa-build.properties"/>
-  <property file="${jar.src.dir}/tag/tag-build.properties"/>
-  <property file="${jar.src.dir}/tuples-hybrid/tuples-hybrid-build.properties"/>
-  <property file="${jar.src.dir}/tuples/tuples-build.properties"/>
-  <property file="${jar.src.dir}/util-xa/util-xa-build.properties"/>
-  <property file="${jar.src.dir}/util/util-build.properties"/>
-
-  <property name="webui.viewer.src.dir"
-      value="${webui.src.dir}/java/org/mulgara/webui/viewer"/>
-  <property name="webui.viewer.obj.dir.classes"
-      value="${obj.dir}/war/webui/classes/org/mulgara/webui/viewer"/>
-
-  <!-- =================================================================== -->
-  <!--                              Imports                                -->
-  <!-- =================================================================== -->
-  <import file="common.xml"/>
-  <import file="webdocs.xml"/>
-
-  <import file="${jar.src.dir}/ant-task/build.xml"/>
-  <import file="${jar.src.dir}/client-jrdf/build.xml"/>
-  <import file="${jar.src.dir}/demo/build.xml"/>
-  <import file="${jar.src.dir}/demo-mp3/build.xml"/>
-  <import file="${jar.src.dir}/config/build.xml"/>
-  <import file="${jar.src.dir}/content-mbox/build.xml"/>
-  <import file="${jar.src.dir}/content-mp3/build.xml"/>
-  <import file="${jar.src.dir}/content-n3/build.xml"/>
-  <import file="${jar.src.dir}/content-rdfxml/build.xml"/>
-  <import file="${jar.src.dir}/content-rio/build.xml"/>
-  <import file="${jar.src.dir}/descriptor/build.xml"/>
-  <import file="${jar.src.dir}/driver/build.xml"/>
-  <import file="${jar.src.dir}/dtd/build.xml"/>
-  <import file="${jar.src.dir}/itql/build.xml"/>
-  <import file="${jar.src.dir}/jrdf/build.xml"/>
-  <import file="${jar.src.dir}/query/build.xml"/>
-  <!--import file="${jar.src.dir}/rdql/build.xml"/-->
-  <import file="${jar.src.dir}/resolver/build.xml"/>
-  <import file="${jar.src.dir}/resolver-null/build.xml"/>
-  <import file="${jar.src.dir}/resolver-file/build.xml"/>
-  <import file="${jar.src.dir}/resolver-filesystem/build.xml"/>
-  <import file="${jar.src.dir}/resolver-gis/build.xml"/>
-  <import file="${jar.src.dir}/resolver-http/build.xml"/>
-  <import file="${jar.src.dir}/resolver-jar/build.xml"/>
-  <import file="${jar.src.dir}/resolver-lucene/build.xml"/>
-  <import file="${jar.src.dir}/resolver-memory/build.xml"/>
-  <import file="${jar.src.dir}/resolver-nodetype/build.xml"/>
-  <import file="${jar.src.dir}/resolver-prefix/build.xml"/>
-  <import file="${jar.src.dir}/resolver-relational/build.xml"/>
-  <import file="${jar.src.dir}/resolver-distributed/build.xml"/>
-  <import file="${jar.src.dir}/resolver-spi/build.xml"/>
-  <import file="${jar.src.dir}/resolver-store/build.xml"/>
-  <import file="${jar.src.dir}/resolver-url/build.xml"/>
-  <import file="${jar.src.dir}/resolver-view/build.xml"/>
-  <import file="${jar.src.dir}/resolver-xsd/build.xml"/>
-  <import file="${jar.src.dir}/resolver-test/build.xml"/>
-  <import file="${jar.src.dir}/server/build.xml"/>
-  <import file="${jar.src.dir}/server-beep/build.xml"/>
-  <import file="${jar.src.dir}/server-http/build.xml"/>
-  <import file="${jar.src.dir}/server-local/build.xml"/>
-  <import file="${jar.src.dir}/server-rmi/build.xml"/>
-  <import file="${jar.src.dir}/sofa/build.xml"/>
-  <import file="${jar.src.dir}/krule/build.xml"/>
-  <import file="${jar.src.dir}/rules/build.xml"/>
-  <import file="${jar.src.dir}/sparql-protocol/build.xml"/>
-  <import file="${jar.src.dir}/sparql-interpreter/build.xml"/>
-  <import file="${jar.src.dir}/store/build.xml"/>
-  <import file="${jar.src.dir}/store-xa/build.xml"/>
-  <import file="${jar.src.dir}/store-nodepool/build.xml"/>
-  <import file="${jar.src.dir}/store-nodepool-memory/build.xml"/>
-  <import file="${jar.src.dir}/store-nodepool-xa/build.xml"/>
-  <import file="${jar.src.dir}/store-stringpool/build.xml"/>
-  <import file="${jar.src.dir}/store-stringpool-memory/build.xml"/>
-  <import file="${jar.src.dir}/store-stringpool-xa/build.xml"/>
-  <import file="${jar.src.dir}/tag/build.xml"/>
-  <import file="${jar.src.dir}/tuples-hybrid/build.xml"/>
-  <import file="${jar.src.dir}/tuples/build.xml"/>
-  <import file="${jar.src.dir}/util-xa/build.xml"/>
-  <import file="${jar.src.dir}/util/build.xml"/>
-
-  <!-- =================================================================== -->
-  <!--                          Path Definitions                           -->
-  <!-- =================================================================== -->
-  <path id="project-classpath">
-
-    <path refid="common-classpath"/>
-  </path>
-
-  <path id="webui.classpath">
-
-    <pathelement path="${java.class.path}"/>
-    <pathelement path="${obj.dir}/war/webui/classes"/>
-
-    <fileset dir="${lib.dir}" includes="**/**"/>
-    <fileset dir="${dist.dir}" includes="${driver.jar}"/>
-  </path>
-
-  <!-- =================================================================== -->
-  <!--                          Task Definitions                           -->
-  <!-- =================================================================== -->
-
-  <!-- Define the RDFLoad task -->
-  <target name="define.rdfload" unless="define.rdfload" depends="ant-task-jar"
-   description="Defines the rdfload taskdef">
-
-    <taskdef name="rdfload" classname="org.mulgara.ant.task.rdf.RDFLoad">
-
-     <classpath>
-
-       <pathelement path="${dist.dir}/${driver.jar}"/>
-       <pathelement path="${dist.dir}/${ant-task.jar}"/>
-       <pathelement path="${lib.dir}/apache-soap-2.2.jar"/>
-       <pathelement path="${lib.dir}/log4j-1.2.15.jar"/>
-     </classpath>
-    </taskdef>
-
-    <property name="define.rdfload" value="true"/>
-  </target>
-
-  <!-- Define the ITQLCommand task -->
-  <target name="define.itqlcommand" unless="define.itqlcommand" depends="ant-task-jar"
-   description="Defines the itqlcommand taskdef">
-
-    <taskdef name="itqlcommand" classname="org.mulgara.ant.task.itql.ITQLCommand">
-
-     <classpath>
-
-       <pathelement path="${dist.dir}/${driver.jar}"/>
-       <pathelement path="${dist.dir}/${ant-task.jar}"/>
-       <pathelement path="${lib.dir}/apache-soap-2.2.jar"/>
-       <pathelement path="${lib.dir}/log4j-1.2.15.jar"/>
-     </classpath>
-    </taskdef>
-
-    <property name="define.itqlcommand" value="true"/>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Delete all intermediate and end product files, leaving only files   -->
-  <!-- from CVS.                                                           -->
-  <!-- =================================================================== -->
-  <target name="clean"
-      description="Deletes all intermediate and product files, leaving only sources">
-
-    <tstamp/>
-
-    <delete dir="${obj.dir}"/>
-    <delete dir="${test.dir}"/>
-    <delete dir="${bin.dir}"/>
-    <delete dir="${dist.dir}"/>
-    <delete dir="${tmp.dir}"/>
-    <delete dir="${javadoc.dir}"/>
-    <delete dir="${jxtest.dir}"/>
-    <delete dir="${src.docs.dir}"/>
-    <delete dir="${basedir}/testDatabase"/>
-    <delete dir="${basedir}/sqltest"/>
-    <delete>
-      <fileset dir="${basedir}" includes="*.log*"/>
-    </delete>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Automated testing target for Anthill, updates source before         -->
-  <!-- running tests                                                       -->
-  <!-- =================================================================== -->
-  <target name="anthill-test"
-          depends="clean, test"
-          description="Runs all tests for Anthill">
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Automated testing target for Anthill, updates source before         -->
-  <!-- running tests                                                       -->
-  <!-- =================================================================== -->
-  <target name="anthill-quick-test"
-          depends="clean, jxunit-test, publish"
-          description="Runs all tests for Anthill">
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Performs a cvs update on the server-side source                     -->
-  <!-- =================================================================== -->
-  <target name="cvs-update" description="perform a CVS update on all source">
-    <cvs cvsRoot="${cvs.root}" package="${cvs.src.package}" command="update"/>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Run JUnit regression (non-load) tests on dbms.jar                   -->
-  <!-- =================================================================== -->
-  <target name="dbms-test" depends="-prepare-build, uri,
-    driver-jar, itql-jar, query-jar, util-jar, log4j-conf.xml"
-    description="runs regression tests on the triple store">
-
-    <!-- Set timestamp for CruiseControl's benefit -->
-    <tstamp/>
-
-    <delete dir="${junit.results.tmpdir}"/>
-
-    <mkdir dir="${junit.results.tmpdir}"/>
-
-    <delete file="${junit.results}"/>
-
-    <junit fork="yes" haltonfailure="no" printsummary="on"
-      jvm="${java.home}/bin/java" dir="${basedir}">
-
-      <!-- The cvs.root system property allows tests to find CVS'ed test data -->
-      <jvmarg value="${arch.bits}"/>
-      <jvmarg value="-Djava.io.tmpdir=${tmp.dir}"/>
-      <jvmarg value="-Djava.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory"/>
-      <jvmarg value="-Djava.naming.provider.url=rmi://localhost"/>
-      <jvmarg value="-Djava.rmi.server.codebase=${bin.uri}/${rmi.jar}"/>
-      <jvmarg value="-Dcvs.root=${basedir}"/>
-      <jvmarg value="-Dlog4j.configuration=${baseuri}/log4j-conf.xml"/>
-
-      <classpath refid="project-classpath"/>
-      <classpath path="${activation.jar}"/>
-      <classpath path="${bin.dir}/${query.jar}"/>
-      <classpath path="${bin.dir}/${driver.jar}"/>
-      <classpath path="${bin.dir}/${itql.jar}"/>
-      <classpath path="${bin.dir}/${rules.jar}"/>
-      <classpath path="${bin.dir}/${server.jar}"/>
-      <classpath path="${bin.dir}/${util.jar}"/>
-
-      <formatter type="xml"/>
-
-      <batchtest todir="${junit.results.tmpdir}">
-
-        <fileset dir="${src.dir}/jar/query/java" includes="**/*Test.java"
-          excludes="**/*LoadTest.java"/>
-        <fileset dir="${src.dir}/jar/driver/java" includes="**/*Test.java"
-          excludes="**/*LoadTest.java"/>
-        <fileset dir="${src.dir}/jar/itql/java" includes="**/*Test.java"
-          excludes="**/*LoadTest.java"/>
-        <fileset dir="${src.dir}/jar/server/java" includes="**/*Test.java"
-          excludes="**/*LoadTest.java"/>
-        <fileset dir="${src.dir}/jar/util/java" includes="**/*Test.java"
-          excludes="**/*LoadTest.java"/>
-      </batchtest>
-    </junit>
-
-    <!-- junitreport does not seem to support props in the tofile attribute -->
-    <!--<junitreport tofile="${junit.results}">-->
-
-    <junitreport tofile="test/All-Tests.xml">
-      <fileset dir="${junit.results.tmpdir}" includes="TEST-*.xml"/>
-    </junitreport>
-  </target>
-
-  <target name="base-dist"
-          depends="ant-task-dist,
-                   client-jrdf-dist, content-mbox-dist,
-                   content-mp3-dist, content-rdfxml-dist, content-rio-dist,
-                   descriptor-dist, driver-dist, dtd-dist, itql-dist, jrdf-dist,
-                   store-dist, store-xa-dist, store-nodepool-dist,
-                   store-nodepool-memory-dist,
-                   store-nodepool-xa-dist, query-dist,
-                   resolver-dist, resolver-null-dist, resolver-file-dist, resolver-filesystem-dist,
-                   resolver-http-dist, resolver-nodetype-dist, resolver-prefix-dist,
-                   resolver-lucene-dist, resolver-memory-dist, resolver-relational-dist,
-                   resolver-spi-dist, resolver-store-dist, resolver-distributed-dist,
-                   resolver-url-dist, resolver-view-dist, resolver-xsd-dist,
-                   resolver-jar-dist, resolver-test-dist,
-                   server-dist, server-beep-dist, server-http-dist, server-local-dist,
-                   server-rmi-dist, sofa-dist, sparql-int-dist, krule-dist, rules-dist,
-                   store-stringpool-dist, store-stringpool-memory-dist,
-                   store-stringpool-xa-dist, tag-dist,
-                   tuples-dist, tuples-hybrid-dist,
-                   util-dist, util-xa-dist"
-          description="Creates the distribution base jars">
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Creates the distribution files                                      -->
-  <!-- =================================================================== -->
-  <!-- Removed server-local, jrdf -->
-  <target name="dist"
-          depends="itql-dist, driver-dist, descriptor-dist, mulgara-war,
-                   embedded-dist, lite-dist"
-          description="Creates the distribution files">
-
-    <copy file="${bin.dir}/${mulgara.war}" tofile="${dist.dir}/${mulgara.war}"/>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Creates the distribution of documentation files                     -->
-  <!-- =================================================================== -->
-  <target name="dist-website" depends="javadoc, javadoc-dist, webpage-includes"
-    description="Creates the distribution of documentation files">
-
-    <mkdir dir="${dist.docs.dir}"/>
-    <mkdir dir="${dist.api.dir}"/>
-
-    <!-- copy the documentation -->
-    <copy todir="${dist.docs.dir}">
-      <fileset dir="${src.docs.dir}"/>
-    </copy>
-
-    <!-- copy the API -->
-    <copy todir="${dist.api.dir}">
-      <fileset dir="${javadoc.dir}"/>
-    </copy>
-
-
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Creates and copies the core Mulgara files to a single directory      -->
-  <!-- =================================================================== -->
-  <target name="core" depends="dist"
-    description="Creates and then copies the core Mulgara files to a single directory.">
-
-    <!-- webservices.war -->
-    <copy file="${obj.dir}/war/webservices.war" todir="${core.dir}"/>
-
-    <!-- jars for webui war -->
-    <copy file="${obj.dir}/war/webui/jars/${webui-logic.jar}" todir="${core.dir}"/>
-    <copy file="${obj.dir}/war/webui/jars/${webui-barracuda.jar}" todir="${core.dir}"/>
-
-    <!-- driver jar for clients -->
-    <copy file="${dist.dir}/${driver.jar}" todir="${core.dir}"/>
-
-    <!-- ant task jar -->
-    <copy file="${ant-task.dist.dir}/${ant-task.jar}" todir="${core.dir}"/>
-
-    <copy todir="${core.dir}">
-      <fileset dir="${bin.dir}">
-        <include name="*.jar"/>
-      </fileset>
-    </copy>
-
-    <!-- generate the client side java doc -->
-    <antcall target="javadoc"/>
-    <copy todir="${core-javadoc.dir}">
-      <fileset dir="${javadoc.dir}">
-        <include name="*/**"/>
-      </fileset>
-    </copy>
-
-    <!-- jxunit tests -->
-    <mkdir dir="${core.dir}/jxdata/iTQL/"/>
-    <copy todir="${core.dir}/jxdata/iTQL">
-      <fileset dir="${jxdata.dir}/iTQL"/>
-    </copy>
-
-    <!-- resolver example -->
-    <mkdir dir="${core.dir}/example/resolver"/>
-    <copy todir="${core.dir}/example/resolver">
-      <fileset dir="${resolver-http.src.dir}">
-        <include name="**/*.*"/>
-        <exclude name="**/*UnitTest.java"/>
-      </fileset>
-    </copy>
-
-    <!-- content handler example -->
-    <mkdir dir="${core.dir}/example/handler"/>
-    <copy todir="${core.dir}/example/handler">
-      <fileset dir="${content-mp3.src.dir}">
-        <include name="**/*.*"/>
-        <exclude name="**/*UnitTest.java"/>
-      </fileset>
-    </copy>
-
-    <mkdir dir="${core.dir}/example/conf/handler"/>
-    <copy todir="${core.dir}/example/conf/handler">
-      <fileset dir="${content-mp3.conf.dir}" includes="**/parserfactory.conf"/>
-    </copy>
-
-    <move todir="${core.dir}/example/resolver/java">
-      <fileset dir="${core.dir}/example/handler" includes="**/compile-resolver.list"/>
-    </move>
-
-    <move todir="${core.dir}/example/handler/java">
-      <fileset dir="${core.dir}/example/handler" includes="**/compile-handler.list"/>
-    </move>
-
-    <move todir="${core.dir}/example">
-      <fileset dir="${core.dir}/example/handler" includes="**/build-tutorial.*"/>
-    </move>
-
-    <!-- Library jars -->
-    <mkdir dir="${core.dir}/example/lib"/>
-    <copy todir="${core.dir}/example/lib">
-      <fileset dir="${lib.dir}" includes="${jid3.jar}"/>
-    </copy>
-
-    <delete>
-      <fileset dir="${core.dir}/example/handler" includes="*build*.*"/>
-    </delete>
-    <delete>
-      <fileset dir="${core.dir}/example/resolver" includes="*build*.*"/>
-    </delete>
-
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Generates a manifest file for the Mulgara executable project JAR        -->
-  <!-- =================================================================== -->
-  <target name="lite-create-manifest" depends="-prepare-build">
-    <mkdir dir="${obj.dir}/META-INF"/>
-
-    <!-- generate the core manifest -->
-    <manifest file="${obj.dir}/META-INF/MANIFEST_Mulgara_BASE.MF">
-      <attribute name="Main-Class" value="org.mulgara.triplestore.Main"/>
-    </manifest>
-
-    <!-- generate the bootstrap manifest -->
-    <manifest file="${obj.dir}/META-INF/MANIFEST_Mulgara_Lite_BOOTSTRAP.MF">
-
-      <attribute name="Main-Class" value="org.mulgara.util.Bootstrap"/>
-      <attribute name="Embedded-Jar" value="
-          lib/${query.jar}, lib/${driver.jar}, lib/${itql.jar}, lib/${sparql-int.jar},
-          lib/${rmi.jar},
-          lib/${server.jar}, lib/${server-beep.jar}, lib/${server-rmi.jar},
-          lib/${util.jar}, lib/${config.jar}, lib/${descriptor.jar}, lib/${server-local.jar},
-          lib/${resolver.jar}, lib/${resolver-spi.jar}, lib/${resolver-filesystem.jar},
-          lib${store.jar}, lib/${store-xa.jar}, lib/${rules.jar},
-          lib/${store-nodepool.jar}, lib/${store-nodepool-xa.jar},
-          lib/${store-nodepool-memory.jar}, lib/${store-stringpool.jar}
-          lib/${store-stringpool-xa.jar},
-          lib/${store-stringpool-memory.jar}, lib/${util-xa.jar}, lib/${resolver-null.jar}, lib/${resolver-file.jar},
-          lib/${resolver-http.jar}, lib/${resolver-lucene.jar}, lib/${resolver-memory.jar},
-          lib/${resolver-store.jar}, lib/${resolver-url.jar}, lib/${resolver-view.jar},
-          lib/${tuples.jar}, lib/${tuples-hybrid.jar}, lib/${content-mp3.jar},
-          lib/${content-n3.jar}, lib/${content-mbox.jar}, lib/${content-rdfxml.jar},
-          lib/${content-rio.jar}, lib/${resolver-nodetype.jar}, lib/${resolver-prefix.jar},
-          lib/${resolver-relational.jar}, lib/${resolver-xsd.jar}, lib/${resolver-test.jar},
-          lib/${resolver-distributed.jar},
-          lib/${resolver-jar.jar}, lib/${dtd.jar}, lib/${jrdf.base.jar}
-          lib/activation-1.0.2.jar, lib/icu4j.jar, lib/jena-2.1.jar, lib/antlr.jar,
-          lib/${date-utils.jar}, lib/${commons-logging.jar}, lib/beepcore-0.9.08.jar, lib/log4j-1.2.15.jar, lib/${lucene.jar}, lib/mail-1.3.jar,
-          lib/${jetty.jar}, lib/${jetty.plus.jar}, lib/${jasper.compiler.jar}, lib/${servlet.jar}, lib/jargs-0.2.jar,
-          lib/${castor-xml.jar}, lib/${castor-codegen.jar}, lib/${castor-xml-schema.jar}, lib/trove-1.0.2.jar, lib/${jrdf.jar}, lib/${saaj.jar},
-          lib/${jakarta-oro.jar}, lib/jta-spec1_0_1.jar, lib/${jotm.jar}, lib/${jotm.jrmp.jar}, lib/${carol.jar}, lib/${howl.jar},
-          lib/${jca.jar}, lib/${httpclient.jar}, lib/${commons-codec.jar}, lib/${mulgara-sparql.jar}"/>
-      <attribute name="Embedded-Main-Class" value="org.mulgara.server.EmbeddedMulgaraServer"/>
-    </manifest>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Creates the lite distribution file for the Embedded Mulgara server   -->
-  <!-- =================================================================== -->
-  <target name="lite-dist"
-          depends="driver-jar, itql-jar, sparql-int-jar, rules-jar, query-jar, rmi-jar,
-                   server-jar, server-local-jar, server-beep-jar,
-                   server-rmi-jar, util-jar, config-jar, dtd-jar, jrdf-jar, ant-task-jar,
-                   store-dist, store-xa-dist, store-nodepool-dist,
-                   store-nodepool-xa-dist,
-                   store-nodepool-memory-dist,
-                   store-stringpool-dist,
-                   store-stringpool-xa-dist,
-                   store-stringpool-memory-dist, tuples-dist, tuples-hybrid-dist, resolver-null-dist,
-                   resolver-file-dist, resolver-filesystem-dist, resolver-distributed-dist,
-                   resolver-http-dist, resolver-lucene-dist, resolver-relational-dist,
-                   resolver-memory-dist, resolver-nodetype-dist, resolver-prefix-dist,
-                   resolver-store-dist, resolver-url-dist, resolver-jar-dist,
-                   resolver-view-dist, resolver-xsd-dist,
-                   content-mbox-dist, content-mp3-dist, content-n3-dist,
-                   content-rdfxml-dist, content-rio-dist,
-                   lite-create-manifest, javadoc-dist,
-                   lite-dist-uptodate, webpage-includes"
-          unless="dist.lite.uptodate"
-          description="Creates the executable JAR for the Embedded Mulgara Lite
-                       server">
-
-    <!-- HACK!!!!! -->
-    <!-- This will get the ARP parser working -->
-    <mkdir dir="${obj.dir}/xerces"/>
-
-    <unjar src="${lib.dir}/xercesImpl.jar" dest="${obj.dir}/xerces"/>
-    <unjar src="${lib.dir}/xmlParserAPIs.jar" dest="${obj.dir}/xerces"/>
-    <unjar src="${lib.dir}/jsr173_07_api.jar" dest="${obj.dir}/xerces"/>
-    <unjar src="${lib.dir}/jsr173_07_ri.jar" dest="${obj.dir}/xerces"/>
-    <!-- HACK!!!!! -->
-
-    <!-- build the executable jar file -->
-    <jar jarfile="${dist.dir}/${mulgara-lite.jar}"
-        manifest="${obj.dir}/META-INF/MANIFEST_Mulgara_Lite_BOOTSTRAP.MF">
-
-      <zipfileset dir="${conf.dir}" prefix="conf"
-          includes="log4j-mulgara.xml, webdefault.xml, mulgara-rmi.policy,
-                    mulgara.policy"/>
-      <zipfileset dir="${lib.dir}" prefix="lib" includes="
-        ${log4j.jar}, ${icu4j.jar}, ${activation.jar}, ${beep.jar},
-        ${jargs.jar}, ${jrdf.jar}, ${jetty.jar}, ${jetty.plus.jar},
-        ${servlet.jar}, ${jasper.runtime.jar}, ${jasper.compiler.jar},
-        ${lucene.jar}, ${mail.jar}, ${castor-xml.jar}, ${castor-xml-schema.jar}, ${castor-codegen.jar}, ${trove.jar},
-        ${date-utils.jar}, ${commons-logging.jar}, ${commons-httpclient.jar},
-        ${commons-codec.jar}, ${emory-util.jar}, ${mulgara-sparql.jar}
-        ${jotm.jar}, ${jotm.jrmp.jar}, ${carol.jar}, ${howl.jar}, ${jta.jar},
-        ${jsr.173.api.jar}, ${jsr.173.ri.jar}, ${jca.jar}, ${saaj.jar},
-        ${axis.jar}, ${commons-discovery.jar}, ${jaxrpc.jar}, ${wsdl4j.jar},
-        ${jena.jar}, ${antlr.jar}, ${jakarta-oro.jar}, {jid3.jar}"/>
-      <zipfileset dir="${lib.dir}" prefix="lib" includes="${saaj.jar},
-                       ${axis.jar}, ${commons-discovery.jar},
-                       ${jaxrpc.jar}, ${wsdl4j.jar}"/>
-      <zipfileset dir="${bin.dir}" prefix="lib" includes="
-          ${query.jar}, ${driver.jar}, ${itql.jar}, ${sparql-int.jar},
-          ${rules.jar}, ${rmi.jar},
-          ${server.jar}, ${server-beep.jar}, ${server-rmi.jar},
-          ${util.jar}, ${config.jar}, ${descriptor.jar}, ${server-local.jar},
-          ${resolver.jar}, ${resolver-spi.jar}, ${resolver-filesystem.jar},
-          ${store.jar}, ${store-xa.jar},
-          ${store-nodepool.jar}, ${store-nodepool-xa.jar}, ${store-stringpool.jar},
-          ${store-stringpool-xa.jar}, ${store-nodepool-memory.jar}, ${resolver-null.jar},
-          ${store-stringpool-memory.jar}, ${util-xa.jar}, ${resolver-file.jar},
-          ${resolver-http.jar}, ${resolver-lucene.jar}, ${resolver-memory.jar},
-          ${resolver-store.jar}, ${resolver-url.jar}, ${resolver-view.jar},
-          ${tuples.jar}, ${tuples-hybrid.jar}, ${content-mp3.jar},
-          ${content-n3.jar}, ${content-mbox.jar}, ${content-rdfxml.jar},
-          ${content-rio.jar}, ${resolver-nodetype.jar}, ${resolver-prefix.jar},
-          ${resolver-xsd.jar}, ${resolver-test.jar}, ${resolver-relational.jar},
-          ${resolver-distributed.jar},
-          ${resolver-jar.jar}, ${dtd.jar}, ${jrdf.base.jar}"/>
-
-      <!-- Schemas -->
-      <zipfileset dir="${basedir}/data" prefix="data"
-          includes="mulgara.rdfs"/>
-
-      <zipfileset dir="${src.docs.dir}" prefix="docs"
-          includes="**/*.html, **/*.htm, **/*.gif, **/*.png, **/*.jpg, **/*.css, **/images/*, **/images/icons/*"/>
-      <zipfileset file="${obj.dir}/mulgara-x-config.xml" prefix="conf" />
-
-      <fileset dir="${obj.dir}/jar/util/classes" includes="**/Bootstrap.class"/>
-      <fileset dir="${src.dir}/jar/dtd" includes="META-INF/**, DTD/**"/>
-
-      <!-- HACK!!!!! -->
-      <!-- This will get the ARP parser working -->
-      <!-- Ignore the xerces DocumentBuilderFactory -->
-      <fileset dir="${obj.dir}/xerces" excludes="META_INF/**"/>
-
-      <!-- HACK!!!!! -->
-
-    </jar>
-
-  </target>
-
-  <!-- do a check for any changes made to the mulgara build -->
-  <!-- potentially not the most efficient checking performed -->
-  <target name="lite-dist-uptodate">
-
-    <uptodate property="dist.lite.uptodate"
-       targetfile="${dist.dir}/${mulgara-lite.jar}">
-
-     <srcfiles dir="${bin.dir}" includes="**/*"/>
-     <srcfiles dir="${conf.dir}" includes="**/*"/>
-     <srcfiles dir="${lib.dir}" includes="**/*"/>
-     <srcfiles dir="${data.dir}" includes="**/*"/>
-     <srcfiles dir="${template.src.docs.dir}" includes="**/*"/>
-    </uptodate>
-  </target>
-
-
-  <!-- =================================================================== -->
-  <!-- Generate the doclet to support custom @-tags in Mulgara javadoc      -->
-  <!-- =================================================================== -->
-  <target name="doclet.jar"
-          depends="javadoc-version, doclet-compile, doclet141-compile">
-
-    <mkdir dir="${bin.dir}"/>
-
-    <jar jarfile="${bin.dir}/doclet.jar">
-      <fileset dir="${obj.dir}/jar/doclet/classes"/>
-    </jar>
-  </target>
-
-  <target name="javadoc-version">
-
-    <condition property="javadoc1.4.1">
-      <contains string="${java.version}" substring="1.4.1"/>
-    </condition>
-  </target>
-
-  <target name="doclet-compile" unless="javadoc1.4.1">
-
-    <mkdir dir="${obj.dir}/jar/doclet/classes"/>
-
-    <javac destdir="${obj.dir}/jar/doclet/classes"
-           classpath="${java.class.path}"
-           debug="on" deprecation="on">
-      <src path="${src.dir}/jar/doclet/java"/>
-    </javac>
-  </target>
-
-  <target name="doclet141-compile" if="javadoc1.4.1">
-
-    <mkdir dir="${obj.dir}/jar/doclet/classes"/>
-
-    <javac destdir="${obj.dir}/jar/doclet/classes"
-           classpath="${java.class.path}"
-           debug="on" deprecation="on">
-      <src path="${src.dir}/jar/doclet141/java"/>
-    </javac>
-  </target>
-
-
-  <!-- =================================================================== -->
-  <!-- Translate XHTML+MathML into printable XHTML                         -->
-  <!-- =================================================================== -->
-  <target name="docs" depends="javadoc-dist,webpage-includes" description="Generate documentation">
-
-    <style basedir="${src.docs.dir}"
-           destdir="${src.docs.dir}"
-           extension="-toc.xml"
-           style="toc.xsl"
-           includes="model.xml"
-           excludes="*-toc.xml"/>
-    <!--
-    <style basedir="${src.docs.dir}"
-           destdir="${src.docs.dir}"
-           style="mathml.xsl"
-           includes="*.xml"/>
-    -->
-  </target>
-
-  <!-- ==================================================================== -->
-  <!-- Formats all source files                                             -->
-  <!-- ==================================================================== -->
-  <target name="format" depends="jalopy">
-
-    <!--
-      Invokes Jalopy as follows:
-
-      - All formatted files will have unix fileformat (\n)
-      - Load your code convention from the given url
-      - Override the convention to use the file history feature
-      - Override the convention to use alder32 checksums of files for history testing
-      - Override the convention to use loglevel "info"
-      - Override the convention to use 2 threads
-      - The import optimization feature will work (if enabled in the active
-        convention), because a classpath reference is specified
-
-        Don't forget to setup an include pattern as Jalopy truly expects
-        valid Java source files as input!
-      -->
-    <jalopy fileformat="unix"
-            convention="${src.dir}/mulgara.xml"
-            history="file"
-            historymethod="adler32"
-            loglevel="info"
-            threads="2"
-            classpathref="project-classpath">
-
-      <fileset dir="${src.dir}">
-        <include name="**/*.java" />
-      </fileset>
-    </jalopy>
-  </target>
-
-  <!-- ================================================================== -->
-  <!-- Prints help information                                            -->
-  <!-- ================================================================== -->
-  <target name="help" description="Print this help message">
-    <echo message="Welcome to the build script for the ${description}"/>
-    <echo message="These targets can be invoked as follows:"/>
-    <echo message="  ./build.sh &lt;target&gt;"/>
-    <echo message=""/>
-    <java fork="false" classname="org.apache.tools.ant.Main"
-          newenvironment="false">
-      <jvmarg value="${arch.bits}"/>
-      <arg line="-buildfile build.xml -projecthelp"/>
-    </java>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Generates all javadoc for the project                               -->
-  <!-- =================================================================== -->
-  <target name="javadoc"
-    depends="javadoc-uptodate, javadoc-overview.html,
-             ant-task-jar, client-jrdf-jar, config-jar,
-             content-mbox-jar, content-mp3-jar,
-             content-n3-jar, content-rdfxml-jar, content-rio-jar,
-             itql-jar, sparql-int-jar,
-             doclet.jar, jrdf-jar, store-jar,
-             store-xa-jar,
-             store-nodepool-jar, store-nodepool-memory-jar,
-             store-nodepool-xa-jar, query-jar,
-             resolver-jar, resolver-null-jar, resolver-file-jar, resolver-filesystem-jar,
-             resolver-http-jar, resolver-lucene-jar, resolver-memory-jar,
-             resolver-spi-jar, resolver-store-jar,
-             resolver-url-jar, resolver-view-jar, resolver-xsd-jar,
-             resolver-test-jar,
-             server-jar, server-beep-jar, server-rmi-jar,
-             sofa-jar, krule-jar, rules-jar, sparql-protocol-jar,
-             store-stringpool-jar,
-             store-stringpool-memory-jar, store-stringpool-xa-jar,
-             tuples-jar, tuples-hybrid-jar, util-jar, util-xa-jar, webui-war"
-    unless="javadoc-uptodate"
-    description="Creates the project javadoc">
-    <delete dir="${javadoc.dir}"/>
-    <mkdir dir="${javadoc.dir}"/>
-    <javadoc destdir="${javadoc.dir}"
-        packagenames="org.mulgara.ant.*,
-                      org.mulgara.barracuda.*,
-                      org.mulgara.beep.*,
-                      org.mulgara.client.*,
-                      org.mulgara.config,
-                      org.mulgara.content.*,
-                      org.mulgara.connection.*,
-                      org.mulgara.driver.*,
-                      org.mulgara.extractor.tag,
-                      org.mulgara.itql,
-                      org.mulgara.jrdf,
-                      org.mulgara.local.*,
-                      org.mulgara.query.*,
-                      org.mulgara.rdf,
-                      org.mulgara.resolver.*,
-                      org.mulgara.rmi.*,
-                      org.mulgara.server.*,
-                      org.mulgara.sofa.*,
-                      org.mulgara.krule.*,
-                      org.mulgara.rules.*,
-                      org.mulgara.sparql.*,
-                      org.mulgara.store.*,
-                      org.mulgara.store.graph.*,
-                      org.mulgara.store.graph.xa.*,
-                      org.mulgara.store.jxunit.*,
-                      org.mulgara.store.loader.*,
-                      org.mulgara.store.nodepool.*,
-                      org.mulgara.store.nodepool.memory.*,
-                      org.mulgara.store.nodepool.xa.*,
-                      org.mulgara.store.stringpool.*,
-                      org.mulgara.store.stringpool.memory.*,
-                      org.mulgara.store.stringpool.xa.*,
-                      org.mulgara.store.tuples.*,
-                      org.mulgara.store.xa.*,
-                      org.mulgara.webui.*,
-                      org.mulgara.util,
-                      org.mulgara.xml.*"
-        private="true"
-        overview="${obj.dir}/docs/overview.html"
-        windowtitle="${description} ${mulgara-version} API"
-        doctitle="${description} ${mulgara-version} API"
-        version="true"
-        use="true"
-        bottom="Copyright &amp;copy; ${year} Tucana Technologies, Inc. (http://www.tucanatech.com/)."
-        author="true"
-        additionalParam="-breakiterator -source 1.5">
-      <tag name="company" description="Company:"/>
-      <tag name="copyright" description="Copyright:"/>
-      <tag name="created" description="Creation date:"/>
-      <tag name="licence" description="Licence:"/>
-      <taglet name="org.mulgara.doclet.MaintenanceAuthorTaglet"
-        path="${bin.dir}/doclet.jar"/>
-      <taglet name="org.mulgara.doclet.ModifiedTaglet"
-        path="${bin.dir}/doclet.jar"/>
-      <taglet name="org.mulgara.doclet.VersionTaglet"
-        path="${bin.dir}/doclet.jar"/>
-      <classpath refid="project-classpath"/>
-      <classpath path="${lib.dir}/antlr.jar"/>
-      <classpath path="${lib.dir}/barracuda-1.2.6.jar"/>
-      <classpath path="${lib.dir}/beepcore-0.9.08.jar"/>
-      <classpath path="${lib.dir}/javax.servlet-2.3.jar"/>
-      <classpath path="${lib.dir}/${jid3.jar}"/>
-      <classpath path="${lib.dir}/jsr173_07_api.jar"/>
-      <classpath path="${lib.dir}/${lucene.jar}"/>
-      <classpath path="${lib.dir}/${sofa.jar}"/>
-      <classpath path="${lib.dir}/xmlc-all-runtime-2.2.jar"/>
-      <classpath path="${lib.dir}/xom-1.0d21.jar"/>
-      <sourcepath path="${ant-task.src.dir}/java"/>
-      <sourcepath path="${client-jrdf.src.dir}/java"/>
-      <sourcepath path="${content-mp3.src.dir}/java"/>
-      <sourcepath path="${content-n3.src.dir}/java"/>
-      <sourcepath path="${content-rdfxml.src.dir}/java"/>
-      <sourcepath path="${content-rio.src.dir}/java"/>
-      <sourcepath path="${driver.src.dir}/java"/>
-      <sourcepath path="${dtd.src.dir}/java"/>
-      <sourcepath path="${itql.src.dir}/java"/>
-      <sourcepath path="${jrdf.src.dir}/java"/>
-      <sourcepath path="${krule.src.dir}/java"/>
-      <sourcepath path="${rules.src.dir}/java"/>
-      <sourcepath path="${query.src.dir}/java"/>
-      <!--sourcepath path="${rdql.src.dir}/java"/-->
-      <sourcepath path="${resolver.src.dir}/java"/>
-      <sourcepath path="${resolver-null.src.dir}/java"/>
-      <sourcepath path="${resolver-file.src.dir}/java"/>
-      <sourcepath path="${resolver-filesystem.src.dir}/java"/>
-      <sourcepath path="${resolver-jar.src.dir}/java"/>
-      <sourcepath path="${resolver-http.src.dir}/java"/>
-      <sourcepath path="${resolver-lucene.src.dir}/java"/>
-      <sourcepath path="${resolver-url.src.dir}/java"/>
-      <sourcepath path="${resolver-memory.src.dir}/java"/>
-      <sourcepath path="${resolver-spi.src.dir}/java"/>
-      <sourcepath path="${resolver-store.src.dir}/java"/>
-      <sourcepath path="${resolver-view.src.dir}/java"/>
-      <sourcepath path="${resolver-xsd.src.dir}/java"/>
-      <sourcepath path="${resolver-test.src.dir}/java"/>
-      <sourcepath path="${server.src.dir}/java"/>
-      <sourcepath path="${server-beep.src.dir}/java"/>
-      <sourcepath path="${server-rmi.src.dir}/java"/>
-      <sourcepath path="${sofa.src.dir}/java"/>
-      <sourcepath path="${sparql-protocol.src.dir}/java"/>
-      <sourcepath path="${sparql-int.src.dir}/java"/>
-      <sourcepath path="${store.src.dir}/java"/>
-      <sourcepath path="${store-xa.src.dir}/java"/>
-      <sourcepath path="${store-nodepool.src.dir}/java"/>
-      <sourcepath path="${store-nodepool-memory.src.dir}/java"/>
-      <sourcepath path="${store-nodepool-xa.src.dir}/java"/>
-      <sourcepath path="${store-stringpool.src.dir}/java"/>
-      <sourcepath path="${store-stringpool-memory.src.dir}/java"/>
-      <sourcepath path="${store-stringpool-xa.src.dir}/java"/>
-      <sourcepath path="${tuples.src.dir}/java"/>
-      <sourcepath path="${tuples-hybrid.src.dir}/java"/>
-      <sourcepath path="${util.src.dir}/java"/>
-      <sourcepath path="${util-xa.src.dir}/java"/>
-      <sourcepath path="${webui.src.dir}/java"/>
-      <sourcepath path="${obj.dir}/jar/config/java"/>
-      <sourcepath path="${obj.dir}/jar/itql/java"/>
-      <sourcepath path="${obj.dir}/jar/query/java"/>
-      <!--sourcepath path="${obj.dir}/jar/rdql/java"/-->
-      <sourcepath path="${obj.dir}/jar/util/java"/>
-      <sourcepath path="${obj.dir}/war/webui/java"/>
-      <link href="${j2ee.javadoc}"/>
-      <link href="${java.javadoc}"/>
-      <link href="${jrdf.javadoc}"/>
-    </javadoc>
-  </target>
-
-  <target name="javadoc-dist"
-          if="distjavadoc">
-
-    <antcall target="create-javadoc"/>
-  </target>
-
-  <!-- If and depends are not compatible so we have to approach javadoc in
-       two steps -->
-  <target name="create-javadoc"
-          depends="javadoc-uptodate, javadoc-overview.html, doclet.jar,
-                   ant-task-javadoc,
-                   client-jrdf-javadoc,
-                   content-mbox-javadoc,
-                   content-mp3-javadoc, content-n3-javadoc,
-                   content-rdfxml-javadoc, content-rio-javadoc,
-                   descriptor-javadoc, driver-javadoc, dtd-javadoc,
-                   itql-javadoc, sparql-int-javadoc,
-                   store-javadoc, store-xa-javadoc,
-                   store-nodepool-javadoc,
-                   store-nodepool-memory-javadoc, jrdf-javadoc,
-                   store-nodepool-xa-javadoc, query-javadoc,
-                   resolver-filesystem-javadoc, resolver-null-javadoc,
-                   resolver-file-javadoc, resolver-http-javadoc,
-                   resolver-lucene-javadoc, resolver-memory-javadoc,
-                   resolver-spi-javadoc, resolver-distributed-javadoc,
-                   resolver-store-javadoc, resolver-url-javadoc, resolver-view-javadoc,
-                   resolver-nodetype-javadoc, resolver-prefix-javadoc, resolver-xsd-javadoc,
-                   resolver-test-javadoc, resolver-javadoc, resolver-relational-javadoc,
-                   server-beep-javadoc, server-http-javadoc,
-                   server-local-javadoc, server-rmi-javadoc, server-javadoc,
-                   sofa-javadoc, rules-javadoc, krule-javadoc,
-                   store-stringpool-javadoc,
-                   store-stringpool-memory-javadoc, store-stringpool-xa-javadoc,
-                   tag-javadoc, tuples-hybrid-javadoc, tuples-javadoc,
-                   util-xa-javadoc, util-javadoc"
-      unless="javadoc.uptodate"
-      description="creates project javadoc documentation">
-  </target>
-
-  <target name="javadoc-overview.html">
-
-    <style in    ="build.xml"
-           style ="docs/overview.xsl"
-           out   ="${obj.dir}/docs/overview.html"/>
-  </target>
-
-  <target name="javadoc-uptodate">
-
-    <uptodate property="javadoc.uptodate"
-        targetfile="${javadoc.dir}/package-list">
-
-      <srcfiles dir="${src.dir}" includes="**/*.java, **/package.html"/>
-      <srcfiles dir="docs" includes="overview.xsl"/>
-    </uptodate>
-  </target>
-
-  <target name="jrdf-example" description="Runs the JRDF memory example">
-
-     <java classname="org.jrdf.graph.mem.JRDFExample" fork="no" failonerror="yes"
-        jvm="${java.home}/bin/java" dir="${basedir}">
-
-        <jvmarg value="${arch.bits}"/>
-
-        <classpath>
-            <pathelement path="${lib.dir}/${jrdf.jar}"/>
-        </classpath>
-      </java>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Create config file for Log4J for each developer                     -->
-  <!-- =================================================================== -->
-  <target name="log4j-conf.xml">
-
-    <copy file="${conf.dir}/log4j-template.xml"
-      tofile="${basedir}/log4j-conf.xml"/>
-  </target>
-
-  <target name="model.html">
-
-    <style basedir="${template.src.docs.dir}"
-           destdir="${template.src.docs.dir}"
-           style="mathml.xsl"
-           includes="model.xml"/>
-  </target>
-
-
-  <!-- =================================================================== -->
-  <!-- Create JAR for use as the RMI codebase                              -->
-  <!-- =================================================================== -->
-  <target name="rmi-jar"
-          depends="query-jar, driver-jar, server-jar, util-jar,
-                   rmi-jar-uptodate"
-          unless="rmi.jar.uptodate">
-
-    <jar jarfile="${bin.dir}/${rmi.jar}">
-
-      <fileset dir="${obj.dir}/jar/query/classes"/>
-      <fileset dir="${obj.dir}/jar/driver/classes"/>
-      <fileset dir="${obj.dir}/jar/server/classes"/>
-      <fileset dir="${obj.dir}/jar/util/classes"/>
-    </jar>
-  </target>
-
-  <target name="rmi-jar-uptodate">
-
-    <uptodate property="rmi.jar.uptodate"
-              targetfile="${bin.dir}/${rmi.jar}">
-
-      <srcfiles dir="${obj.dir}/jar/query/classes" includes="**/*"/>
-      <srcfiles dir="${obj.dir}/jar/driver/classes" includes="**/*"/>
-      <srcfiles dir="${obj.dir}/jar/server/classes" includes="**/*"/>
-      <srcfiles dir="${obj.dir}/jar/util/classes" includes="**/*"/>
-    </uptodate>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Starts the iTQL command line tool                                   -->
-  <!-- =================================================================== -->
-  <target name="run-itql" depends="itql-dist, uri">
-
-    <java classname="org.mulgara.itql.ItqlSession"
-          failonerror="yes">
-
-      <jvmarg value="${arch.bits}"/>
-
-      <sysproperty key="java.io.tmpdir" value="${tmp.dir}"/>
-      <sysproperty key="log4j.configuration"
-                   value="${baseuri}/conf/log4j-tql.xml"/>
-
-      <classpath>
-
-        <pathelement path="${bin.dir}/${query.jar}"/>
-        <pathelement path="${bin.dir}/${driver.jar}"/>
-        <pathelement path="${bin.dir}/${itql.jar}"/>
-        <pathelement path="${bin.dir}/${rules.jar}"/>
-        <pathelement path="${bin.dir}/${server.jar}"/>
-        <pathelement path="${bin.dir}/${server-http.jar}"/>
-        <pathelement path="${bin.dir}/${server-local.jar}"/>
-        <pathelement path="${bin.dir}/${server-rmi.jar}"/>
-        <pathelement path="${bin.dir}/${server-beep.jar}"/>
-        <pathelement path="${bin.dir}/${util.jar}"/>
-
-        <fileset dir="${lib.dir}"
-                 includes="activation*.jar, beepcore-*.jar, jargs-*.jar,
-                           icu4j.jar, jena*.jar, antlr*.jar,
-                           ${commons-logging.jar}, log4j*.jar, lucene*.jar,
-                           xerces*.jar, xmlParserAPIs.jar, ${jrdf.jar},
-                           ${saaj.jar}"/>
-      </classpath>
-    </java>
-
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Starts multiple embedded Mulgara servers                             -->
-  <!-- =================================================================== -->
-  <target name="start-instance"
-     description="Starts an embedded Mulgara server">
-
-    <echo>
-      Starting embedded Mulgara ${server.instance} server on ${os.name} with
-      output to ${dist.dir}/mulgara-output-${server.instance}
-    </echo>
-
-    <!-- create a temporary directory for this server instance -->
-    <mkdir dir="${tmp.dir}/${server.instance}"/>
-
-    <!-- prepare a log4j file for server instance -->
-    <copy file="${conf.dir}/log4j-instance.xml"
-      tofile="${dist.dir}/log4j-instance-${server.instance}.xml"/>
-
-    <replace file="${dist.dir}/log4j-instance-${server.instance}.xml"
-       token="@server.instance@" value="${server.instance}"/>
-
-    <exec os="Linux" executable="${scripts.dir}/bg.linux" failonerror="yes">
-
-      <arg value="-o"/>
-      <arg value="${dist.dir}/mulgara-output-${server.instance}"/>
-      <arg value="${java.home}/bin/java"/>
-      <arg line="-Djava.io.tmpdir=&quot;${tmp.dir}/${server.instance}&quot;"/>
-      <arg line="-Dshutdownhook.port=689${server.instance}"/>
-      <arg value="-jar"/>
-      <arg value="${dist.dir}/${mulgara.version.to.run}"/>
-      <arg value="-a"/>
-      <arg value="${test.dir}"/>
-      <arg value="-s"/>
-      <arg value="server${server.instance}"/>
-      <arg value="-p"/>
-      <arg value="808${server.instance}"/>
-      <arg value="-l"/>
-      <arg value="file:${dist.dir}/log4j-instance-${server.instance}.xml"/>
-    </exec>
-
-    <exec os="SunOS" executable="${scripts.dir}/bg.sh" failonerror="yes">
-
-      <arg value="-o"/>
-      <arg value="${dist.dir}/mulgara-output-${server.instance}"/>
-      <arg value="${java.home}/bin/java"/>
-      <arg value="${arch.bits}"/>
-      <arg line="-Djava.io.tmpdir=&quot;${tmp.dir}/${server.instance}&quot;"/>
-      <arg line="-Dshutdownhook.port=689${server.instance}"/>
-      <arg value="-jar"/>
-      <arg value="${dist.dir}/${mulgara.version.to.run}"/>
-      <arg value="-a"/>
-      <arg value="${test.dir}"/>
-      <arg value="-s"/>
-      <arg value="server${server.instance}"/>
-      <arg value="-p"/>
-      <arg value="808${server.instance}"/>
-      <arg value="-l"/>
-      <arg value="file:${dist.dir}/log4j-instance-${server.instance}.xml"/>
-    </exec>
-
-    <exec os="Mac OS X" executable="${scripts.dir}/bg.sh" failonerror="yes">
-
-      <arg value="-o"/>
-      <arg value="${dist.dir}/mulgara-output-${server.instance}"/>
-      <arg value="${java.home}/bin/java"/>
-      <arg line="-Djava.io.tmpdir=&quot;${tmp.dir}/${server.instance}&quot;"/>
-      <arg line="-Dshutdownhook.port=689${server.instance}"/>
-      <arg value="-jar"/>
-      <arg value="${dist.dir}/${mulgara.version.to.run}"/>
-      <arg value="-a"/>
-      <arg value="${test.dir}"/>
-      <arg value="-s"/>
-      <arg value="server${server.instance}"/>
-      <arg value="-p"/>
-      <arg value="808${server.instance}"/>
-      <arg value="-l"/>
-      <arg value="file:${dist.dir}/log4j-instance-${server.instance}.xml"/>
-    </exec>
-
-    <exec os="Windows NT,Windows 2000,Windows XP, Windows 2003" executable="${scripts.dir}\bg.exe"
-        failonerror="yes">
-
-      <arg value="-o"/>
-      <arg value="${dist.dir}/mulgara-output-${server.instance}"/>
-      <arg value="${java.home}/bin/java"/>
-      <arg line="-Djava.io.tmpdir=&quot;${tmp.dir}/${server.instance}&quot;"/>
-      <arg line="-Dshutdownhook.port=689${server.instance}"/>
-      <arg value="-jar"/>
-      <arg value="${dist.dir}/${mulgara.version.to.run}"/>
-      <arg value="-a"/>
-      <arg value="${test.dir}"/>
-      <arg value="-s"/>
-      <arg value="server${server.instance}"/>
-      <arg value="-p"/>
-      <arg value="808${server.instance}"/>
-      <arg value="-l"/>
-      <arg value="&quot;file:/${dist.dir}/log4j-instance-${server.instance}.xml&quot;"/>
-    </exec>
-
-    <!-- wait for the server to start -->
-    <antcall target="await">
-      <param name="shutdownhook.port" value="689${server.instance}"/>
-    </antcall>
-  </target>
-
-
-  <!-- Run full dist of Mulgara by default unless other (lite) is set -->
-  <target name="set-version-to-run" unless="mulgara.version.to.run.jar">
-
-    <property name="mulgara.version.to.run" value="${mulgara.jar}"/>
-  </target>
-
-
-  <!-- =================================================================== -->
-  <!-- Starts an embedded Mulgara server with profiling (from OptimizeIt)      -->
-  <!-- =================================================================== -->
-  <target name="start-profiled" depends="dist"
-      description="Starts an embedded Mulgara server with profiling (from OptimizeIt)">
-
-    <echo>
-      Starting embedded Mulgara server with profiling (from OptimizeIt) with output to
-      ${dist.dir}/mulgara-output
-    </echo>
-
-    <exec executable="${mulgara-profiled}" failonerror="yes">
-
-      <env key="Mulgara_DIR" path="${dist.dir}"/>
-
-      <arg value="start"/>
-    </exec>
-
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Starts two embedded Mulgara servers                                     -->
-  <!-- =================================================================== -->
-  <target name="start-twoservers"
-      depends="dist, lite-dist, set-version-to-run"
-      description="Starts two embedded Mulgara servers">
-
-    <echo>
-      Starting two embedded Mulgara servers with output to
-      ${dist.dir}/mulgara-output
-    </echo>
-
-    <antcall target="start-instance">
-      <param name="server.instance" value="1"/>
-    </antcall>
-
-    <antcall target="start-instance">
-      <param name="server.instance" value="2"/>
-    </antcall>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Add the required JARs into the Web Services war file                -->
-  <!-- =================================================================== -->
-  <target name="webservices-war"
-          depends="descriptor-jar, descriptor-add-to-war-dir,
-                   webservices-war-uptodate"
-          unless="webservices.war.uptodate"
-          description="Adds the required jars into the webservices.war file">
-
-    <mkdir dir="${obj.dir}/war/web-services"/>
-
-    <copy todir="${obj.dir}/war/web-services/WEB-INF">
-      <fileset dir="${webservices.src.dir}/WEB-INF" includes="*"/>
-    </copy>
-
-    <replace file="${obj.dir}/war/web-services/WEB-INF/web.xml"
-       token="@@hostname@@" value="${host.name}"/>
-
-    <war warfile="${obj.dir}/war/webservices.war"
-         basedir="${obj.dir}/war/web-services"
-         webxml="${obj.dir}/war/web-services/WEB-INF/web.xml"
-         excludes="WEB-INF/web.xml">
-
-        <!-- AXIS WSDD FILE -->
-        <webinf dir="${webservices.src.dir}/WEB-INF/" includes="server-config.wsdd"/>
-
-        <!-- descriptors -->
-
-        <!-- pre compiled jsps -->
-        <classes dir="${descriptor.war.obj.dir}/classes"
-          includes="**/*.class"/>
-
-        <fileset dir="${obj.dir}/war/"
-          includes="descriptor/descriptors/**/*.xsl"/>
-        <fileset dir="${src.dir}/war/"
-          includes="descriptor/**/*.html, descriptor/**/*.css, descriptor/**/*.jsp"/>
-        <fileset dir="${src.dir}/war/"
-          includes="descriptor/images/**"/>
-        <fileset dir="${src.dir}/war/"
-          includes="descriptor/tutorial/**"/>
-        <fileset dir="${src.dir}/war/"
-          includes="descriptor/examples/**"/>
-        <fileset dir="${src.dir}/war/"
-          includes="descriptor/examples/vcard/**"/>
-
-        <!-- 3rd party -->
-        <lib dir="${lib.dir}" includes="bsf.jar"/>
-        <lib dir="${lib.dir}" includes="js.jar"/>
-
-      </war>
-   </target>
-
-  <!-- =================================================================== -->
-  <!-- Check if the webservices.war file is uptodate                       -->
-  <!-- =================================================================== -->
-   <target name="webservices-war-uptodate">
-
-    <uptodate property="webservices.war.uptodate"
-        targetfile="${obj.dir}/war/webservices.war">
-      <srcfiles dir="${obj.dir}/war/web-services" includes="**/*"/>
-    </uptodate>
-   </target>
-
-  <!-- =================================================================== -->
-  <!-- Stops an embedded Mulgara instance                                   -->
-  <!-- =================================================================== -->
-  <target name="stop-instance" depends="set-version-to-run" description="Stops an embedded Mulgara server">
-
-    <echo message="Stopping embedded Mulgara server instance ${server.instance}"/>
-
-    <java jar="${dist.dir}/${mulgara.version.to.run}" fork="true" failonerror="true">
-
-      <sysproperty key="java.io.tmpdir" value="${tmp.dir}"/>
-      <sysproperty key="shutdownhook.port" value="689${server.instance}"/>
-
-      <jvmarg value="${arch.bits}"/>
-
-      <arg value="-x"/>
-    </java>
-
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Stops two embedded Mulgara servers                                      -->
-  <!-- =================================================================== -->
-  <target name="stop-twoservers" description="Stops the two embedded Mulgara servers">
-
-    <!-- shutdown servers in reverse order. First has the RMI registry -->
-    <echo message="Stopping Mulgara instance servers"/>
-
-    <antcall target="stop-instance">
-      <param name="server.instance" value="2"/>
-    </antcall>
-
-    <antcall target="stop-instance">
-      <param name="server.instance" value="1"/>
-    </antcall>
-
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Unpack, filter and preen test data                                  -->
-  <!-- =================================================================== -->
-  <target name="test-data">
-
-    <filter token="basedir" value="${basedir}"/>
-
-    <copy todir="${test.dir}" filtering="yes">
-      <fileset dir="data" includes="*.itql"/>
-    </copy>
-
-    <mkdir dir="${test.dir}/RDF-Test-Cases"/>
-
-    <unzip src="data/RDF-Test-Cases-2001-09-12.zip" dest="${test.dir}/RDF-Test-Cases"/>
-
-    <mkdir dir="${test.dir}/RDQL"/>
-
-    <unzip src="data/rdql-tests-jena-2.0.zip" dest="${test.dir}/RDQL"/>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Stress test - performs itql query stress tests                      -->
-  <!-- =================================================================== -->
-
-  <target name="stress-test"
-          depends="itql-jar, uri"
-          description="run stress tests the ItqlInterpreterBean">
-
-    <java classname="org.mulgara.itql.ItqlInterpreterStressTest" fork="yes" failonerror="no"
-      jvm="${java.home}/bin/java" dir="${basedir}">
-
-      <jvmarg value="${arch.bits}"/>
-
-      <sysproperty key="java.io.tmpdir" value="${tmp.dir}"/>
-      <sysproperty key="org.mulgara.xml.ResourceDocumentBuilderFactory"
-        value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
-      <sysproperty key="java.naming.factory.initial"
-        value="com.sun.jndi.rmi.registry.RegistryContextFactory"/>
-      <sysproperty key="java.naming.provider.url" value="rmi://localhost"/>
-      <sysproperty key="java.rmi.server.codebase"
-        value="${bin.uri}/${rmi.jar}"/>
-      <sysproperty key="cvs.root" value="${basedir}"/>
-      <sysproperty key="log4j.configuration"
-        value="${baseuri}/log4j-conf.xml"/>
-
-      <!-- JUnitPP settings -->
-      <arg line="-r 1000 -w 10000 -wm 2000 -s 100 -t 5000 -ra 5000 -f itql.commands"/>
-
-      <classpath>
-
-        <path refid="query-classpath"/>
-
-        <fileset dir="${bin.dir}" includes="${dtd.jar}, ${itql.jar}, ${rules.jar}, ${query.jar},
-                 ${driver.jar}, ${rmi.jar}, ${server-rmi.jar}"/>
-        <fileset dir="${lib.dir}" includes="xerces*.jar, xmlParserAPIs.jar, jxunit*.jar, junit.jar, junitpp.jar"/>
-      </classpath>
-
-    </java>
-   </target>
-
-  <!-- =================================================================== -->
-  <!-- Runs regression tests on a Mulgara server                               -->
-  <!-- =================================================================== -->
-  <!--target name="regression-test"
-    depends="-prepare-build, log4j-conf.xml, dist"
-    description="Runs regression tests on a Mulgara server">
-
-    <echo message="mulgara-test has not been implemented, run itql-test or dbms-test instead."/-->
-
-    <!-- Set timestamp for CruiseControl's benefit -->
-    <!--tstamp/>
-
-    <delete dir="${mulgara.results.tmpdir}"/>
-    <mkdir dir="${mulgara.results.tmpdir}"/>
-    <delete file="${mulgara.results}"/-->
-
-    <!-- start a server -->
-    <!--ant target="start"/-->
-
-    <!-- run the tests -->
-
-    <!-- stop the server -->
-    <!--ant target="stop"/>
-
-  </target-->
-
-
-  <!-- =================================================================== -->
-  <!-- Builds Mulgara Semantic Store (Mulgara) WAR                           -->
-  <!-- =================================================================== -->
-  <target name="mulgara-war"
-      description="Builds the Mulgara Semantic Store (Mulgara) WAR"
-      depends="driver-jar, itql-jar, sparql-int-jar, query-jar, rmi-jar, server-jar,
-      server-beep-jar, server-rmi-jar, util-jar, config-jar, descriptor-jar, dtd-compile,
-      set.host.name, mulgara.war-uptodate"
-      unless="mulgara.war-uptodate">
-
-    <copy file="${mulgara.war.src.dir}/WEB-INF/web.xml"
-      tofile="${obj.dir}/war/mulgara/WEB-INF/web.xml"/>
-
-    <replace file="${obj.dir}/war/mulgara/WEB-INF/web.xml"
-       token="@@hostname@@" value="${host.name}"/>
-
-    <delete file="${bin.dir}/${mulgara.war}"/>
-
-    <war warfile="${bin.dir}/${mulgara.war}"
-        webxml="${obj.dir}/war/mulgara/WEB-INF/web.xml">
-
-      <zipfileset dir="${conf.dir}" prefix="WEB-INF/conf"
-          includes="mulgara-config-war.xml, mulgara-rmi.policy, mulgara.policy,
-          log4j-mulgara-war.properties, expires.txt"/>
-
-      <fileset dir="${src.dir}/war/mulgara"
-          includes="WEB-INF/**" excludes="WEB-INF/web.xml"/>
-
-      <lib dir="${lib.dir}" includes="log4j-core-*.jar, icu4j.jar, jena-*.jar, antlr*.jar, beepcore-*.jar,
-          lucene*.jar, apache-soap-*.jar, ${jrdf.jar}, ${date-utils.jar}, ${commons-logging.jar}"/>
-      <lib dir="${bin.dir}" includes="${query.jar},
-        ${driver.jar}, ${itql.jar}, ${sparql-int.jar}, ${rules.jar}, ${rmi.jar},
-          ${server.jar}, ${server-beep.jar}, ${server-rmi.jar},
-          ${util.jar}, ${config.jar}"/>
-      <lib dir="${dist.dir}" includes="expires.txt"/>
-    </war>
-  </target>
-
-  <target name="mulgara.war-uptodate">
-
-    <uptodate property="mulgara.war-uptodate"
-       targetfile="${bin.dir}/${mulgara.war}">
-
-      <srcfiles dir="${bin.dir}" includes="${query.jar},
-          ${driver.jar}, ${itql.jar}, ${rules.jar}, ${rmi.jar},
-          ${sparql-int.jar},
-          ${server.jar}, ${server-beep.jar}, ${server-rmi.jar},
-          ${util.jar}, ${config.jar}, ${descriptor.jar}"/>
-      <srcfiles dir="${dist.dir}" includes="expires.txt"/>
-      <srcfiles dir="${conf.dir}" includes="**/*"/>
-      <srcfiles dir="${src.dir}/war/mulgara" includes="WEB-INF/**"
-                                         excludes="WEB-INF/web.xml"/>
-      <srcfiles dir="${mulgara.war.src.dir}/WEB-INF" includes="web.xml"/>
-    </uptodate>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Compiles the Mulgara webui interface pages with XMLC                    -->
-  <!-- =================================================================== -->
-  <target name="webui-xmlc" depends="xmlc"
-      description="Compiles the Mulgara webui interface pages with XMLC">
-
-    <!-- Build the webui interface classes -->
-    <mkdir dir="${obj.dir}/war/webui/java"/>
-
-    <!-- build the webui interface classes -->
-    <xmlc sourceout="${obj.dir}/war/webui/java"
-          includes="**/*.html"
-          markup="HTML"
-          verbose="false"
-          force="no"
-          srcdir="${webui.src.dir}/template-html"/>
-  </target>
-
-
-  <!-- =================================================================== -->
-  <!-- Compiles the Mulgara webui interface classes                            -->
-  <!-- =================================================================== -->
-  <target name="webui-build" depends="webui-xmlc, eventbuilder, driver-dist"
-      description="Compiles the Mulgara webui interface classes">
-
-    <!-- Build the webui interface classes -->
-    <mkdir dir="${obj.dir}/war/webui/classes"/>
-    <mkdir dir="${obj.dir}/war/webui/xlib"/>
-
-    <!-- Event class generation - also compiles the XMLC generated classes -->
-    <eventbuilder sourceout="${obj.dir}/war/webui/java"
-        descriptor="${webui.viewer.src.dir}/events/events.xml">
-    </eventbuilder>
-
-    <javac srcdir="${obj.dir}/war/webui/java"
-     destdir="${obj.dir}/war/webui/classes"
-     debug="${debug}" deprecation="on">
-      <classpath refid="webui.classpath"/>
-    </javac>
-
-    <javac srcdir="${webui.src.dir}/java"
-        destdir="${obj.dir}/war/webui/classes"
-        debug="${debug}" deprecation="on">
-      <classpath refid="webui.classpath"/>
-    </javac>
-
-    <!-- Example queries and directives -->
-    <copy todir="${obj.dir}/war/webui/classes" >
-
-      <fileset dir="${webui.src.dir}/java" >
-
-        <include name="**/*.txt"/>
-        <include name="**/*.directives"/>
-      </fileset>
-    </copy>
-
-    <!-- images -->
-    <copy todir="${obj.dir}/war/webui/xlib" >
-
-      <fileset dir="${webui.src.dir}/template-html/org/mulgara/webui/viewer" >
-
-        <exclude name="**/*.html"/>
-        <exclude name="**/*.xmlc"/>
-      </fileset>
-    </copy>
-
-    <!-- Replace tokens in example queries - leave out the <> brackets-->
-    <!-- The name of the model to work on -->
-    <replace file="${obj.dir}/war/webui/classes/org/mulgara/webui/viewer/ExampleQueries.txt"
-       token="@@model-uri@@" value="rmi://host.name/server1#sampledata"/>
-    <replace file="${obj.dir}/war/webui/classes/org/mulgara/webui/viewer/ExampleQueries.txt"
-       token="@@data-dir@@" value="jar:file:mulgara.jar.path!/data"/>
-
-  </target>
-
-
-  <!-- =================================================================== -->
-  <!-- Builds the Mulgara webui interface WAR                                  -->
-  <!-- =================================================================== -->
-  <target name="webui-war" depends="webui-build, -webui-war-uptodate"
-      description="Builds the Mulgara webui interface WAR" unless="webui.war-uptodate">
-
-    <mkdir dir="${obj.dir}/war/webui/jars"/>
-
-    <!-- Actual page classes -->
-    <jar jarfile="${obj.dir}/war/webui/jars/${webui-screens.jar}">
-      <fileset dir="${obj.dir}/war/webui/classes" includes="org/mulgara/webui/**/*HTML.class"/>
-    </jar>
-
-    <!-- Images and stylesheet - swap this jar to change badging -->
-    <jar jarfile="${obj.dir}/war/webui/jars/${webui-resources.jar}"
-      basedir="${obj.dir}/war/webui/" includes="xlib/**"/>
-
-    <!-- Barracuda related classes -->
-    <jar jarfile="${obj.dir}/war/webui/jars/${webui-barracuda.jar}"
-      basedir="${obj.dir}/war/webui/classes"
-      includes="org/mulgara/barracuda/**"/>
-
-    <!-- Logic -->
-    <jar jarfile="${obj.dir}/war/webui/jars/${webui-logic.jar}"
-      basedir="${obj.dir}/war/webui/classes"
-      includes="org/mulgara/webui/**"
-      excludes="**/*HTML.class"/>
-
-    <war warfile="${bin.dir}/${webui.war}"
-      webxml="${webui.src.dir}/WEB-INF/web.xml">
-
-      <fileset dir="${webui.src.dir}/content"/>
-      <fileset dir="${webui.src.dir}"
-        includes="WEB-INF/**" excludes="WEB-INF/web.xml"/>
-
-      <lib dir="${lib.dir}" includes="xmlc-all*.jar, *barracuda*.jar, plankton*.jar"/>
-      <lib dir="${obj.dir}/war/webui/jars" includes="*.jar"/>
-    </war>
-  </target>
-
-  <target name="-webui-war-uptodate">
-
-     <uptodate property="webui.war-uptodate" targetfile="${bin.dir}/${webui.war}">
-
-       <srcfiles dir="${dist.dir}" includes="${driver.jar}"/>
-       <srcfiles dir="${obj.dir}/war/webui/jars" includes="*.jar"/>
-       <srcfiles dir="${obj.dir}/war/webui/classes"/>
-     </uptodate>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- J2EE resource adapter                                               -->
-  <!-- =================================================================== -->
-  <target name="mulgara-rar" depends="driver-jar, query-jar">
-
-    <jar jarfile="${bin.dir}/mulgara.rar">
-
-      <fileset dir="${src.dir}/rar/mulgara" includes="META-INF/ra.xml"/>
-      <fileset dir="${src.dir}/rar/mulgara/content"/>
-      <fileset dir="${bin.dir}" includes="${driver.jar}, ${query.jar}"/>
-      <fileset dir="${lib.dir}" includes="beepcore-*.jar"/>
-    </jar>
-  </target>
-
-  <!-- Hand-run test example for rdfload -->
-  <target name="load-rdf-example" depends="host.name, define.rdfload, start"
-   description="Hand-run example of using the rdfload task">
-
-    <sleep seconds="15"/>
-
-    <!-- delete old logs -->
-    <delete file="${basedir}/rdfload.log"/>
-
-    <rdfload
-       logfile="${basedir}/rdfload.log"
-       modeluri="rmi://${host.name}/server1#load-rdf-example"
-       domainuri="rmi://${host.name}/server1"
-       username="user"
-       password="letmein"
-       dropmodel="yes"
-       maxerrors="10"
-       ignoreerrors="false"
-       transactionsize="10"
-       logconfig="${conf.dir}/log4j-rdfload.xml">
-
-       <rdfpath>
-
-         <fileset dir="${jxdata.dir}/ant-tasks">
-
-           <include name="rdf-good/*.rdf"/>
-           <!-- Put in a baddy -->
-           <include name="rdf-bad/2.rdf"/>
-        </fileset>
-      </rdfpath>
-    </rdfload>
-
-   <!-- shutdown the Mulgara server -->
-   <antcall target="stop"/>
-
-  </target>
-
-
-  <!-- Hand-run test example for itql command -->
-  <target name="itqlcommand-example" depends="host.name, define.itqlcommand, start"
-   description="Hand-run example of using the itqlcommand task">
-
-    <sleep seconds="15"/>
-
-    <itqlcommand ignoreerrors="true">
-
-       <itqlquery query="set autocommit off;"/>
-       <itqlquery query="create &lt;rmi://${host.name}/server1#itqlcommand-example&gt; ;"/>
-       <itqlquery query="insert &lt;http://test&gt; &lt;http://message&gt; 'Hello World' into  &lt;rmi://${host.name}/server1#itqlcommand-test&gt; ;"/>
-       <itqlquery query="select $$s $$p $$o from &lt;rmi://${host.name}/server1#itqlcommand-test&gt; where $$s $$p $$o ;"/>
-       <itqlquery query="drop &lt;rmi://${host.name}/server1#itqlcommand-test&gt; ;"/>
-       <!-- Bad query -->
-       <itqlquery query="drop &lt;rmi://${host.name}/server1#itqlcommand-test&gt; ;"/>
-       <itqlquery query="set autocommit on;"/>
-    </itqlcommand>
-
-   <!-- shutdown the Mulgara server -->
-   <antcall target="stop"/>
-
-  </target>
-
-  <!-- ======================================================= -->
-  <!-- Publish the test results to Anthill                     -->
-  <!-- ======================================================= -->
-  <target name="publish"
-   description="Publish the test results to the deployDir">
-
-     <antcall target="format-results"/>
-
-     <!-- Set new values if not already put in test dir under html -->
-     <property name="deployDir" value="${test.dir}"/>
-     <property name="version" value="html"/>
-
-     <mkdir dir="${deployDir}/${version}"/>
-
-     <copy todir="${deployDir}/${version}">
-       <fileset dir="${test.dir}"
-         includes="**/*.html,**/*.css"
-         excludes="RDF-Test-Cases/**"/>
-     </copy>
-
-     <mkdir dir="${deployDir}/${version}/logs"/>
-     <copy todir="${deployDir}/${version}/logs">
-       <fileset dir="${jxtest.dir}"
-         includes="**/*.xml,**/*.txt"/>
-     </copy>
-     <copy todir="${deployDir}/${version}/logs">
-       <fileset dir="${jxtest.dir}"
-         includes="**/*output. **/*.log"/>
-     </copy>
-
-  </target>
-
-  <target name="format-results" description="Report results of the JUnit tests">
-    <junitreport tofile="test/All-Tests.xml">
-      <fileset dir="${junit.results.tmpdir}" includes="TEST-*.xml"/>
-      <report todir="${test.dir}"/>
-    </junitreport>
-  </target>
-
-  <target name="publish-summary" depends="format-results"
-          description="Report summary of Junit results">
-
-    <delete file="${test.dir}/junit-summary.txt"/>
-    <delete file="${test.dir}/All-Tests.html"/>
-
-    <xslt  basedir="${test.dir}"
-           destdir="${test.dir}"
-           style="${scripts.dir}/junit-summary.xsl"
-           includes="**/All-Tests.xml">
-       <param name="output.dir" expression="${test.dir}"/>
-    </xslt>
-
-    <concat>
-      <fileset file="${test.dir}/junit-summary.txt"/>
-    </concat>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Creates the distribution file for the Embedded Mulgara server        -->
-  <!-- =================================================================== -->
-  <target name="embedded-dist"
-          depends="client-jrdf-jar, config-jar,
-             content-mbox-jar, content-mp3-jar, content-n3-jar,
-             content-rdfxml-jar, content-rio-jar,
-             create-manifest, demo-jar, dtd-jar, driver-jar, dtd-jar,
-             itql-jar, sparql-int-jar,
-             javadoc-dist, jrdf-jar, store-jar, store-xa-jar,
-             store-nodepool-jar,
-             store-nodepool-memory-jar, store-nodepool-xa-jar,
-             query-jar, resolver-jar, resolver-null-jar, resolver-file-jar, resolver-filesystem-jar,
-             resolver-http-jar, resolver-memory-jar, resolver-spi-jar,
-             resolver-store-jar, resolver-url-jar, resolver-lucene-jar,
-             resolver-view-jar, resolver-nodetype-jar, resolver-prefix-jar, resolver-jar-jar,
-             resolver-relational-jar, resolver-distributed-jar,
-             resolver-xsd-jar, resolver-test-jar, rmi-jar,
-             server-jar, server-beep-jar, server-rmi-jar,
-             sofa-jar, rules-jar, krule-jar, store-stringpool-jar, store-stringpool-memory-jar,
-             store-stringpool-xa-jar, tuples-jar,
-             tuples-hybrid-jar, util-jar, util-xa-jar,
-             webservices-war, webui-war, -embedded-dist-uptodate, webpage-includes"
-          description="Creates the executable JAR for the Embedded Mulgara server"
-                unless="embedded.dist.uptodate">
-
-    <!-- HACK!!!!! -->
-    <!-- This will get the ARP parser working -->
-    <!-- My theory about why this is necessary is that the Bootloader class
-         messes up the JAR plugin framework that both JAXP and StAX use -->
-    <mkdir dir="${obj.dir}/xerces"/>
-
-    <unjar src="${lib.dir}/xercesImpl.jar" dest="${obj.dir}/xerces"/>
-    <unjar src="${lib.dir}/xmlParserAPIs.jar" dest="${obj.dir}/xerces"/>
-    <unjar src="${lib.dir}/jsr173_07_api.jar" dest="${obj.dir}/xerces"/>
-    <unjar src="${lib.dir}/jsr173_07_ri.jar" dest="${obj.dir}/xerces"/>
-
-    <!-- build the executable jar file -->
-    <jar jarfile="${dist.dir}/${mulgara.jar}"
-        manifest="${obj.dir}/META-INF/MANIFEST_Mulgara_BOOTSTRAP.MF">
-
-      <zipfileset dir="${conf.dir}" prefix="conf"
-          includes="log4j-mulgara.xml, webdefault.xml, mulgara-rmi.policy,
-                    mulgara.policy"/>
-
-      <!-- third party libraries -->
-      <zipfileset src="${lib.dir}/${log4j.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${icu4j.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${activation.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${beep.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jargs.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jrdf.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jetty.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jetty.plus.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${servlet.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jasper.runtime.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jasper.compiler.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${lucene.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${mail.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${mulgara-sparql.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${castor-xml.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${castor-xml-schema.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${castor-codegen.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${trove.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${date-utils.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${commons-logging.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${commons-httpclient.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${commons-codec.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${emory-util.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jotm.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jotm.jrmp.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${carol.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${howl.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jta.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jsr.173.api.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jsr.173.ri.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jca.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${saaj.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${axis.jar}" excludes="META-INF/**, log4j.properties"/>
-      <zipfileset src="${lib.dir}/${commons-discovery.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jaxrpc.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${wsdl4j.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jakarta-oro.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jena.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${antlr.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${serializer.jar}" excludes="META-INF/**"/>
-
-      <!-- core libraries -->
-      <zipfileset src="${bin.dir}/${query.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${driver.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${itql.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${sparql-int.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${rmi.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${server.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${server-beep.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${server-rmi.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${util.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${config.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${descriptor.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${server-local.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-spi.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-filesystem.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${store.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${store-xa.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${store-nodepool.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${store-nodepool-memory.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${store-nodepool-xa.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${store-stringpool.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${store-stringpool-memory.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${store-stringpool-xa.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${util-xa.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-null.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-file.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-http.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-lucene.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-memory.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-store.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-url.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-view.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${tuples.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${tuples-hybrid.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${content-mp3.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${content-n3.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${content-mbox.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${content-rdfxml.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${content-rio.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-nodetype.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-prefix.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-relational.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-distributed.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-xsd.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-test.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${resolver-jar.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${lib.dir}/${jid3.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${dtd.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${jrdf.base.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${rules.jar}" excludes="META-INF/**"/>
-      <zipfileset src="${bin.dir}/${krule.jar}" excludes="META-INF/**"/>
-
-
-      <!-- include pre-bundled webapps -->
-      <zipfileset dir="${bin.dir}" prefix="webapps"
-          includes="${webui.war}"/>
-      <zipfileset dir="${obj.dir}/war" prefix="webapps"
-          includes="webservices.war"/>
-      <zipfileset dir="${lib.dir}" prefix="lib" includes="barracuda-core*.jar"/>
-      <zipfileset file="${obj.dir}/mulgara-x-config.xml" prefix="conf" />
-
-      <!-- Schemas -->
-      <zipfileset dir="${basedir}/data" prefix="data"
-          includes="**/*.rdfs,**/*.rss,**/*.n3"/>
-
-      <zipfileset dir="${basedir}/docs" prefix="docs"
-          includes="**/*.html, **/*.css, **/images/*, **/images/icons/*, LEGAL.txt"/>
-      <zipfileset dir="${src.docs.dir}" prefix="docs"
-          includes="**/*.html, **/*.htm, **/*.gif, **/*.png, **/*.jpg, **/*.css, **/images/*, **/images/icons/*"/>
-
-      <fileset dir="${obj.dir}/jar/util/classes" includes="**/Bootstrap.class"/>
-      <fileset dir="${src.dir}/jar/dtd" includes="META-INF/**, DTD/**"/>      <!-- fileset dir="${obj.dir}/jar/dtd/classes"/ -->
-
-      <!-- HACK!!!!! -->
-      <!-- This will get the ARP parser working -->
-      <!-- Ignore the xerces DocumentBuilderFactory -->
-      <fileset dir="${obj.dir}/xerces" excludes="META_INF/**,META-INF/services/javax.xml.parsers.DocumentBuilderFactory"/>
-
-      <fileset dir="${obj.dir}/xerces" excludes="META_INF/**"/>
-      <!-- HACK!!!!! -->
-
-    </jar>
-  </target>
-
-  <!-- do a check for any changes made to the mulgara build -->
-  <!-- potentially not the most efficient checking performed -->
-  <target name="-embedded-dist-uptodate">
-
-    <uptodate property="embedded.dist.uptodate"
-       targetfile="${dist.dir}/${mulgara.jar}">
-
-      <srcfiles dir="${bin.dir}" includes="**/*"/>
-      <srcfiles dir="${conf.dir}" includes="**/*"/>
-      <srcfiles dir="${lib.dir}" includes="**/*"/>
-      <srcfiles dir="${data.dir}" includes="**/*"/>
-      <srcfiles dir="${obj.dir}/war" includes="webservices.war"/>
-      <srcfiles dir="${basedir}/docs" includes="**/*"/>
-    </uptodate>
-  </target>
-
-  <target name="create-manifest" depends="-prepare-build">
-
-    <mkdir dir="${obj.dir}/META-INF"/>
-
-    <!-- generate the core manifest -->
-    <manifest file="${obj.dir}/META-INF/MANIFEST_Mulgara_BASE.MF">
-      <attribute name="Main-Class" value="org.mulgara.triplestore.Main"/>
-    </manifest>
-
-    <!-- generate the bootstrap manifest -->
-    <manifest file="${obj.dir}/META-INF/MANIFEST_Mulgara_BOOTSTRAP.MF">
-
-      <attribute name="Main-Class" value="org.mulgara.util.Bootstrap"/>
-      <attribute name="Embedded-Main-Class" value="org.mulgara.server.EmbeddedMulgaraServer"/>
-    </manifest>
-  </target>
-
-  <!-- =================================================================== -->
-  <!-- Meta testing target, updates source before running tests            -->
-  <!-- =================================================================== -->
-
-  <target name="test"
-          depends="dist, client-test, session-test, resolver-api-test, store-xa-test,
-                   utils-test, jxtest, store-stringpool-xa-loadtest, publish-summary"
-          description="Runs all tests (updates source first)">
-
-    <loadfile property="test.status.success" srcfile="${test.dir}/junit-summary.txt">
-      <filterchain>
-        <linecontainsregexp>
-          <regexp pattern="Success rate *100\.?0?0?%"/>
-        </linecontainsregexp>
-      </filterchain>
-    </loadfile>
-    <fail unless="test.status.success"/>
-  </target>
-
-  <target name="client-test"
-          depends="client-jrdf-test,
-                   demo-mp3-test, driver-test, itql-test, query-test,
-                   descriptor-test"
-          description="Runs client side tests">
-  </target>
-
-  <target name="session-test"
-          depends="jrdf-test, server-test,
-             server-beep-test, server-http-test, server-local-test,
-             server-rmi-test"
-          description="Runs session based tests">
-  </target>
-
-  <target name="resolver-api-test"
-    depends="content-mbox-test, content-mp3-test, content-n3-test,
-             content-rdfxml-test, content-rio-test,
-             resolver-test, resolver-null-test, resolver-file-test,
-             resolver-filesystem-test, resolver-jar-test, resolver-gis-test,
-             resolver-http-test, resolver-lucene-test,
-             resolver-nodetype-test, resolver-prefix-test, resolver-memory-test,
-             resolver-spi-test, resolver-store-test, resolver-relational-test,
-             resolver-url-test, resolver-view-test, resolver-xsd-test,
-             resolver-distributed-test, resolver-test-test,
-             store-stringpool-test"
-    description="Runs resolver API/SPI tests">
-  </target>
-
-  <target name="store-xa-test"
-    depends="store-nodepool-memory-test, store-nodepool-xa-test,
-             store-stringpool-memory-test,
-             store-stringpool-xa-test, tuples-test, tuples-hybrid-test"
-    description="Runs store -xa tests">
-  </target>
-
-  <target name="utils-test"
-    depends="ant-task-test, dtd-test, sofa-test, rules-test, krule-test, tag-test, util-test, util-xa-test"
-    description="Runs miscellaneous utility tests">
-  </target>
-
-  <target name="jxtest"
-    depends="jxunit-test"
-    description="Runs all jxunit based testing">
-  </target>
-
-  <target name="ideSupport" depends="dist,demo-mp3-jar,descriptor-wsdl-client.jar"
-    description="Builds necessary libraries for using the Eclipse IDE.">
-
-     <jar jarfile="${dist.dir}/ideSupport.jar">
-      <zipfileset dir="${obj.dir}/jar/itql/classes" includes="org/mulgara/itql/**"/>
-      <zipfileset dir="${obj.dir}/jar/itql/java" includes="org/mulgara/itql/lexer/lexer.dat"/>
-      <zipfileset dir="${obj.dir}/jar/itql/java" includes="org/mulgara/itql/parser/parser.dat"/>
-      <zipfileset dir="${obj.dir}/jar/config/classes" includes="org/mulgara/config/**"/>
-      <zipfileset dir="${obj.dir}/jar/util/classes" includes="org/mulgara/util/conversion/**"/>
-      <zipfileset dir="${obj.dir}/jar/server-rmi/classes" includes="org/mulgara/server/rmi/**"/>
-	  <zipfileset dir="${obj.dir}/jar/demo-mp3/classes" includes="org/mulgara/demo/mp3/**"/>
-      <zipfileset dir="${obj.dir}/war/webui/classes" includes="org/mulgara/barracuda/**"/>
-      <zipfileset dir="${obj.dir}/war/webui/classes" includes="org/mulgara/webui/**"/>
-      <zipfileset dir="${basedir}" includes="conf/**"/>
-  	  <zipfileset dir="${obj.dir}/jar/descriptor-client/classes" includes="org/mulgara/descriptor/**" excludes="org/mulgara/descriptor/test/**"/>
-      <!-- include pre-bundled webapps -->
-      <zipfileset dir="${bin.dir}" prefix="webapps" includes="${webui.war}"/>
-      <zipfileset dir="${obj.dir}/war" prefix="webapps" includes="webservices.war"/>
-      <zipfileset dir="${lib.dir}" prefix="lib" includes="barracuda*.jar"/>
-      <zipfileset file="${obj.dir}/mulgara-x-config.xml" prefix="conf" />
-
-      <!-- Schemas -->
-      <zipfileset dir="${basedir}/data" prefix="data" includes="**/*.rdfs,**/*.rss,**/*.n3"/>
-
-      <zipfileset dir="${basedir}/docs" prefix="docs" includes="**/*.html, **/*.css, **/images/*, **/images/icons/*, LEGAL.txt"/>
-      <zipfileset dir="${src.docs.dir}" prefix="docs" includes="**/*.html, **/*.htm, **/*.gif, **/*.png, **/*.jpg, **/*.css, **/images/*, **/images/icons/*"/>
-
-      <fileset dir="${src.dir}/jar/dtd" includes="META-INF/**, DTD/**"/>     
-
-    </jar>
-  </target>
-
-  
-</project>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE project>
+
+  <!-- =================================================================== -->
+  <!--                       Project definition                            -->
+  <!-- =================================================================== -->
+  <project name="Mulgara" default="help" basedir=".">
+
+  <!-- =================================================================== -->
+  <!--                      Property Definitions                           -->
+  <!-- =================================================================== -->
+  <property file="common.properties"/>
+  <property file="build.properties"/>
+
+  <property file="${jar.src.dir}/ant-task/ant-task-build.properties"/>
+  <property file="${jar.src.dir}/client-jrdf/client-jrdf-build.properties"/>
+  <property file="${jar.src.dir}/config/config-build.properties"/>
+  <property file="${jar.src.dir}/demo/demo-build.properties"/>
+  <property file="${jar.src.dir}/demo-mp3/demo-mp3-build.properties"/>
+  <property file="${jar.src.dir}/content-mbox/content-mbox-build.properties"/>
+  <property file="${jar.src.dir}/content-mp3/content-mp3-build.properties"/>
+  <property file="${jar.src.dir}/content-n3/content-n3-build.properties"/>
+  <property file="${jar.src.dir}/content-rdfxml/content-rdfxml-build.properties"/>
+  <property file="${jar.src.dir}/content-rio/content-rio-build.properties"/>
+  <property file="${jar.src.dir}/descriptor/descriptor-build.properties"/>
+  <property file="${jar.src.dir}/driver/driver-build.properties"/>
+  <property file="${jar.src.dir}/dtd/dtd-build.properties"/>
+  <property file="${jar.src.dir}/itql/itql-build.properties"/>
+  <property file="${jar.src.dir}/jrdf/jrdf-build.properties"/>
+  <property file="${jar.src.dir}/query/query-build.properties"/>
+  <!--property file="${jar.src.dir}/rdql/rdql-build.properties"/-->
+  <property file="${jar.src.dir}/resolver/resolver-build.properties"/>
+  <property file="${jar.src.dir}/resolver-null/resolver-null-build.properties"/>
+  <property file="${jar.src.dir}/resolver-file/resolver-file-build.properties"/>
+  <property file="${jar.src.dir}/resolver-filesystem/resolver-filesystem-build.properties"/>
+  <property file="${jar.src.dir}/resolver-gis/resolver-gis-build.properties"/>
+  <property file="${jar.src.dir}/resolver-http/resolver-http-build.properties"/>
+  <property file="${jar.src.dir}/resolver-jar/resolver-jar-build.properties"/>
+  <property file="${jar.src.dir}/resolver-lucene/resolver-lucene-build.properties"/>
+  <property file="${jar.src.dir}/resolver-memory/resolver-memory-build.properties"/>
+  <property file="${jar.src.dir}/resolver-spi/resolver-spi-build.properties"/>
+  <property file="${jar.src.dir}/resolver-store/resolver-store-build.properties"/>
+  <property file="${jar.src.dir}/resolver-url/resolver-url-build.properties"/>
+  <property file="${jar.src.dir}/resolver-view/resolver-view-build.properties"/>
+  <property file="${jar.src.dir}/resolver-xsd/resolver-xsd-build.properties"/>
+  <property file="${jar.src.dir}/resolver-test/resolver-test-build.properties"/>
+  <property file="${jar.src.dir}/resolver-nodetype/resolver-nodetype-build.properties"/>
+  <property file="${jar.src.dir}/resolver-prefix/resolver-prefix-build.properties"/>
+  <property file="${jar.src.dir}/resolver-relational/resolver-relational-build.properties"/>
+  <property file="${jar.src.dir}/resolver-distributed/resolver-distributed-build.properties"/>
+  <property file="${jar.src.dir}/server/server-build.properties"/>
+  <property file="${jar.src.dir}/server-beep/server-beep-build.properties"/>
+  <property file="${jar.src.dir}/server-http/server-http-build.properties"/>
+  <property file="${jar.src.dir}/server-local/server-local-build.properties"/>
+  <property file="${jar.src.dir}/server-rmi/server-rmi-build.properties"/>
+  <property file="${jar.src.dir}/sofa/sofa-build.properties"/>
+  <property file="${jar.src.dir}/krule/krule-build.properties"/>
+  <property file="${jar.src.dir}/rules/rules-build.properties"/>
+  <property file="${jar.src.dir}/sparql-protocol/sparql-protocol-build.properties"/>
+  <property file="${jar.src.dir}/sparql-interpreter/sparql-interpreter-build.properties"/>
+  <property file="${jar.src.dir}/store/store-build.properties"/>
+  <property file="${jar.src.dir}/store-xa/store-xa-build.properties"/>
+  <property file="${jar.src.dir}/store-nodepool/store-nodepool-build.properties"/>
+  <property file="${jar.src.dir}/store-nodepool-memory/store-nodepool-memory-build.properties"/>
+  <property file="${jar.src.dir}/store-nodepool-xa/store-nodepool-xa-build.properties"/>
+  <property file="${jar.src.dir}/store-stringpool/store-stringpool-build.properties"/>
+  <property file="${jar.src.dir}/store-stringpool-memory/store-stringpool-memory-build.properties"/>
+  <property file="${jar.src.dir}/store-stringpool-xa/store-stringpool-xa-build.properties"/>
+  <property file="${jar.src.dir}/tag/tag-build.properties"/>
+  <property file="${jar.src.dir}/tuples-hybrid/tuples-hybrid-build.properties"/>
+  <property file="${jar.src.dir}/tuples/tuples-build.properties"/>
+  <property file="${jar.src.dir}/util-xa/util-xa-build.properties"/>
+  <property file="${jar.src.dir}/util/util-build.properties"/>
+
+  <property name="webui.viewer.src.dir"
+      value="${webui.src.dir}/java/org/mulgara/webui/viewer"/>
+  <property name="webui.viewer.obj.dir.classes"
+      value="${obj.dir}/war/webui/classes/org/mulgara/webui/viewer"/>
+
+  <!-- =================================================================== -->
+  <!--                              Imports                                -->
+  <!-- =================================================================== -->
+  <import file="common.xml"/>
+  <import file="webdocs.xml"/>
+
+  <import file="${jar.src.dir}/ant-task/build.xml"/>
+  <import file="${jar.src.dir}/client-jrdf/build.xml"/>
+  <import file="${jar.src.dir}/demo/build.xml"/>
+  <import file="${jar.src.dir}/demo-mp3/build.xml"/>
+  <import file="${jar.src.dir}/config/build.xml"/>
+  <import file="${jar.src.dir}/content-mbox/build.xml"/>
+  <import file="${jar.src.dir}/content-mp3/build.xml"/>
+  <import file="${jar.src.dir}/content-n3/build.xml"/>
+  <import file="${jar.src.dir}/content-rdfxml/build.xml"/>
+  <import file="${jar.src.dir}/content-rio/build.xml"/>
+  <import file="${jar.src.dir}/descriptor/build.xml"/>
+  <import file="${jar.src.dir}/driver/build.xml"/>
+  <import file="${jar.src.dir}/dtd/build.xml"/>
+  <import file="${jar.src.dir}/itql/build.xml"/>
+  <import file="${jar.src.dir}/jrdf/build.xml"/>
+  <import file="${jar.src.dir}/query/build.xml"/>
+  <!--import file="${jar.src.dir}/rdql/build.xml"/-->
+  <import file="${jar.src.dir}/resolver/build.xml"/>
+  <import file="${jar.src.dir}/resolver-null/build.xml"/>
+  <import file="${jar.src.dir}/resolver-file/build.xml"/>
+  <import file="${jar.src.dir}/resolver-filesystem/build.xml"/>
+  <import file="${jar.src.dir}/resolver-gis/build.xml"/>
+  <import file="${jar.src.dir}/resolver-http/build.xml"/>
+  <import file="${jar.src.dir}/resolver-jar/build.xml"/>
+  <import file="${jar.src.dir}/resolver-lucene/build.xml"/>
+  <import file="${jar.src.dir}/resolver-memory/build.xml"/>
+  <import file="${jar.src.dir}/resolver-nodetype/build.xml"/>
+  <import file="${jar.src.dir}/resolver-prefix/build.xml"/>
+  <import file="${jar.src.dir}/resolver-relational/build.xml"/>
+  <import file="${jar.src.dir}/resolver-distributed/build.xml"/>
+  <import file="${jar.src.dir}/resolver-spi/build.xml"/>
+  <import file="${jar.src.dir}/resolver-store/build.xml"/>
+  <import file="${jar.src.dir}/resolver-url/build.xml"/>
+  <import file="${jar.src.dir}/resolver-view/build.xml"/>
+  <import file="${jar.src.dir}/resolver-xsd/build.xml"/>
+  <import file="${jar.src.dir}/resolver-test/build.xml"/>
+  <import file="${jar.src.dir}/server/build.xml"/>
+  <import file="${jar.src.dir}/server-beep/build.xml"/>
+  <import file="${jar.src.dir}/server-http/build.xml"/>
+  <import file="${jar.src.dir}/server-local/build.xml"/>
+  <import file="${jar.src.dir}/server-rmi/build.xml"/>
+  <import file="${jar.src.dir}/sofa/build.xml"/>
+  <import file="${jar.src.dir}/krule/build.xml"/>
+  <import file="${jar.src.dir}/rules/build.xml"/>
+  <import file="${jar.src.dir}/sparql-protocol/build.xml"/>
+  <import file="${jar.src.dir}/sparql-interpreter/build.xml"/>
+  <import file="${jar.src.dir}/store/build.xml"/>
+  <import file="${jar.src.dir}/store-xa/build.xml"/>
+  <import file="${jar.src.dir}/store-nodepool/build.xml"/>
+  <import file="${jar.src.dir}/store-nodepool-memory/build.xml"/>
+  <import file="${jar.src.dir}/store-nodepool-xa/build.xml"/>
+  <import file="${jar.src.dir}/store-stringpool/build.xml"/>
+  <import file="${jar.src.dir}/store-stringpool-memory/build.xml"/>
+  <import file="${jar.src.dir}/store-stringpool-xa/build.xml"/>
+  <import file="${jar.src.dir}/tag/build.xml"/>
+  <import file="${jar.src.dir}/tuples-hybrid/build.xml"/>
+  <import file="${jar.src.dir}/tuples/build.xml"/>
+  <import file="${jar.src.dir}/util-xa/build.xml"/>
+  <import file="${jar.src.dir}/util/build.xml"/>
+
+  <!-- =================================================================== -->
+  <!--                          Path Definitions                           -->
+  <!-- =================================================================== -->
+  <path id="project-classpath">
+
+    <path refid="common-classpath"/>
+  </path>
+
+  <path id="webui.classpath">
+
+    <pathelement path="${java.class.path}"/>
+    <pathelement path="${obj.dir}/war/webui/classes"/>
+
+    <fileset dir="${lib.dir}" includes="**/**"/>
+    <fileset dir="${dist.dir}" includes="${driver.jar}"/>
+  </path>
+
+  <!-- =================================================================== -->
+  <!--                          Task Definitions                           -->
+  <!-- =================================================================== -->
+
+  <!-- Define the RDFLoad task -->
+  <target name="define.rdfload" unless="define.rdfload" depends="ant-task-jar"
+   description="Defines the rdfload taskdef">
+
+    <taskdef name="rdfload" classname="org.mulgara.ant.task.rdf.RDFLoad">
+
+     <classpath>
+
+       <pathelement path="${dist.dir}/${driver.jar}"/>
+       <pathelement path="${dist.dir}/${ant-task.jar}"/>
+       <pathelement path="${lib.dir}/apache-soap-2.2.jar"/>
+       <pathelement path="${lib.dir}/log4j-1.2.15.jar"/>
+     </classpath>
+    </taskdef>
+
+    <property name="define.rdfload" value="true"/>
+  </target>
+
+  <!-- Define the ITQLCommand task -->
+  <target name="define.itqlcommand" unless="define.itqlcommand" depends="ant-task-jar"
+   description="Defines the itqlcommand taskdef">
+
+    <taskdef name="itqlcommand" classname="org.mulgara.ant.task.itql.ITQLCommand">
+
+     <classpath>
+
+       <pathelement path="${dist.dir}/${driver.jar}"/>
+       <pathelement path="${dist.dir}/${ant-task.jar}"/>
+       <pathelement path="${lib.dir}/apache-soap-2.2.jar"/>
+       <pathelement path="${lib.dir}/log4j-1.2.15.jar"/>
+     </classpath>
+    </taskdef>
+
+    <property name="define.itqlcommand" value="true"/>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Delete all intermediate and end product files, leaving only files   -->
+  <!-- from CVS.                                                           -->
+  <!-- =================================================================== -->
+  <target name="clean"
+      description="Deletes all intermediate and product files, leaving only sources">
+
+    <tstamp/>
+
+    <delete dir="${obj.dir}"/>
+    <delete dir="${test.dir}"/>
+    <delete dir="${bin.dir}"/>
+    <delete dir="${dist.dir}"/>
+    <delete dir="${tmp.dir}"/>
+    <delete dir="${javadoc.dir}"/>
+    <delete dir="${jxtest.dir}"/>
+    <delete dir="${src.docs.dir}"/>
+    <delete dir="${basedir}/testDatabase"/>
+    <delete dir="${basedir}/sqltest"/>
+    <delete>
+      <fileset dir="${basedir}" includes="*.log*"/>
+    </delete>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Automated testing target for Anthill, updates source before         -->
+  <!-- running tests                                                       -->
+  <!-- =================================================================== -->
+  <target name="anthill-test"
+          depends="clean, test"
+          description="Runs all tests for Anthill">
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Automated testing target for Anthill, updates source before         -->
+  <!-- running tests                                                       -->
+  <!-- =================================================================== -->
+  <target name="anthill-quick-test"
+          depends="clean, jxunit-test, publish"
+          description="Runs all tests for Anthill">
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Performs a cvs update on the server-side source                     -->
+  <!-- =================================================================== -->
+  <target name="cvs-update" description="perform a CVS update on all source">
+    <cvs cvsRoot="${cvs.root}" package="${cvs.src.package}" command="update"/>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Run JUnit regression (non-load) tests on dbms.jar                   -->
+  <!-- =================================================================== -->
+  <target name="dbms-test" depends="-prepare-build, uri,
+    driver-jar, itql-jar, query-jar, util-jar, log4j-conf.xml"
+    description="runs regression tests on the triple store">
+
+    <!-- Set timestamp for CruiseControl's benefit -->
+    <tstamp/>
+
+    <delete dir="${junit.results.tmpdir}"/>
+
+    <mkdir dir="${junit.results.tmpdir}"/>
+
+    <delete file="${junit.results}"/>
+
+    <junit fork="yes" haltonfailure="no" printsummary="on"
+      jvm="${java.home}/bin/java" dir="${basedir}">
+
+      <!-- The cvs.root system property allows tests to find CVS'ed test data -->
+      <jvmarg value="${arch.bits}"/>
+      <jvmarg value="-Djava.io.tmpdir=${tmp.dir}"/>
+      <jvmarg value="-Djava.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory"/>
+      <jvmarg value="-Djava.naming.provider.url=rmi://localhost"/>
+      <jvmarg value="-Djava.rmi.server.codebase=${bin.uri}/${rmi.jar}"/>
+      <jvmarg value="-Dcvs.root=${basedir}"/>
+      <jvmarg value="-Dlog4j.configuration=${baseuri}/log4j-conf.xml"/>
+
+      <classpath refid="project-classpath"/>
+      <classpath path="${activation.jar}"/>
+      <classpath path="${bin.dir}/${query.jar}"/>
+      <classpath path="${bin.dir}/${driver.jar}"/>
+      <classpath path="${bin.dir}/${itql.jar}"/>
+      <classpath path="${bin.dir}/${rules.jar}"/>
+      <classpath path="${bin.dir}/${server.jar}"/>
+      <classpath path="${bin.dir}/${util.jar}"/>
+
+      <formatter type="xml"/>
+
+      <batchtest todir="${junit.results.tmpdir}">
+
+        <fileset dir="${src.dir}/jar/query/java" includes="**/*Test.java"
+          excludes="**/*LoadTest.java"/>
+        <fileset dir="${src.dir}/jar/driver/java" includes="**/*Test.java"
+          excludes="**/*LoadTest.java"/>
+        <fileset dir="${src.dir}/jar/itql/java" includes="**/*Test.java"
+          excludes="**/*LoadTest.java"/>
+        <fileset dir="${src.dir}/jar/server/java" includes="**/*Test.java"
+          excludes="**/*LoadTest.java"/>
+        <fileset dir="${src.dir}/jar/util/java" includes="**/*Test.java"
+          excludes="**/*LoadTest.java"/>
+      </batchtest>
+    </junit>
+
+    <!-- junitreport does not seem to support props in the tofile attribute -->
+    <!--<junitreport tofile="${junit.results}">-->
+
+    <junitreport tofile="test/All-Tests.xml">
+      <fileset dir="${junit.results.tmpdir}" includes="TEST-*.xml"/>
+    </junitreport>
+  </target>
+
+  <target name="base-dist"
+          depends="ant-task-dist,
+                   client-jrdf-dist, content-mbox-dist,
+                   content-mp3-dist, content-rdfxml-dist, content-rio-dist,
+                   descriptor-dist, driver-dist, dtd-dist, itql-dist, jrdf-dist,
+                   store-dist, store-xa-dist, store-nodepool-dist,
+                   store-nodepool-memory-dist,
+                   store-nodepool-xa-dist, query-dist,
+                   resolver-dist, resolver-null-dist, resolver-file-dist, resolver-filesystem-dist,
+                   resolver-http-dist, resolver-nodetype-dist, resolver-prefix-dist,
+                   resolver-lucene-dist, resolver-memory-dist, resolver-relational-dist,
+                   resolver-spi-dist, resolver-store-dist, resolver-distributed-dist,
+                   resolver-url-dist, resolver-view-dist, resolver-xsd-dist,
+                   resolver-jar-dist, resolver-test-dist,
+                   server-dist, server-beep-dist, server-http-dist, server-local-dist,
+                   server-rmi-dist, sofa-dist, sparql-int-dist, krule-dist, rules-dist,
+                   store-stringpool-dist, store-stringpool-memory-dist,
+                   store-stringpool-xa-dist, tag-dist,
+                   tuples-dist, tuples-hybrid-dist,
+                   util-dist, util-xa-dist"
+          description="Creates the distribution base jars">
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Creates the distribution files                                      -->
+  <!-- =================================================================== -->
+  <!-- Removed server-local, jrdf -->
+  <target name="dist"
+          depends="itql-dist, driver-dist, descriptor-dist, mulgara-war,
+                   embedded-dist, lite-dist"
+          description="Creates the distribution files">
+
+    <copy file="${bin.dir}/${mulgara.war}" tofile="${dist.dir}/${mulgara.war}"/>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Creates the distribution of documentation files                     -->
+  <!-- =================================================================== -->
+  <target name="dist-website" depends="javadoc, javadoc-dist, webpage-includes"
+    description="Creates the distribution of documentation files">
+
+    <mkdir dir="${dist.docs.dir}"/>
+    <mkdir dir="${dist.api.dir}"/>
+
+    <!-- copy the documentation -->
+    <copy todir="${dist.docs.dir}">
+      <fileset dir="${src.docs.dir}"/>
+    </copy>
+
+    <!-- copy the API -->
+    <copy todir="${dist.api.dir}">
+      <fileset dir="${javadoc.dir}"/>
+    </copy>
+
+
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Creates and copies the core Mulgara files to a single directory      -->
+  <!-- =================================================================== -->
+  <target name="core" depends="dist"
+    description="Creates and then copies the core Mulgara files to a single directory.">
+
+    <!-- webservices.war -->
+    <copy file="${obj.dir}/war/webservices.war" todir="${core.dir}"/>
+
+    <!-- jars for webui war -->
+    <copy file="${obj.dir}/war/webui/jars/${webui-logic.jar}" todir="${core.dir}"/>
+    <copy file="${obj.dir}/war/webui/jars/${webui-barracuda.jar}" todir="${core.dir}"/>
+
+    <!-- driver jar for clients -->
+    <copy file="${dist.dir}/${driver.jar}" todir="${core.dir}"/>
+
+    <!-- ant task jar -->
+    <copy file="${ant-task.dist.dir}/${ant-task.jar}" todir="${core.dir}"/>
+
+    <copy todir="${core.dir}">
+      <fileset dir="${bin.dir}">
+        <include name="*.jar"/>
+      </fileset>
+    </copy>
+
+    <!-- generate the client side java doc -->
+    <antcall target="javadoc"/>
+    <copy todir="${core-javadoc.dir}">
+      <fileset dir="${javadoc.dir}">
+        <include name="*/**"/>
+      </fileset>
+    </copy>
+
+    <!-- jxunit tests -->
+    <mkdir dir="${core.dir}/jxdata/iTQL/"/>
+    <copy todir="${core.dir}/jxdata/iTQL">
+      <fileset dir="${jxdata.dir}/iTQL"/>
+    </copy>
+
+    <!-- resolver example -->
+    <mkdir dir="${core.dir}/example/resolver"/>
+    <copy todir="${core.dir}/example/resolver">
+      <fileset dir="${resolver-http.src.dir}">
+        <include name="**/*.*"/>
+        <exclude name="**/*UnitTest.java"/>
+      </fileset>
+    </copy>
+
+    <!-- content handler example -->
+    <mkdir dir="${core.dir}/example/handler"/>
+    <copy todir="${core.dir}/example/handler">
+      <fileset dir="${content-mp3.src.dir}">
+        <include name="**/*.*"/>
+        <exclude name="**/*UnitTest.java"/>
+      </fileset>
+    </copy>
+
+    <mkdir dir="${core.dir}/example/conf/handler"/>
+    <copy todir="${core.dir}/example/conf/handler">
+      <fileset dir="${content-mp3.conf.dir}" includes="**/parserfactory.conf"/>
+    </copy>
+
+    <move todir="${core.dir}/example/resolver/java">
+      <fileset dir="${core.dir}/example/handler" includes="**/compile-resolver.list"/>
+    </move>
+
+    <move todir="${core.dir}/example/handler/java">
+      <fileset dir="${core.dir}/example/handler" includes="**/compile-handler.list"/>
+    </move>
+
+    <move todir="${core.dir}/example">
+      <fileset dir="${core.dir}/example/handler" includes="**/build-tutorial.*"/>
+    </move>
+
+    <!-- Library jars -->
+    <mkdir dir="${core.dir}/example/lib"/>
+    <copy todir="${core.dir}/example/lib">
+      <fileset dir="${lib.dir}" includes="${jid3.jar}"/>
+    </copy>
+
+    <delete>
+      <fileset dir="${core.dir}/example/handler" includes="*build*.*"/>
+    </delete>
+    <delete>
+      <fileset dir="${core.dir}/example/resolver" includes="*build*.*"/>
+    </delete>
+
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Generates a manifest file for the Mulgara executable project JAR        -->
+  <!-- =================================================================== -->
+  <target name="lite-create-manifest" depends="-prepare-build">
+    <mkdir dir="${obj.dir}/META-INF"/>
+
+    <!-- generate the core manifest -->
+    <manifest file="${obj.dir}/META-INF/MANIFEST_Mulgara_BASE.MF">
+      <attribute name="Main-Class" value="org.mulgara.triplestore.Main"/>
+    </manifest>
+
+    <!-- generate the bootstrap manifest -->
+    <manifest file="${obj.dir}/META-INF/MANIFEST_Mulgara_Lite_BOOTSTRAP.MF">
+
+      <attribute name="Main-Class" value="org.mulgara.util.Bootstrap"/>
+      <attribute name="Embedded-Jar" value="
+          lib/${query.jar}, lib/${driver.jar}, lib/${itql.jar}, lib/${sparql-int.jar},
+          lib/${rmi.jar},
+          lib/${server.jar}, lib/${server-beep.jar}, lib/${server-rmi.jar},
+          lib/${util.jar}, lib/${config.jar}, lib/${descriptor.jar}, lib/${server-local.jar},
+          lib/${resolver.jar}, lib/${resolver-spi.jar}, lib/${resolver-filesystem.jar},
+          lib${store.jar}, lib/${store-xa.jar}, lib/${rules.jar},
+          lib/${store-nodepool.jar}, lib/${store-nodepool-xa.jar},
+          lib/${store-nodepool-memory.jar}, lib/${store-stringpool.jar}
+          lib/${store-stringpool-xa.jar},
+          lib/${store-stringpool-memory.jar}, lib/${util-xa.jar}, lib/${resolver-null.jar}, lib/${resolver-file.jar},
+          lib/${resolver-http.jar}, lib/${resolver-lucene.jar}, lib/${resolver-memory.jar},
+          lib/${resolver-store.jar}, lib/${resolver-url.jar}, lib/${resolver-view.jar},
+          lib/${tuples.jar}, lib/${tuples-hybrid.jar}, lib/${content-mp3.jar},
+          lib/${content-n3.jar}, lib/${content-mbox.jar}, lib/${content-rdfxml.jar},
+          lib/${content-rio.jar}, lib/${resolver-nodetype.jar}, lib/${resolver-prefix.jar},
+          lib/${resolver-relational.jar}, lib/${resolver-xsd.jar}, lib/${resolver-test.jar},
+          lib/${resolver-distributed.jar},
+          lib/${resolver-jar.jar}, lib/${dtd.jar}, lib/${jrdf.base.jar}
+          lib/activation-1.0.2.jar, lib/icu4j.jar, lib/jena-2.1.jar, lib/antlr.jar,
+          lib/${date-utils.jar}, lib/${commons-logging.jar}, lib/beepcore-0.9.08.jar, lib/log4j-1.2.15.jar, lib/${lucene.jar}, lib/mail-1.3.jar,
+          lib/${jetty.jar}, lib/${jetty.plus.jar}, lib/${jasper.compiler.jar}, lib/${servlet.jar}, lib/jargs-0.2.jar,
+          lib/${castor-xml.jar}, lib/${castor-codegen.jar}, lib/${castor-xml-schema.jar}, lib/trove-1.0.2.jar, lib/${jrdf.jar}, lib/${saaj.jar},
+          lib/${jakarta-oro.jar}, lib/jta-spec1_0_1.jar, lib/${jotm.jar}, lib/${jotm.jrmp.jar}, lib/${carol.jar}, lib/${howl.jar},
+          lib/${jca.jar}, lib/${httpclient.jar}, lib/${commons-codec.jar}, lib/${mulgara-sparql.jar}"/>
+      <attribute name="Embedded-Main-Class" value="org.mulgara.server.EmbeddedMulgaraServer"/>
+    </manifest>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Creates the lite distribution file for the Embedded Mulgara server   -->
+  <!-- =================================================================== -->
+  <target name="lite-dist"
+          depends="driver-jar, itql-jar, sparql-int-jar, rules-jar, query-jar, rmi-jar,
+                   server-jar, server-local-jar, server-beep-jar,
+                   server-rmi-jar, util-jar, config-jar, dtd-jar, jrdf-jar, ant-task-jar,
+                   store-dist, store-xa-dist, store-nodepool-dist,
+                   store-nodepool-xa-dist,
+                   store-nodepool-memory-dist,
+                   store-stringpool-dist,
+                   store-stringpool-xa-dist,
+                   store-stringpool-memory-dist, tuples-dist, tuples-hybrid-dist, resolver-null-dist,
+                   resolver-file-dist, resolver-filesystem-dist, resolver-distributed-dist,
+                   resolver-http-dist, resolver-lucene-dist, resolver-relational-dist,
+                   resolver-memory-dist, resolver-nodetype-dist, resolver-prefix-dist,
+                   resolver-store-dist, resolver-url-dist, resolver-jar-dist,
+                   resolver-view-dist, resolver-xsd-dist,
+                   content-mbox-dist, content-mp3-dist, content-n3-dist,
+                   content-rdfxml-dist, content-rio-dist,
+                   lite-create-manifest, javadoc-dist,
+                   lite-dist-uptodate, webpage-includes"
+          unless="dist.lite.uptodate"
+          description="Creates the executable JAR for the Embedded Mulgara Lite
+                       server">
+
+    <!-- HACK!!!!! -->
+    <!-- This will get the ARP parser working -->
+    <mkdir dir="${obj.dir}/xerces"/>
+
+    <unjar src="${lib.dir}/xercesImpl.jar" dest="${obj.dir}/xerces"/>
+    <unjar src="${lib.dir}/xmlParserAPIs.jar" dest="${obj.dir}/xerces"/>
+    <unjar src="${lib.dir}/jsr173_07_api.jar" dest="${obj.dir}/xerces"/>
+    <unjar src="${lib.dir}/jsr173_07_ri.jar" dest="${obj.dir}/xerces"/>
+    <!-- HACK!!!!! -->
+
+    <!-- build the executable jar file -->
+    <jar jarfile="${dist.dir}/${mulgara-lite.jar}"
+        manifest="${obj.dir}/META-INF/MANIFEST_Mulgara_Lite_BOOTSTRAP.MF">
+
+      <zipfileset dir="${conf.dir}" prefix="conf"
+          includes="log4j-mulgara.xml, webdefault.xml, mulgara-rmi.policy,
+                    mulgara.policy"/>
+      <zipfileset dir="${lib.dir}" prefix="lib" includes="
+        ${log4j.jar}, ${icu4j.jar}, ${activation.jar}, ${beep.jar},
+        ${jargs.jar}, ${jrdf.jar}, ${jetty.jar}, ${jetty.plus.jar},
+        ${servlet.jar}, ${jasper.runtime.jar}, ${jasper.compiler.jar},
+        ${lucene.jar}, ${mail.jar}, ${castor-xml.jar}, ${castor-xml-schema.jar}, ${castor-codegen.jar}, ${trove.jar},
+        ${date-utils.jar}, ${commons-logging.jar}, ${commons-httpclient.jar},
+        ${commons-codec.jar}, ${emory-util.jar}, ${mulgara-sparql.jar}
+        ${jotm.jar}, ${jotm.jrmp.jar}, ${carol.jar}, ${howl.jar}, ${jta.jar},
+        ${jsr.173.api.jar}, ${jsr.173.ri.jar}, ${jca.jar}, ${saaj.jar},
+        ${axis.jar}, ${commons-discovery.jar}, ${jaxrpc.jar}, ${wsdl4j.jar},
+        ${jena.jar}, ${antlr.jar}, ${jakarta-oro.jar}, {jid3.jar}"/>
+      <zipfileset dir="${lib.dir}" prefix="lib" includes="${saaj.jar},
+                       ${axis.jar}, ${commons-discovery.jar},
+                       ${jaxrpc.jar}, ${wsdl4j.jar}"/>
+      <zipfileset dir="${bin.dir}" prefix="lib" includes="
+          ${query.jar}, ${driver.jar}, ${itql.jar}, ${sparql-int.jar},
+          ${rules.jar}, ${rmi.jar},
+          ${server.jar}, ${server-beep.jar}, ${server-rmi.jar},
+          ${util.jar}, ${config.jar}, ${descriptor.jar}, ${server-local.jar},
+          ${resolver.jar}, ${resolver-spi.jar}, ${resolver-filesystem.jar},
+          ${store.jar}, ${store-xa.jar},
+          ${store-nodepool.jar}, ${store-nodepool-xa.jar}, ${store-stringpool.jar},
+          ${store-stringpool-xa.jar}, ${store-nodepool-memory.jar}, ${resolver-null.jar},
+          ${store-stringpool-memory.jar}, ${util-xa.jar}, ${resolver-file.jar},
+          ${resolver-http.jar}, ${resolver-lucene.jar}, ${resolver-memory.jar},
+          ${resolver-store.jar}, ${resolver-url.jar}, ${resolver-view.jar},
+          ${tuples.jar}, ${tuples-hybrid.jar}, ${content-mp3.jar},
+          ${content-n3.jar}, ${content-mbox.jar}, ${content-rdfxml.jar},
+          ${content-rio.jar}, ${resolver-nodetype.jar}, ${resolver-prefix.jar},
+          ${resolver-xsd.jar}, ${resolver-test.jar}, ${resolver-relational.jar},
+          ${resolver-distributed.jar},
+          ${resolver-jar.jar}, ${dtd.jar}, ${jrdf.base.jar}"/>
+
+      <!-- Schemas -->
+      <zipfileset dir="${basedir}/data" prefix="data"
+          includes="mulgara.rdfs"/>
+
+      <zipfileset dir="${src.docs.dir}" prefix="docs"
+          includes="**/*.html, **/*.htm, **/*.gif, **/*.png, **/*.jpg, **/*.css, **/images/*, **/images/icons/*"/>
+      <zipfileset file="${obj.dir}/mulgara-x-config.xml" prefix="conf" />
+
+      <fileset dir="${obj.dir}/jar/util/classes" includes="**/Bootstrap.class"/>
+      <fileset dir="${src.dir}/jar/dtd" includes="META-INF/**, DTD/**"/>
+
+      <!-- HACK!!!!! -->
+      <!-- This will get the ARP parser working -->
+      <!-- Ignore the xerces DocumentBuilderFactory -->
+      <fileset dir="${obj.dir}/xerces" excludes="META_INF/**"/>
+
+      <!-- HACK!!!!! -->
+
+    </jar>
+
+  </target>
+
+  <!-- do a check for any changes made to the mulgara build -->
+  <!-- potentially not the most efficient checking performed -->
+  <target name="lite-dist-uptodate">
+
+    <uptodate property="dist.lite.uptodate"
+       targetfile="${dist.dir}/${mulgara-lite.jar}">
+
+     <srcfiles dir="${bin.dir}" includes="**/*"/>
+     <srcfiles dir="${conf.dir}" includes="**/*"/>
+     <srcfiles dir="${lib.dir}" includes="**/*"/>
+     <srcfiles dir="${data.dir}" includes="**/*"/>
+     <srcfiles dir="${template.src.docs.dir}" includes="**/*"/>
+    </uptodate>
+  </target>
+
+
+  <!-- =================================================================== -->
+  <!-- Generate the doclet to support custom @-tags in Mulgara javadoc      -->
+  <!-- =================================================================== -->
+  <target name="doclet.jar"
+          depends="javadoc-version, doclet-compile, doclet141-compile">
+
+    <mkdir dir="${bin.dir}"/>
+
+    <jar jarfile="${bin.dir}/doclet.jar">
+      <fileset dir="${obj.dir}/jar/doclet/classes"/>
+    </jar>
+  </target>
+
+  <target name="javadoc-version">
+
+    <condition property="javadoc1.4.1">
+      <contains string="${java.version}" substring="1.4.1"/>
+    </condition>
+  </target>
+
+  <target name="doclet-compile" unless="javadoc1.4.1">
+
+    <mkdir dir="${obj.dir}/jar/doclet/classes"/>
+
+    <javac destdir="${obj.dir}/jar/doclet/classes"
+           classpath="${java.class.path}"
+           debug="on" deprecation="on">
+      <src path="${src.dir}/jar/doclet/java"/>
+    </javac>
+  </target>
+
+  <target name="doclet141-compile" if="javadoc1.4.1">
+
+    <mkdir dir="${obj.dir}/jar/doclet/classes"/>
+
+    <javac destdir="${obj.dir}/jar/doclet/classes"
+           classpath="${java.class.path}"
+           debug="on" deprecation="on">
+      <src path="${src.dir}/jar/doclet141/java"/>
+    </javac>
+  </target>
+
+
+  <!-- =================================================================== -->
+  <!-- Translate XHTML+MathML into printable XHTML                         -->
+  <!-- =================================================================== -->
+  <target name="docs" depends="javadoc-dist,webpage-includes" description="Generate documentation">
+
+    <style basedir="${src.docs.dir}"
+           destdir="${src.docs.dir}"
+           extension="-toc.xml"
+           style="toc.xsl"
+           includes="model.xml"
+           excludes="*-toc.xml"/>
+    <!--
+    <style basedir="${src.docs.dir}"
+           destdir="${src.docs.dir}"
+           style="mathml.xsl"
+           includes="*.xml"/>
+    -->
+  </target>
+
+  <!-- ==================================================================== -->
+  <!-- Formats all source files                                             -->
+  <!-- ==================================================================== -->
+  <target name="format" depends="jalopy">
+
+    <!--
+      Invokes Jalopy as follows:
+
+      - All formatted files will have unix fileformat (\n)
+      - Load your code convention from the given url
+      - Override the convention to use the file history feature
+      - Override the convention to use alder32 checksums of files for history testing
+      - Override the convention to use loglevel "info"
+      - Override the convention to use 2 threads
+      - The import optimization feature will work (if enabled in the active
+        convention), because a classpath reference is specified
+
+        Don't forget to setup an include pattern as Jalopy truly expects
+        valid Java source files as input!
+      -->
+    <jalopy fileformat="unix"
+            convention="${src.dir}/mulgara.xml"
+            history="file"
+            historymethod="adler32"
+            loglevel="info"
+            threads="2"
+            classpathref="project-classpath">
+
+      <fileset dir="${src.dir}">
+        <include name="**/*.java" />
+      </fileset>
+    </jalopy>
+  </target>
+
+  <!-- ================================================================== -->
+  <!-- Prints help information                                            -->
+  <!-- ================================================================== -->
+  <target name="help" description="Print this help message">
+    <echo message="Welcome to the build script for the ${description}"/>
+    <echo message="These targets can be invoked as follows:"/>
+    <echo message="  ./build.sh &lt;target&gt;"/>
+    <echo message=""/>
+    <java fork="false" classname="org.apache.tools.ant.Main"
+          newenvironment="false">
+      <jvmarg value="${arch.bits}"/>
+      <arg line="-buildfile build.xml -projecthelp"/>
+    </java>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Generates all javadoc for the project                               -->
+  <!-- =================================================================== -->
+  <target name="javadoc"
+    depends="javadoc-uptodate, javadoc-overview.html,
+             ant-task-jar, client-jrdf-jar, config-jar,
+             content-mbox-jar, content-mp3-jar,
+             content-n3-jar, content-rdfxml-jar, content-rio-jar,
+             itql-jar, sparql-int-jar,
+             doclet.jar, jrdf-jar, store-jar,
+             store-xa-jar,
+             store-nodepool-jar, store-nodepool-memory-jar,
+             store-nodepool-xa-jar, query-jar,
+             resolver-jar, resolver-null-jar, resolver-file-jar, resolver-filesystem-jar,
+             resolver-http-jar, resolver-lucene-jar, resolver-memory-jar,
+             resolver-spi-jar, resolver-store-jar,
+             resolver-url-jar, resolver-view-jar, resolver-xsd-jar,
+             resolver-test-jar,
+             server-jar, server-beep-jar, server-rmi-jar,
+             sofa-jar, krule-jar, rules-jar, sparql-protocol-jar,
+             store-stringpool-jar,
+             store-stringpool-memory-jar, store-stringpool-xa-jar,
+             tuples-jar, tuples-hybrid-jar, util-jar, util-xa-jar, webui-war"
+    unless="javadoc-uptodate"
+    description="Creates the project javadoc">
+    <delete dir="${javadoc.dir}"/>
+    <mkdir dir="${javadoc.dir}"/>
+    <javadoc destdir="${javadoc.dir}"
+        packagenames="org.mulgara.ant.*,
+                      org.mulgara.barracuda.*,
+                      org.mulgara.beep.*,
+                      org.mulgara.client.*,
+                      org.mulgara.config,
+                      org.mulgara.content.*,
+                      org.mulgara.connection.*,
+                      org.mulgara.driver.*,
+                      org.mulgara.extractor.tag,
+                      org.mulgara.itql,
+                      org.mulgara.jrdf,
+                      org.mulgara.local.*,
+                      org.mulgara.query.*,
+                      org.mulgara.rdf,
+                      org.mulgara.resolver.*,
+                      org.mulgara.rmi.*,
+                      org.mulgara.server.*,
+                      org.mulgara.sofa.*,
+                      org.mulgara.krule.*,
+                      org.mulgara.rules.*,
+                      org.mulgara.sparql.*,
+                      org.mulgara.store.*,
+                      org.mulgara.store.graph.*,
+                      org.mulgara.store.graph.xa.*,
+                      org.mulgara.store.jxunit.*,
+                      org.mulgara.store.loader.*,
+                      org.mulgara.store.nodepool.*,
+                      org.mulgara.store.nodepool.memory.*,
+                      org.mulgara.store.nodepool.xa.*,
+                      org.mulgara.store.stringpool.*,
+                      org.mulgara.store.stringpool.memory.*,
+                      org.mulgara.store.stringpool.xa.*,
+                      org.mulgara.store.tuples.*,
+                      org.mulgara.store.xa.*,
+                      org.mulgara.webui.*,
+                      org.mulgara.util,
+                      org.mulgara.xml.*"
+        private="true"
+        overview="${obj.dir}/docs/overview.html"
+        windowtitle="${description} ${mulgara-version} API"
+        doctitle="${description} ${mulgara-version} API"
+        version="true"
+        use="true"
+        bottom="Copyright &amp;copy; ${year} Tucana Technologies, Inc. (http://www.tucanatech.com/)."
+        author="true"
+        additionalParam="-breakiterator -source 1.5">
+      <tag name="company" description="Company:"/>
+      <tag name="copyright" description="Copyright:"/>
+      <tag name="created" description="Creation date:"/>
+      <tag name="licence" description="Licence:"/>
+      <taglet name="org.mulgara.doclet.MaintenanceAuthorTaglet"
+        path="${bin.dir}/doclet.jar"/>
+      <taglet name="org.mulgara.doclet.ModifiedTaglet"
+        path="${bin.dir}/doclet.jar"/>
+      <taglet name="org.mulgara.doclet.VersionTaglet"
+        path="${bin.dir}/doclet.jar"/>
+      <classpath refid="project-classpath"/>
+      <classpath path="${lib.dir}/antlr.jar"/>
+      <classpath path="${lib.dir}/barracuda-1.2.6.jar"/>
+      <classpath path="${lib.dir}/beepcore-0.9.08.jar"/>
+      <classpath path="${lib.dir}/javax.servlet-2.3.jar"/>
+      <classpath path="${lib.dir}/${jid3.jar}"/>
+      <classpath path="${lib.dir}/jsr173_07_api.jar"/>
+      <classpath path="${lib.dir}/${lucene.jar}"/>
+      <classpath path="${lib.dir}/${sofa.jar}"/>
+      <classpath path="${lib.dir}/xmlc-all-runtime-2.2.jar"/>
+      <classpath path="${lib.dir}/xom-1.0d21.jar"/>
+      <sourcepath path="${ant-task.src.dir}/java"/>
+      <sourcepath path="${client-jrdf.src.dir}/java"/>
+      <sourcepath path="${content-mp3.src.dir}/java"/>
+      <sourcepath path="${content-n3.src.dir}/java"/>
+      <sourcepath path="${content-rdfxml.src.dir}/java"/>
+      <sourcepath path="${content-rio.src.dir}/java"/>
+      <sourcepath path="${driver.src.dir}/java"/>
+      <sourcepath path="${dtd.src.dir}/java"/>
+      <sourcepath path="${itql.src.dir}/java"/>
+      <sourcepath path="${jrdf.src.dir}/java"/>
+      <sourcepath path="${krule.src.dir}/java"/>
+      <sourcepath path="${rules.src.dir}/java"/>
+      <sourcepath path="${query.src.dir}/java"/>
+      <!--sourcepath path="${rdql.src.dir}/java"/-->
+      <sourcepath path="${resolver.src.dir}/java"/>
+      <sourcepath path="${resolver-null.src.dir}/java"/>
+      <sourcepath path="${resolver-file.src.dir}/java"/>
+      <sourcepath path="${resolver-filesystem.src.dir}/java"/>
+      <sourcepath path="${resolver-jar.src.dir}/java"/>
+      <sourcepath path="${resolver-http.src.dir}/java"/>
+      <sourcepath path="${resolver-lucene.src.dir}/java"/>
+      <sourcepath path="${resolver-url.src.dir}/java"/>
+      <sourcepath path="${resolver-memory.src.dir}/java"/>
+      <sourcepath path="${resolver-spi.src.dir}/java"/>
+      <sourcepath path="${resolver-store.src.dir}/java"/>
+      <sourcepath path="${resolver-view.src.dir}/java"/>
+      <sourcepath path="${resolver-xsd.src.dir}/java"/>
+      <sourcepath path="${resolver-test.src.dir}/java"/>
+      <sourcepath path="${server.src.dir}/java"/>
+      <sourcepath path="${server-beep.src.dir}/java"/>
+      <sourcepath path="${server-rmi.src.dir}/java"/>
+      <sourcepath path="${sofa.src.dir}/java"/>
+      <sourcepath path="${sparql-protocol.src.dir}/java"/>
+      <sourcepath path="${sparql-int.src.dir}/java"/>
+      <sourcepath path="${store.src.dir}/java"/>
+      <sourcepath path="${store-xa.src.dir}/java"/>
+      <sourcepath path="${store-nodepool.src.dir}/java"/>
+      <sourcepath path="${store-nodepool-memory.src.dir}/java"/>
+      <sourcepath path="${store-nodepool-xa.src.dir}/java"/>
+      <sourcepath path="${store-stringpool.src.dir}/java"/>
+      <sourcepath path="${store-stringpool-memory.src.dir}/java"/>
+      <sourcepath path="${store-stringpool-xa.src.dir}/java"/>
+      <sourcepath path="${tuples.src.dir}/java"/>
+      <sourcepath path="${tuples-hybrid.src.dir}/java"/>
+      <sourcepath path="${util.src.dir}/java"/>
+      <sourcepath path="${util-xa.src.dir}/java"/>
+      <sourcepath path="${webui.src.dir}/java"/>
+      <sourcepath path="${obj.dir}/jar/config/java"/>
+      <sourcepath path="${obj.dir}/jar/itql/java"/>
+      <sourcepath path="${obj.dir}/jar/query/java"/>
+      <!--sourcepath path="${obj.dir}/jar/rdql/java"/-->
+      <sourcepath path="${obj.dir}/jar/util/java"/>
+      <sourcepath path="${obj.dir}/war/webui/java"/>
+      <link href="${j2ee.javadoc}"/>
+      <link href="${java.javadoc}"/>
+      <link href="${jrdf.javadoc}"/>
+    </javadoc>
+  </target>
+
+  <target name="javadoc-dist"
+          if="distjavadoc">
+
+    <antcall target="create-javadoc"/>
+  </target>
+
+  <!-- If and depends are not compatible so we have to approach javadoc in
+       two steps -->
+  <target name="create-javadoc"
+          depends="javadoc-uptodate, javadoc-overview.html, doclet.jar,
+                   ant-task-javadoc,
+                   client-jrdf-javadoc,
+                   content-mbox-javadoc,
+                   content-mp3-javadoc, content-n3-javadoc,
+                   content-rdfxml-javadoc, content-rio-javadoc,
+                   descriptor-javadoc, driver-javadoc, dtd-javadoc,
+                   itql-javadoc, sparql-int-javadoc,
+                   store-javadoc, store-xa-javadoc,
+                   store-nodepool-javadoc,
+                   store-nodepool-memory-javadoc, jrdf-javadoc,
+                   store-nodepool-xa-javadoc, query-javadoc,
+                   resolver-filesystem-javadoc, resolver-null-javadoc,
+                   resolver-file-javadoc, resolver-http-javadoc,
+                   resolver-lucene-javadoc, resolver-memory-javadoc,
+                   resolver-spi-javadoc, resolver-distributed-javadoc,
+                   resolver-store-javadoc, resolver-url-javadoc, resolver-view-javadoc,
+                   resolver-nodetype-javadoc, resolver-prefix-javadoc, resolver-xsd-javadoc,
+                   resolver-test-javadoc, resolver-javadoc, resolver-relational-javadoc,
+                   server-beep-javadoc, server-http-javadoc,
+                   server-local-javadoc, server-rmi-javadoc, server-javadoc,
+                   sofa-javadoc, rules-javadoc, krule-javadoc,
+                   store-stringpool-javadoc,
+                   store-stringpool-memory-javadoc, store-stringpool-xa-javadoc,
+                   tag-javadoc, tuples-hybrid-javadoc, tuples-javadoc,
+                   util-xa-javadoc, util-javadoc"
+      unless="javadoc.uptodate"
+      description="creates project javadoc documentation">
+  </target>
+
+  <target name="javadoc-overview.html">
+
+    <style in    ="build.xml"
+           style ="docs/overview.xsl"
+           out   ="${obj.dir}/docs/overview.html"/>
+  </target>
+
+  <target name="javadoc-uptodate">
+
+    <uptodate property="javadoc.uptodate"
+        targetfile="${javadoc.dir}/package-list">
+
+      <srcfiles dir="${src.dir}" includes="**/*.java, **/package.html"/>
+      <srcfiles dir="docs" includes="overview.xsl"/>
+    </uptodate>
+  </target>
+
+  <target name="jrdf-example" description="Runs the JRDF memory example">
+
+     <java classname="org.jrdf.graph.mem.JRDFExample" fork="no" failonerror="yes"
+        jvm="${java.home}/bin/java" dir="${basedir}">
+
+        <jvmarg value="${arch.bits}"/>
+
+        <classpath>
+            <pathelement path="${lib.dir}/${jrdf.jar}"/>
+        </classpath>
+      </java>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Create config file for Log4J for each developer                     -->
+  <!-- =================================================================== -->
+  <target name="log4j-conf.xml">
+
+    <copy file="${conf.dir}/log4j-template.xml"
+      tofile="${basedir}/log4j-conf.xml"/>
+  </target>
+
+  <target name="model.html">
+
+    <style basedir="${template.src.docs.dir}"
+           destdir="${template.src.docs.dir}"
+           style="mathml.xsl"
+           includes="model.xml"/>
+  </target>
+
+
+  <!-- =================================================================== -->
+  <!-- Create JAR for use as the RMI codebase                              -->
+  <!-- =================================================================== -->
+  <target name="rmi-jar"
+          depends="query-jar, driver-jar, server-jar, util-jar,
+                   rmi-jar-uptodate"
+          unless="rmi.jar.uptodate">
+
+    <jar jarfile="${bin.dir}/${rmi.jar}">
+
+      <fileset dir="${obj.dir}/jar/query/classes"/>
+      <fileset dir="${obj.dir}/jar/driver/classes"/>
+      <fileset dir="${obj.dir}/jar/server/classes"/>
+      <fileset dir="${obj.dir}/jar/util/classes"/>
+    </jar>
+  </target>
+
+  <target name="rmi-jar-uptodate">
+
+    <uptodate property="rmi.jar.uptodate"
+              targetfile="${bin.dir}/${rmi.jar}">
+
+      <srcfiles dir="${obj.dir}/jar/query/classes" includes="**/*"/>
+      <srcfiles dir="${obj.dir}/jar/driver/classes" includes="**/*"/>
+      <srcfiles dir="${obj.dir}/jar/server/classes" includes="**/*"/>
+      <srcfiles dir="${obj.dir}/jar/util/classes" includes="**/*"/>
+    </uptodate>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Starts the iTQL command line tool                                   -->
+  <!-- =================================================================== -->
+  <target name="run-itql" depends="itql-dist, uri">
+
+    <java classname="org.mulgara.itql.ItqlSession"
+          failonerror="yes">
+
+      <jvmarg value="${arch.bits}"/>
+
+      <sysproperty key="java.io.tmpdir" value="${tmp.dir}"/>
+      <sysproperty key="log4j.configuration"
+                   value="${baseuri}/conf/log4j-tql.xml"/>
+
+      <classpath>
+
+        <pathelement path="${bin.dir}/${query.jar}"/>
+        <pathelement path="${bin.dir}/${driver.jar}"/>
+        <pathelement path="${bin.dir}/${itql.jar}"/>
+        <pathelement path="${bin.dir}/${rules.jar}"/>
+        <pathelement path="${bin.dir}/${server.jar}"/>
+        <pathelement path="${bin.dir}/${server-http.jar}"/>
+        <pathelement path="${bin.dir}/${server-local.jar}"/>
+        <pathelement path="${bin.dir}/${server-rmi.jar}"/>
+        <pathelement path="${bin.dir}/${server-beep.jar}"/>
+        <pathelement path="${bin.dir}/${util.jar}"/>
+
+        <fileset dir="${lib.dir}"
+                 includes="activation*.jar, beepcore-*.jar, jargs-*.jar,
+                           icu4j.jar, jena*.jar, antlr*.jar,
+                           ${commons-logging.jar}, log4j*.jar, lucene*.jar,
+                           xerces*.jar, xmlParserAPIs.jar, ${jrdf.jar},
+                           ${saaj.jar}"/>
+      </classpath>
+    </java>
+
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Starts multiple embedded Mulgara servers                             -->
+  <!-- =================================================================== -->
+  <target name="start-instance"
+     description="Starts an embedded Mulgara server">
+
+    <echo>
+      Starting embedded Mulgara ${server.instance} server on ${os.name} with
+      output to ${dist.dir}/mulgara-output-${server.instance}
+    </echo>
+
+    <!-- create a temporary directory for this server instance -->
+    <mkdir dir="${tmp.dir}/${server.instance}"/>
+
+    <!-- prepare a log4j file for server instance -->
+    <copy file="${conf.dir}/log4j-instance.xml"
+      tofile="${dist.dir}/log4j-instance-${server.instance}.xml"/>
+
+    <replace file="${dist.dir}/log4j-instance-${server.instance}.xml"
+       token="@server.instance@" value="${server.instance}"/>
+
+    <exec os="Linux" executable="${scripts.dir}/bg.linux" failonerror="yes">
+
+      <arg value="-o"/>
+      <arg value="${dist.dir}/mulgara-output-${server.instance}"/>
+      <arg value="${java.home}/bin/java"/>
+      <arg line="-Djava.io.tmpdir=&quot;${tmp.dir}/${server.instance}&quot;"/>
+      <arg line="-Dshutdownhook.port=689${server.instance}"/>
+      <arg value="-jar"/>
+      <arg value="${dist.dir}/${mulgara.version.to.run}"/>
+      <arg value="-a"/>
+      <arg value="${test.dir}"/>
+      <arg value="-s"/>
+      <arg value="server${server.instance}"/>
+      <arg value="-p"/>
+      <arg value="808${server.instance}"/>
+      <arg value="-l"/>
+      <arg value="file:${dist.dir}/log4j-instance-${server.instance}.xml"/>
+    </exec>
+
+    <exec os="SunOS" executable="${scripts.dir}/bg.sh" failonerror="yes">
+
+      <arg value="-o"/>
+      <arg value="${dist.dir}/mulgara-output-${server.instance}"/>
+      <arg value="${java.home}/bin/java"/>
+      <arg value="${arch.bits}"/>
+      <arg line="-Djava.io.tmpdir=&quot;${tmp.dir}/${server.instance}&quot;"/>
+      <arg line="-Dshutdownhook.port=689${server.instance}"/>
+      <arg value="-jar"/>
+      <arg value="${dist.dir}/${mulgara.version.to.run}"/>
+      <arg value="-a"/>
+      <arg value="${test.dir}"/>
+      <arg value="-s"/>
+      <arg value="server${server.instance}"/>
+      <arg value="-p"/>
+      <arg value="808${server.instance}"/>
+      <arg value="-l"/>
+      <arg value="file:${dist.dir}/log4j-instance-${server.instance}.xml"/>
+    </exec>
+
+    <exec os="Mac OS X" executable="${scripts.dir}/bg.sh" failonerror="yes">
+
+      <arg value="-o"/>
+      <arg value="${dist.dir}/mulgara-output-${server.instance}"/>
+      <arg value="${java.home}/bin/java"/>
+      <arg line="-Djava.io.tmpdir=&quot;${tmp.dir}/${server.instance}&quot;"/>
+      <arg line="-Dshutdownhook.port=689${server.instance}"/>
+      <arg value="-jar"/>
+      <arg value="${dist.dir}/${mulgara.version.to.run}"/>
+      <arg value="-a"/>
+      <arg value="${test.dir}"/>
+      <arg value="-s"/>
+      <arg value="server${server.instance}"/>
+      <arg value="-p"/>
+      <arg value="808${server.instance}"/>
+      <arg value="-l"/>
+      <arg value="file:${dist.dir}/log4j-instance-${server.instance}.xml"/>
+    </exec>
+
+    <exec os="Windows NT,Windows 2000,Windows XP, Windows 2003" executable="${scripts.dir}\bg.exe"
+        failonerror="yes">
+
+      <arg value="-o"/>
+      <arg value="${dist.dir}/mulgara-output-${server.instance}"/>
+      <arg value="${java.home}/bin/java"/>
+      <arg line="-Djava.io.tmpdir=&quot;${tmp.dir}/${server.instance}&quot;"/>
+      <arg line="-Dshutdownhook.port=689${server.instance}"/>
+      <arg value="-jar"/>
+      <arg value="${dist.dir}/${mulgara.version.to.run}"/>
+      <arg value="-a"/>
+      <arg value="${test.dir}"/>
+      <arg value="-s"/>
+      <arg value="server${server.instance}"/>
+      <arg value="-p"/>
+      <arg value="808${server.instance}"/>
+      <arg value="-l"/>
+      <arg value="&quot;file:/${dist.dir}/log4j-instance-${server.instance}.xml&quot;"/>
+    </exec>
+
+    <!-- wait for the server to start -->
+    <antcall target="await">
+      <param name="shutdownhook.port" value="689${server.instance}"/>
+    </antcall>
+  </target>
+
+
+  <!-- Run full dist of Mulgara by default unless other (lite) is set -->
+  <target name="set-version-to-run" unless="mulgara.version.to.run.jar">
+
+    <property name="mulgara.version.to.run" value="${mulgara.jar}"/>
+  </target>
+
+
+  <!-- =================================================================== -->
+  <!-- Starts an embedded Mulgara server with profiling (from OptimizeIt)      -->
+  <!-- =================================================================== -->
+  <target name="start-profiled" depends="dist"
+      description="Starts an embedded Mulgara server with profiling (from OptimizeIt)">
+
+    <echo>
+      Starting embedded Mulgara server with profiling (from OptimizeIt) with output to
+      ${dist.dir}/mulgara-output
+    </echo>
+
+    <exec executable="${mulgara-profiled}" failonerror="yes">
+
+      <env key="Mulgara_DIR" path="${dist.dir}"/>
+
+      <arg value="start"/>
+    </exec>
+
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Starts two embedded Mulgara servers                                     -->
+  <!-- =================================================================== -->
+  <target name="start-twoservers"
+      depends="dist, lite-dist, set-version-to-run"
+      description="Starts two embedded Mulgara servers">
+
+    <echo>
+      Starting two embedded Mulgara servers with output to
+      ${dist.dir}/mulgara-output
+    </echo>
+
+    <antcall target="start-instance">
+      <param name="server.instance" value="1"/>
+    </antcall>
+
+    <antcall target="start-instance">
+      <param name="server.instance" value="2"/>
+    </antcall>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Add the required JARs into the Web Services war file                -->
+  <!-- =================================================================== -->
+  <target name="webservices-war"
+          depends="descriptor-jar, descriptor-add-to-war-dir,
+                   webservices-war-uptodate"
+          unless="webservices.war.uptodate"
+          description="Adds the required jars into the webservices.war file">
+
+    <mkdir dir="${obj.dir}/war/web-services"/>
+
+    <copy todir="${obj.dir}/war/web-services/WEB-INF">
+      <fileset dir="${webservices.src.dir}/WEB-INF" includes="*"/>
+    </copy>
+
+    <replace file="${obj.dir}/war/web-services/WEB-INF/web.xml"
+       token="@@hostname@@" value="${host.name}"/>
+
+    <war warfile="${obj.dir}/war/webservices.war"
+         basedir="${obj.dir}/war/web-services"
+         webxml="${obj.dir}/war/web-services/WEB-INF/web.xml"
+         excludes="WEB-INF/web.xml">
+
+        <!-- AXIS WSDD FILE -->
+        <webinf dir="${webservices.src.dir}/WEB-INF/" includes="server-config.wsdd"/>
+
+        <!-- descriptors -->
+
+        <!-- pre compiled jsps -->
+        <classes dir="${descriptor.war.obj.dir}/classes"
+          includes="**/*.class"/>
+
+        <fileset dir="${obj.dir}/war/"
+          includes="descriptor/descriptors/**/*.xsl"/>
+        <fileset dir="${src.dir}/war/"
+          includes="descriptor/**/*.html, descriptor/**/*.css, descriptor/**/*.jsp"/>
+        <fileset dir="${src.dir}/war/"
+          includes="descriptor/images/**"/>
+        <fileset dir="${src.dir}/war/"
+          includes="descriptor/tutorial/**"/>
+        <fileset dir="${src.dir}/war/"
+          includes="descriptor/examples/**"/>
+        <fileset dir="${src.dir}/war/"
+          includes="descriptor/examples/vcard/**"/>
+
+        <!-- 3rd party -->
+        <lib dir="${lib.dir}" includes="bsf.jar"/>
+        <lib dir="${lib.dir}" includes="js.jar"/>
+
+      </war>
+   </target>
+
+  <!-- =================================================================== -->
+  <!-- Check if the webservices.war file is uptodate                       -->
+  <!-- =================================================================== -->
+   <target name="webservices-war-uptodate">
+
+    <uptodate property="webservices.war.uptodate"
+        targetfile="${obj.dir}/war/webservices.war">
+      <srcfiles dir="${obj.dir}/war/web-services" includes="**/*"/>
+    </uptodate>
+   </target>
+
+  <!-- =================================================================== -->
+  <!-- Stops an embedded Mulgara instance                                   -->
+  <!-- =================================================================== -->
+  <target name="stop-instance" depends="set-version-to-run" description="Stops an embedded Mulgara server">
+
+    <echo message="Stopping embedded Mulgara server instance ${server.instance}"/>
+
+    <java jar="${dist.dir}/${mulgara.version.to.run}" fork="true" failonerror="true">
+
+      <sysproperty key="java.io.tmpdir" value="${tmp.dir}"/>
+      <sysproperty key="shutdownhook.port" value="689${server.instance}"/>
+
+      <jvmarg value="${arch.bits}"/>
+
+      <arg value="-x"/>
+    </java>
+
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Stops two embedded Mulgara servers                                      -->
+  <!-- =================================================================== -->
+  <target name="stop-twoservers" description="Stops the two embedded Mulgara servers">
+
+    <!-- shutdown servers in reverse order. First has the RMI registry -->
+    <echo message="Stopping Mulgara instance servers"/>
+
+    <antcall target="stop-instance">
+      <param name="server.instance" value="2"/>
+    </antcall>
+
+    <antcall target="stop-instance">
+      <param name="server.instance" value="1"/>
+    </antcall>
+
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Unpack, filter and preen test data                                  -->
+  <!-- =================================================================== -->
+  <target name="test-data">
+
+    <filter token="basedir" value="${basedir}"/>
+
+    <copy todir="${test.dir}" filtering="yes">
+      <fileset dir="data" includes="*.itql"/>
+    </copy>
+
+    <mkdir dir="${test.dir}/RDF-Test-Cases"/>
+
+    <unzip src="data/RDF-Test-Cases-2001-09-12.zip" dest="${test.dir}/RDF-Test-Cases"/>
+
+    <mkdir dir="${test.dir}/RDQL"/>
+
+    <unzip src="data/rdql-tests-jena-2.0.zip" dest="${test.dir}/RDQL"/>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Stress test - performs itql query stress tests                      -->
+  <!-- =================================================================== -->
+
+  <target name="stress-test"
+          depends="itql-jar, uri"
+          description="run stress tests the ItqlInterpreterBean">
+
+    <java classname="org.mulgara.itql.ItqlInterpreterStressTest" fork="yes" failonerror="no"
+      jvm="${java.home}/bin/java" dir="${basedir}">
+
+      <jvmarg value="${arch.bits}"/>
+
+      <sysproperty key="java.io.tmpdir" value="${tmp.dir}"/>
+      <sysproperty key="org.mulgara.xml.ResourceDocumentBuilderFactory"
+        value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
+      <sysproperty key="java.naming.factory.initial"
+        value="com.sun.jndi.rmi.registry.RegistryContextFactory"/>
+      <sysproperty key="java.naming.provider.url" value="rmi://localhost"/>
+      <sysproperty key="java.rmi.server.codebase"
+        value="${bin.uri}/${rmi.jar}"/>
+      <sysproperty key="cvs.root" value="${basedir}"/>
+      <sysproperty key="log4j.configuration"
+        value="${baseuri}/log4j-conf.xml"/>
+
+      <!-- JUnitPP settings -->
+      <arg line="-r 1000 -w 10000 -wm 2000 -s 100 -t 5000 -ra 5000 -f itql.commands"/>
+
+      <classpath>
+
+        <path refid="query-classpath"/>
+
+        <fileset dir="${bin.dir}" includes="${dtd.jar}, ${itql.jar}, ${rules.jar}, ${query.jar},
+                 ${driver.jar}, ${rmi.jar}, ${server-rmi.jar}"/>
+        <fileset dir="${lib.dir}" includes="xerces*.jar, xmlParserAPIs.jar, jxunit*.jar, junit.jar, junitpp.jar"/>
+      </classpath>
+
+    </java>
+   </target>
+
+  <!-- =================================================================== -->
+  <!-- Runs regression tests on a Mulgara server                               -->
+  <!-- =================================================================== -->
+  <!--target name="regression-test"
+    depends="-prepare-build, log4j-conf.xml, dist"
+    description="Runs regression tests on a Mulgara server">
+
+    <echo message="mulgara-test has not been implemented, run itql-test or dbms-test instead."/-->
+
+    <!-- Set timestamp for CruiseControl's benefit -->
+    <!--tstamp/>
+
+    <delete dir="${mulgara.results.tmpdir}"/>
+    <mkdir dir="${mulgara.results.tmpdir}"/>
+    <delete file="${mulgara.results}"/-->
+
+    <!-- start a server -->
+    <!--ant target="start"/-->
+
+    <!-- run the tests -->
+
+    <!-- stop the server -->
+    <!--ant target="stop"/>
+
+  </target-->
+
+
+  <!-- =================================================================== -->
+  <!-- Builds Mulgara Semantic Store (Mulgara) WAR                           -->
+  <!-- =================================================================== -->
+  <target name="mulgara-war"
+      description="Builds the Mulgara Semantic Store (Mulgara) WAR"
+      depends="driver-jar, itql-jar, sparql-int-jar, query-jar, rmi-jar, server-jar,
+      server-beep-jar, server-rmi-jar, util-jar, config-jar, descriptor-jar, dtd-compile,
+      set.host.name, mulgara.war-uptodate"
+      unless="mulgara.war-uptodate">
+
+    <copy file="${mulgara.war.src.dir}/WEB-INF/web.xml"
+      tofile="${obj.dir}/war/mulgara/WEB-INF/web.xml"/>
+
+    <replace file="${obj.dir}/war/mulgara/WEB-INF/web.xml"
+       token="@@hostname@@" value="${host.name}"/>
+
+    <delete file="${bin.dir}/${mulgara.war}"/>
+
+    <war warfile="${bin.dir}/${mulgara.war}"
+        webxml="${obj.dir}/war/mulgara/WEB-INF/web.xml">
+
+      <zipfileset dir="${conf.dir}" prefix="WEB-INF/conf"
+          includes="mulgara-config-war.xml, mulgara-rmi.policy, mulgara.policy,
+          log4j-mulgara-war.properties, expires.txt"/>
+
+      <fileset dir="${src.dir}/war/mulgara"
+          includes="WEB-INF/**" excludes="WEB-INF/web.xml"/>
+
+      <lib dir="${lib.dir}" includes="log4j-core-*.jar, icu4j.jar, jena-*.jar, antlr*.jar, beepcore-*.jar,
+          lucene*.jar, apache-soap-*.jar, ${jrdf.jar}, ${date-utils.jar}, ${commons-logging.jar}"/>
+      <lib dir="${bin.dir}" includes="${query.jar},
+        ${driver.jar}, ${itql.jar}, ${sparql-int.jar}, ${rules.jar}, ${rmi.jar},
+          ${server.jar}, ${server-beep.jar}, ${server-rmi.jar},
+          ${util.jar}, ${config.jar}"/>
+      <lib dir="${dist.dir}" includes="expires.txt"/>
+    </war>
+  </target>
+
+  <target name="mulgara.war-uptodate">
+
+    <uptodate property="mulgara.war-uptodate"
+       targetfile="${bin.dir}/${mulgara.war}">
+
+      <srcfiles dir="${bin.dir}" includes="${query.jar},
+          ${driver.jar}, ${itql.jar}, ${rules.jar}, ${rmi.jar},
+          ${sparql-int.jar},
+          ${server.jar}, ${server-beep.jar}, ${server-rmi.jar},
+          ${util.jar}, ${config.jar}, ${descriptor.jar}"/>
+      <srcfiles dir="${dist.dir}" includes="expires.txt"/>
+      <srcfiles dir="${conf.dir}" includes="**/*"/>
+      <srcfiles dir="${src.dir}/war/mulgara" includes="WEB-INF/**"
+                                         excludes="WEB-INF/web.xml"/>
+      <srcfiles dir="${mulgara.war.src.dir}/WEB-INF" includes="web.xml"/>
+    </uptodate>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Compiles the Mulgara webui interface pages with XMLC                    -->
+  <!-- =================================================================== -->
+  <target name="webui-xmlc" depends="xmlc"
+      description="Compiles the Mulgara webui interface pages with XMLC">
+
+    <!-- Build the webui interface classes -->
+    <mkdir dir="${obj.dir}/war/webui/java"/>
+
+    <!-- build the webui interface classes -->
+    <xmlc sourceout="${obj.dir}/war/webui/java"
+          includes="**/*.html"
+          markup="HTML"
+          verbose="false"
+          force="no"
+          srcdir="${webui.src.dir}/template-html"/>
+  </target>
+
+
+  <!-- =================================================================== -->
+  <!-- Compiles the Mulgara webui interface classes                            -->
+  <!-- =================================================================== -->
+  <target name="webui-build" depends="webui-xmlc, eventbuilder, driver-dist"
+      description="Compiles the Mulgara webui interface classes">
+
+    <!-- Build the webui interface classes -->
+    <mkdir dir="${obj.dir}/war/webui/classes"/>
+    <mkdir dir="${obj.dir}/war/webui/xlib"/>
+
+    <!-- Event class generation - also compiles the XMLC generated classes -->
+    <eventbuilder sourceout="${obj.dir}/war/webui/java"
+        descriptor="${webui.viewer.src.dir}/events/events.xml">
+    </eventbuilder>
+
+    <javac srcdir="${obj.dir}/war/webui/java"
+     destdir="${obj.dir}/war/webui/classes"
+     debug="${debug}" deprecation="on">
+      <classpath refid="webui.classpath"/>
+    </javac>
+
+    <javac srcdir="${webui.src.dir}/java"
+        destdir="${obj.dir}/war/webui/classes"
+        debug="${debug}" deprecation="on">
+      <classpath refid="webui.classpath"/>
+    </javac>
+
+    <!-- Example queries and directives -->
+    <copy todir="${obj.dir}/war/webui/classes" >
+
+      <fileset dir="${webui.src.dir}/java" >
+
+        <include name="**/*.txt"/>
+        <include name="**/*.directives"/>
+      </fileset>
+    </copy>
+
+    <!-- images -->
+    <copy todir="${obj.dir}/war/webui/xlib" >
+
+      <fileset dir="${webui.src.dir}/template-html/org/mulgara/webui/viewer" >
+
+        <exclude name="**/*.html"/>
+        <exclude name="**/*.xmlc"/>
+      </fileset>
+    </copy>
+
+    <!-- Replace tokens in example queries - leave out the <> brackets-->
+    <!-- The name of the model to work on -->
+    <replace file="${obj.dir}/war/webui/classes/org/mulgara/webui/viewer/ExampleQueries.txt"
+       token="@@model-uri@@" value="rmi://host.name/server1#sampledata"/>
+    <replace file="${obj.dir}/war/webui/classes/org/mulgara/webui/viewer/ExampleQueries.txt"
+       token="@@data-dir@@" value="jar:file:mulgara.jar.path!/data"/>
+
+  </target>
+
+
+  <!-- =================================================================== -->
+  <!-- Builds the Mulgara webui interface WAR                                  -->
+  <!-- =================================================================== -->
+  <target name="webui-war" depends="webui-build, -webui-war-uptodate"
+      description="Builds the Mulgara webui interface WAR" unless="webui.war-uptodate">
+
+    <mkdir dir="${obj.dir}/war/webui/jars"/>
+
+    <!-- Actual page classes -->
+    <jar jarfile="${obj.dir}/war/webui/jars/${webui-screens.jar}">
+      <fileset dir="${obj.dir}/war/webui/classes" includes="org/mulgara/webui/**/*HTML.class"/>
+    </jar>
+
+    <!-- Images and stylesheet - swap this jar to change badging -->
+    <jar jarfile="${obj.dir}/war/webui/jars/${webui-resources.jar}"
+      basedir="${obj.dir}/war/webui/" includes="xlib/**"/>
+
+    <!-- Barracuda related classes -->
+    <jar jarfile="${obj.dir}/war/webui/jars/${webui-barracuda.jar}"
+      basedir="${obj.dir}/war/webui/classes"
+      includes="org/mulgara/barracuda/**"/>
+
+    <!-- Logic -->
+    <jar jarfile="${obj.dir}/war/webui/jars/${webui-logic.jar}"
+      basedir="${obj.dir}/war/webui/classes"
+      includes="org/mulgara/webui/**"
+      excludes="**/*HTML.class"/>
+
+    <war warfile="${bin.dir}/${webui.war}"
+      webxml="${webui.src.dir}/WEB-INF/web.xml">
+
+      <fileset dir="${webui.src.dir}/content"/>
+      <fileset dir="${webui.src.dir}"
+        includes="WEB-INF/**" excludes="WEB-INF/web.xml"/>
+
+      <lib dir="${lib.dir}" includes="xmlc-all*.jar, *barracuda*.jar, plankton*.jar"/>
+      <lib dir="${obj.dir}/war/webui/jars" includes="*.jar"/>
+    </war>
+  </target>
+
+  <target name="-webui-war-uptodate">
+
+     <uptodate property="webui.war-uptodate" targetfile="${bin.dir}/${webui.war}">
+
+       <srcfiles dir="${dist.dir}" includes="${driver.jar}"/>
+       <srcfiles dir="${obj.dir}/war/webui/jars" includes="*.jar"/>
+       <srcfiles dir="${obj.dir}/war/webui/classes"/>
+     </uptodate>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- J2EE resource adapter                                               -->
+  <!-- =================================================================== -->
+  <target name="mulgara-rar" depends="driver-jar, query-jar">
+
+    <jar jarfile="${bin.dir}/mulgara.rar">
+
+      <fileset dir="${src.dir}/rar/mulgara" includes="META-INF/ra.xml"/>
+      <fileset dir="${src.dir}/rar/mulgara/content"/>
+      <fileset dir="${bin.dir}" includes="${driver.jar}, ${query.jar}"/>
+      <fileset dir="${lib.dir}" includes="beepcore-*.jar"/>
+    </jar>
+  </target>
+
+  <!-- Hand-run test example for rdfload -->
+  <target name="load-rdf-example" depends="host.name, define.rdfload, start"
+   description="Hand-run example of using the rdfload task">
+
+    <sleep seconds="15"/>
+
+    <!-- delete old logs -->
+    <delete file="${basedir}/rdfload.log"/>
+
+    <rdfload
+       logfile="${basedir}/rdfload.log"
+       modeluri="rmi://${host.name}/server1#load-rdf-example"
+       domainuri="rmi://${host.name}/server1"
+       username="user"
+       password="letmein"
+       dropmodel="yes"
+       maxerrors="10"
+       ignoreerrors="false"
+       transactionsize="10"
+       logconfig="${conf.dir}/log4j-rdfload.xml">
+
+       <rdfpath>
+
+         <fileset dir="${jxdata.dir}/ant-tasks">
+
+           <include name="rdf-good/*.rdf"/>
+           <!-- Put in a baddy -->
+           <include name="rdf-bad/2.rdf"/>
+        </fileset>
+      </rdfpath>
+    </rdfload>
+
+   <!-- shutdown the Mulgara server -->
+   <antcall target="stop"/>
+
+  </target>
+
+
+  <!-- Hand-run test example for itql command -->
+  <target name="itqlcommand-example" depends="host.name, define.itqlcommand, start"
+   description="Hand-run example of using the itqlcommand task">
+
+    <sleep seconds="15"/>
+
+    <itqlcommand ignoreerrors="true">
+
+       <itqlquery query="set autocommit off;"/>
+       <itqlquery query="create &lt;rmi://${host.name}/server1#itqlcommand-example&gt; ;"/>
+       <itqlquery query="insert &lt;http://test&gt; &lt;http://message&gt; 'Hello World' into  &lt;rmi://${host.name}/server1#itqlcommand-test&gt; ;"/>
+       <itqlquery query="select $$s $$p $$o from &lt;rmi://${host.name}/server1#itqlcommand-test&gt; where $$s $$p $$o ;"/>
+       <itqlquery query="drop &lt;rmi://${host.name}/server1#itqlcommand-test&gt; ;"/>
+       <!-- Bad query -->
+       <itqlquery query="drop &lt;rmi://${host.name}/server1#itqlcommand-test&gt; ;"/>
+       <itqlquery query="set autocommit on;"/>
+    </itqlcommand>
+
+   <!-- shutdown the Mulgara server -->
+   <antcall target="stop"/>
+
+  </target>
+
+  <!-- ======================================================= -->
+  <!-- Publish the test results to Anthill                     -->
+  <!-- ======================================================= -->
+  <target name="publish"
+   description="Publish the test results to the deployDir">
+
+     <antcall target="format-results"/>
+
+     <!-- Set new values if not already put in test dir under html -->
+     <property name="deployDir" value="${test.dir}"/>
+     <property name="version" value="html"/>
+
+     <mkdir dir="${deployDir}/${version}"/>
+
+     <copy todir="${deployDir}/${version}">
+       <fileset dir="${test.dir}"
+         includes="**/*.html,**/*.css"
+         excludes="RDF-Test-Cases/**"/>
+     </copy>
+
+     <mkdir dir="${deployDir}/${version}/logs"/>
+     <copy todir="${deployDir}/${version}/logs">
+       <fileset dir="${jxtest.dir}"
+         includes="**/*.xml,**/*.txt"/>
+     </copy>
+     <copy todir="${deployDir}/${version}/logs">
+       <fileset dir="${jxtest.dir}"
+         includes="**/*output. **/*.log"/>
+     </copy>
+
+  </target>
+
+  <target name="format-results" description="Report results of the JUnit tests">
+    <junitreport tofile="test/All-Tests.xml">
+      <fileset dir="${junit.results.tmpdir}" includes="TEST-*.xml"/>
+      <report todir="${test.dir}"/>
+    </junitreport>
+  </target>
+
+  <target name="publish-summary" depends="format-results"
+          description="Report summary of Junit results">
+
+    <delete file="${test.dir}/junit-summary.txt"/>
+    <delete file="${test.dir}/All-Tests.html"/>
+
+    <xslt  basedir="${test.dir}"
+           destdir="${test.dir}"
+           style="${scripts.dir}/junit-summary.xsl"
+           includes="**/All-Tests.xml">
+       <param name="output.dir" expression="${test.dir}"/>
+    </xslt>
+
+    <concat>
+      <fileset file="${test.dir}/junit-summary.txt"/>
+    </concat>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Creates the distribution file for the Embedded Mulgara server        -->
+  <!-- =================================================================== -->
+  <target name="embedded-dist"
+          depends="client-jrdf-jar, config-jar,
+             content-mbox-jar, content-mp3-jar, content-n3-jar,
+             content-rdfxml-jar, content-rio-jar,
+             create-manifest, demo-jar, dtd-jar, driver-jar, dtd-jar,
+             itql-jar, sparql-int-jar,
+             javadoc-dist, jrdf-jar, store-jar, store-xa-jar,
+             store-nodepool-jar,
+             store-nodepool-memory-jar, store-nodepool-xa-jar,
+             query-jar, resolver-jar, resolver-null-jar, resolver-file-jar, resolver-filesystem-jar,
+             resolver-http-jar, resolver-memory-jar, resolver-spi-jar,
+             resolver-store-jar, resolver-url-jar, resolver-lucene-jar,
+             resolver-view-jar, resolver-nodetype-jar, resolver-prefix-jar, resolver-jar-jar,
+             resolver-relational-jar, resolver-distributed-jar,
+             resolver-xsd-jar, resolver-test-jar, rmi-jar,
+             server-jar, server-beep-jar, server-rmi-jar,
+             sofa-jar, rules-jar, krule-jar, store-stringpool-jar, store-stringpool-memory-jar,
+             store-stringpool-xa-jar, tuples-jar,
+             tuples-hybrid-jar, util-jar, util-xa-jar,
+             webservices-war, webui-war, -embedded-dist-uptodate, webpage-includes"
+          description="Creates the executable JAR for the Embedded Mulgara server"
+                unless="embedded.dist.uptodate">
+
+    <!-- HACK!!!!! -->
+    <!-- This will get the ARP parser working -->
+    <!-- My theory about why this is necessary is that the Bootloader class
+         messes up the JAR plugin framework that both JAXP and StAX use -->
+    <mkdir dir="${obj.dir}/xerces"/>
+
+    <unjar src="${lib.dir}/xercesImpl.jar" dest="${obj.dir}/xerces"/>
+    <unjar src="${lib.dir}/xmlParserAPIs.jar" dest="${obj.dir}/xerces"/>
+    <unjar src="${lib.dir}/jsr173_07_api.jar" dest="${obj.dir}/xerces"/>
+    <unjar src="${lib.dir}/jsr173_07_ri.jar" dest="${obj.dir}/xerces"/>
+
+    <!-- build the executable jar file -->
+    <jar jarfile="${dist.dir}/${mulgara.jar}"
+        manifest="${obj.dir}/META-INF/MANIFEST_Mulgara_BOOTSTRAP.MF">
+
+      <zipfileset dir="${conf.dir}" prefix="conf"
+          includes="log4j-mulgara.xml, webdefault.xml, mulgara-rmi.policy,
+                    mulgara.policy"/>
+
+      <!-- third party libraries -->
+      <zipfileset src="${lib.dir}/${log4j.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${icu4j.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${activation.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${beep.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jargs.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jrdf.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jetty.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jetty.plus.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${servlet.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jasper.runtime.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jasper.compiler.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${lucene.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${mail.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${mulgara-sparql.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${castor-xml.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${castor-xml-schema.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${castor-codegen.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${trove.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${date-utils.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${commons-logging.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${commons-httpclient.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${commons-codec.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${emory-util.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jotm.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jotm.jrmp.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${carol.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${howl.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jta.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jsr.173.api.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jsr.173.ri.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jca.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${saaj.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${axis.jar}" excludes="META-INF/**, log4j.properties"/>
+      <zipfileset src="${lib.dir}/${commons-discovery.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jaxrpc.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${wsdl4j.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jakarta-oro.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jena.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${antlr.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${serializer.jar}" excludes="META-INF/**"/>
+
+      <!-- core libraries -->
+      <zipfileset src="${bin.dir}/${query.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${driver.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${itql.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${sparql-int.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${rmi.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${server.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${server-beep.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${server-rmi.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${util.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${config.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${descriptor.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${server-local.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-spi.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-filesystem.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${store.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${store-xa.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${store-nodepool.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${store-nodepool-memory.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${store-nodepool-xa.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${store-stringpool.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${store-stringpool-memory.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${store-stringpool-xa.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${util-xa.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-null.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-file.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-http.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-lucene.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-memory.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-store.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-url.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-view.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${tuples.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${tuples-hybrid.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${content-mp3.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${content-n3.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${content-mbox.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${content-rdfxml.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${content-rio.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-nodetype.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-prefix.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-relational.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-distributed.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-xsd.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-test.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${resolver-jar.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${lib.dir}/${jid3.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${dtd.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${jrdf.base.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${rules.jar}" excludes="META-INF/**"/>
+      <zipfileset src="${bin.dir}/${krule.jar}" excludes="META-INF/**"/>
+
+
+      <!-- include pre-bundled webapps -->
+      <zipfileset dir="${bin.dir}" prefix="webapps"
+          includes="${webui.war}"/>
+      <zipfileset dir="${obj.dir}/war" prefix="webapps"
+          includes="webservices.war"/>
+      <zipfileset dir="${lib.dir}" prefix="lib" includes="barracuda-core*.jar"/>
+      <zipfileset file="${obj.dir}/mulgara-x-config.xml" prefix="conf" />
+
+      <!-- Schemas -->
+      <zipfileset dir="${basedir}/data" prefix="data"
+          includes="**/*.rdfs,**/*.rss,**/*.n3"/>
+
+      <zipfileset dir="${basedir}/docs" prefix="docs"
+          includes="**/*.html, **/*.css, **/images/*, **/images/icons/*, LEGAL.txt"/>
+      <zipfileset dir="${src.docs.dir}" prefix="docs"
+          includes="**/*.html, **/*.htm, **/*.gif, **/*.png, **/*.jpg, **/*.css, **/images/*, **/images/icons/*"/>
+
+      <fileset dir="${obj.dir}/jar/util/classes" includes="**/Bootstrap.class"/>
+      <fileset dir="${src.dir}/jar/dtd" includes="META-INF/**, DTD/**"/>      <!-- fileset dir="${obj.dir}/jar/dtd/classes"/ -->
+
+      <!-- HACK!!!!! -->
+      <!-- This will get the ARP parser working -->
+      <!-- Ignore the xerces DocumentBuilderFactory -->
+      <fileset dir="${obj.dir}/xerces" excludes="META_INF/**,META-INF/services/javax.xml.parsers.DocumentBuilderFactory"/>
+
+      <fileset dir="${obj.dir}/xerces" excludes="META_INF/**"/>
+      <!-- HACK!!!!! -->
+
+    </jar>
+  </target>
+
+  <!-- do a check for any changes made to the mulgara build -->
+  <!-- potentially not the most efficient checking performed -->
+  <target name="-embedded-dist-uptodate">
+
+    <uptodate property="embedded.dist.uptodate"
+       targetfile="${dist.dir}/${mulgara.jar}">
+
+      <srcfiles dir="${bin.dir}" includes="**/*"/>
+      <srcfiles dir="${conf.dir}" includes="**/*"/>
+      <srcfiles dir="${lib.dir}" includes="**/*"/>
+      <srcfiles dir="${data.dir}" includes="**/*"/>
+      <srcfiles dir="${obj.dir}/war" includes="webservices.war"/>
+      <srcfiles dir="${basedir}/docs" includes="**/*"/>
+    </uptodate>
+  </target>
+
+  <target name="create-manifest" depends="-prepare-build">
+
+    <mkdir dir="${obj.dir}/META-INF"/>
+
+    <!-- generate the core manifest -->
+    <manifest file="${obj.dir}/META-INF/MANIFEST_Mulgara_BASE.MF">
+      <attribute name="Main-Class" value="org.mulgara.triplestore.Main"/>
+    </manifest>
+
+    <!-- generate the bootstrap manifest -->
+    <manifest file="${obj.dir}/META-INF/MANIFEST_Mulgara_BOOTSTRAP.MF">
+
+      <attribute name="Main-Class" value="org.mulgara.util.Bootstrap"/>
+      <attribute name="Embedded-Main-Class" value="org.mulgara.server.EmbeddedMulgaraServer"/>
+    </manifest>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Meta testing target, updates source before running tests            -->
+  <!-- =================================================================== -->
+
+  <target name="test"
+          depends="dist, client-test, session-test, resolver-api-test, store-xa-test,
+                   utils-test, jxtest, store-stringpool-xa-loadtest, publish-summary"
+          description="Runs all tests (updates source first)">
+
+    <loadfile property="test.status.success" srcfile="${test.dir}/junit-summary.txt">
+      <filterchain>
+        <linecontainsregexp>
+          <regexp pattern="Success rate *100\.?0?0?%"/>
+        </linecontainsregexp>
+      </filterchain>
+    </loadfile>
+    <fail unless="test.status.success"/>
+  </target>
+
+  <target name="client-test"
+          depends="client-jrdf-test,
+                   demo-mp3-test, driver-test, itql-test, query-test,
+                   descriptor-test"
+          description="Runs client side tests">
+  </target>
+
+  <target name="session-test"
+          depends="jrdf-test, server-test,
+             server-beep-test, server-http-test, server-local-test,
+             server-rmi-test"
+          description="Runs session based tests">
+  </target>
+
+  <target name="resolver-api-test"
+    depends="content-mbox-test, content-mp3-test, content-n3-test,
+             content-rdfxml-test, content-rio-test,
+             resolver-test, resolver-null-test, resolver-file-test,
+             resolver-filesystem-test, resolver-jar-test, resolver-gis-test,
+             resolver-http-test, resolver-lucene-test,
+             resolver-nodetype-test, resolver-prefix-test, resolver-memory-test,
+             resolver-spi-test, resolver-store-test, resolver-relational-test,
+             resolver-url-test, resolver-view-test, resolver-xsd-test,
+             resolver-distributed-test, resolver-test-test,
+             store-stringpool-test"
+    description="Runs resolver API/SPI tests">
+  </target>
+
+  <target name="store-xa-test"
+    depends="store-nodepool-memory-test, store-nodepool-xa-test,
+             store-stringpool-memory-test,
+             store-stringpool-xa-test, tuples-test, tuples-hybrid-test"
+    description="Runs store -xa tests">
+  </target>
+
+  <target name="utils-test"
+    depends="ant-task-test, dtd-test, sofa-test, rules-test, krule-test, tag-test, util-test, util-xa-test"
+    description="Runs miscellaneous utility tests">
+  </target>
+
+  <target name="jxtest"
+    depends="jxunit-test"
+    description="Runs all jxunit based testing">
+  </target>
+
+  <target name="ideSupport" depends="dist,demo-mp3-jar,descriptor-wsdl-client.jar"
+    description="Builds necessary libraries for using the Eclipse IDE.">
+
+     <jar jarfile="${dist.dir}/ideSupport.jar">
+      <zipfileset dir="${obj.dir}/jar/itql/classes" includes="org/mulgara/itql/**"/>
+      <zipfileset dir="${obj.dir}/jar/itql/java" includes="org/mulgara/itql/lexer/lexer.dat"/>
+      <zipfileset dir="${obj.dir}/jar/itql/java" includes="org/mulgara/itql/parser/parser.dat"/>
+      <zipfileset dir="${obj.dir}/jar/config/classes" includes="org/mulgara/config/**"/>
+      <zipfileset dir="${obj.dir}/jar/util/classes" includes="org/mulgara/util/conversion/**"/>
+      <zipfileset dir="${obj.dir}/jar/server-rmi/classes" includes="org/mulgara/server/rmi/**"/>
+      <zipfileset dir="${obj.dir}/jar/server-rmi/classes" includes="edu/emory/**"/>
+	  <zipfileset dir="${obj.dir}/jar/demo-mp3/classes" includes="org/mulgara/demo/mp3/**"/>
+      <zipfileset dir="${obj.dir}/war/webui/classes" includes="org/mulgara/barracuda/**"/>
+      <zipfileset dir="${obj.dir}/war/webui/classes" includes="org/mulgara/webui/**"/>
+      <zipfileset dir="${basedir}" includes="conf/**"/>
+  	  <zipfileset dir="${obj.dir}/jar/descriptor-client/classes" includes="org/mulgara/descriptor/**" excludes="org/mulgara/descriptor/test/**"/>
+      <!-- include pre-bundled webapps -->
+      <zipfileset dir="${bin.dir}" prefix="webapps" includes="${webui.war}"/>
+      <zipfileset dir="${obj.dir}/war" prefix="webapps" includes="webservices.war"/>
+      <zipfileset dir="${lib.dir}" prefix="lib" includes="barracuda*.jar"/>
+      <zipfileset file="${obj.dir}/mulgara-x-config.xml" prefix="conf" />
+
+      <!-- Schemas -->
+      <zipfileset dir="${basedir}/data" prefix="data" includes="**/*.rdfs,**/*.rss,**/*.n3"/>
+
+      <zipfileset dir="${basedir}/docs" prefix="docs" includes="**/*.html, **/*.css, **/images/*, **/images/icons/*, LEGAL.txt"/>
+      <zipfileset dir="${src.docs.dir}" prefix="docs" includes="**/*.html, **/*.htm, **/*.gif, **/*.png, **/*.jpg, **/*.css, **/images/*, **/images/icons/*"/>
+
+      <fileset dir="${src.dir}/jar/dtd" includes="META-INF/**, DTD/**"/>     
+
+    </jar>
+  </target>
+
+  
+</project>

Modified: trunk/jxdata/iTQL/standard_queries/queryResult19.txt
===================================================================
--- trunk/jxdata/iTQL/standard_queries/queryResult19.txt	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/jxdata/iTQL/standard_queries/queryResult19.txt	2008-05-22 19:21:05 UTC (rev 957)
@@ -1,3 +1,3 @@
 ItqlInterpreter error - Unable to connect to a server
-Caused by: (SessionFactoryFinderException) Couldn't create session factory for rmi://localhost/server2
+Caused by: (SessionFactoryFinderException) Couldn't create session factory for @server2@
 Caused by: (ClassNotFoundException) org.mulgara.server.local.LocalSessionFactory

Modified: trunk/jxdata/iTQL/standard_queries/test.jxu
===================================================================
--- trunk/jxdata/iTQL/standard_queries/test.jxu	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/jxdata/iTQL/standard_queries/test.jxu	2008-05-22 19:21:05 UTC (rev 957)
@@ -1,308 +1,308 @@
-<jxu>
-  <set name="debug" value="false" />
-
-  <set name="modelName" value="@server@#model1" />
-  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/data.rdf&gt; into &lt;@server@#model1&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result1.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult.xml"/>
-    <fail>Output failed.  Check badLoadResult.xml for output.</fail>
-  </ifEqual>
-
-  <set name="modelName" value="@server@#model2" />
-  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/coins.rdf&gt; into &lt;@server@#model2&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result2.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult2.xml"/>
-    <fail>Output failed.  Check badLoadResult2.xml for output.</fail>
-  </ifEqual>
-
-  <set name="modelName" value="@server@#model3" />
-  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/security-tks.rdf&gt; into &lt;@server@#model3&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result3.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult3.xml"/>
-    <fail>Output failed.  Check badLoadResult3.xml for output.</fail>
-  </ifEqual>
-
-  <!--  Add a dummy model to test duplicate constraint bug -->
-  <set name="modelName" value="@server@#allsame2" />
-  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/testpred.rdf&gt; into &lt;@server@#allsame2&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result8.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult8.xml"/>
-    <fail>Output failed.  Check badLoadResult8.xml for output.</fail>
-  </ifEqual>
-
-  <set name="modelName" value="@server@#allsame" />
-  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/testsame.rdf&gt; into &lt;@server@#allsame&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result4.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult4.xml"/>
-    <fail>Output failed.  Check badLoadResult4.xml for output.</fail>
-  </ifEqual>
-
-  <set name="query" value="select $pmid $title from &lt;@server@#model1&gt; where $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#year&gt; '2000' and $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#month&gt; '08' and $pmid &lt;urn:medline:creationDate&gt; $date and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title order by $pmid $title;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult1.txt" name="queryResult">
-    <save name="queryResult" file="badQuery1Result.xml"/>
-    <fail>Output failed.  Check badQuery1Result.xml for output.</fail>
-  </ifEqual>
-
-  <set name="query" value="select $pmid $title from &lt;@server@#model1&gt; where ( $pmid &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Birds' or $pmid &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Bird Diseases' )  and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title order by $pmid $title;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult2.txt" name="queryResult">
-    <save name="queryResult" file="badQuery2Result.xml"/>
-    <fail>Output failed.  Check badQuery2Result.xml for output.</fail>
-  </ifEqual>
-
-
-  <!-- check for invalid model name -->
-
-  <set name="query" value="select $pmid $title from &lt;@server@#badmodel&gt; where ( $pmid &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Birds' or $pmid &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Bird Diseases' )  and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title order by $pmid $title;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult3.txt" name="queryResult">
-    <save name="queryResult" file="badQuery3Result.xml"/>
-    <fail>Output failed.  Check badQuery3Result.xml for output.</fail>
-  </ifEqual>
-
-  <set name="query"
-  value="select $pmid2 $title from &lt;@server@#model1&gt; where $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#year&gt; '2000' and $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#month&gt; '08' and $pmid &lt;urn:medline:creationDate&gt; $date and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title order by $pmid $title;"/>
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult4.txt" name="queryResult">
-    <save name="queryResult" file="badQuery4Result.xml"/>
-    <fail>Output failed.  Check badQuery4Result.xml for output.</fail>
-  </ifEqual>
-
-
-  <!-- Check for prefix use of HybridTuples -->
-
-  <set name="query" value="select $coin $metal $shape from &lt;@server@#model2&gt; where ( ($coin &lt;coin:metal&gt; $metal) or ($coin &lt;coin:shape&gt; $shape) ) and ( ($metal &lt;coin:value&gt; &lt;coin:high&gt;) or ($shape &lt;coin:surface&gt; &lt;coin:smooth&gt;) ) order by $coin $metal $shape ;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult5.txt" name="queryResult">
-    <save name="queryResult" file="badQuery5Result.xml"/>
-    <fail>Output failed.  Check badQuery5Result.xml for output.</fail>
-  </ifEqual>
-
-<!-- Check for conjunction/disjunction bug -->
-
-  <set name="query" value="select $predicate $object from &lt;@server@#model3&gt; where &lt;http://mulgara.org/mulgara#user/test&gt; $predicate $object and ( $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canCreate&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canRead&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canWrite&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canDelete&gt; ) order by $predicate $object ;" />
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult6.txt" name="queryResult">
-    <save name="queryResult" file="badQuery6Result.xml"/>
-    <fail>Output failed.  Check badQuery6Result.xml for output.</fail>
-  </ifEqual>
-
-  <set name="query" value="select $subject $predicate $object from &lt;@server@#model3&gt; where $subject $predicate $object and $subject &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#user/test&gt; and ( $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canCreate&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canRead&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canWrite&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canDelete&gt; ) order by $predicate $object ;" />
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult7.txt" name="queryResult">
-    <save name="queryResult" file="badQuery7Result.xml"/>
-    <fail>Output failed.  Check badQuery7Result.xml for output.</fail>
-  </ifEqual>
-
-  <set name="query" value="select $predicate $object from &lt;@server@#model3&gt; where &lt;http://mulgara.org/mulgara#group/dev&gt; $predicate $object and ( $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canCreate&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canRead&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canWrite&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canDelete&gt; ) order by $predicate $object ;" />
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult8.txt" name="queryResult">
-    <save name="queryResult" file="badQuery8Result.xml"/>
-    <fail>Output failed.  Check badQuery8Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Test positive result (true) with empty select -->
-  <set name="query" value="
-    select
-    from &lt;@server@#model1&gt;
-    where &lt;urn:pmid:10941725&gt; &lt;http://mulgara.org/mulgara/Document#title&gt; 'Methylmercury accumulation in tissues and its effects on growth and appetite in captive great egrets.' ;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult9.txt" name="queryResult">
-    <save name="queryResult" file="badQuery9Result.xml"/>
-    <fail>Output failed.  Check badQuery9Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Test positive result (true) with completely constrained results joined with empty select -->
-  <set name="query" value="
-    select
-    from &lt;@server@#model1&gt;
-    where &lt;urn:pmid:10941725&gt; &lt;http://mulgara.org/mulgara/Document#title&gt; 'Methylmercury accumulation in tissues and its effects on growth and appetite in captive great egrets.' 
-    and &lt;urn:pmid:10941725&gt; &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Selenium; pharmacokinetics' ;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult10.txt" name="queryResult">
-    <save name="queryResult" file="badQuery10Result.xml"/>
-    <fail>Output failed.  Check badQuery10Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Test negative result (false) empty select -->
-  <set name="query" value="
-  select
-  from &lt;@server@#model1&gt;
-  where &lt;urn:pmid:pmid&gt; &lt;urn:pmid:pmid&gt; &lt;urn:pmid:pmid&gt; ;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult11.txt" name="queryResult">
-    <save name="queryResult" file="badQuery11Result.xml"/>
-    <fail>Output failed.  Check badQuery11Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Test positive result (true) with variable constraints joined -->
-  <set name="query" value="
-  select
-  from &lt;@server@#model1&gt;
-  where $s &lt;http://mulgara.org/mulgara/Document#subject&gt; $o 
-  and $o &lt;urn:cas:name&gt; $o2 ;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult12.txt" name="queryResult">
-    <save name="queryResult" file="badQuery12Result.xml"/>
-    <fail>Output failed.  Check badQuery12Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Test multiple variables in the select clause -->
-  <set name="query" value="
-  select $pmid $pmid $title $pmid 
-  from &lt;@server@#model1&gt; 
-  where $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#year&gt; '2000' 
-  and $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#month&gt; '08' 
-  and $pmid &lt;urn:medline:creationDate&gt; $date 
-  and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title 
-  order by $pmid $title;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult13.txt" name="queryResult">
-    <save name="queryResult" file="badQuery13Result.xml"/>
-    <fail>Output failed.  Check badQuery13Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Check three duplicated variable constraints -->
-  <set name="query" value="
-    select $x
-    from &lt;@server@#allsame&gt;
-    where $x $x $x
-    order by $x;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult14.txt" name="queryResult">
-    <save name="queryResult" file="badQuery14Result.xml"/>
-    <fail>Output failed.  Check badQuery14Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Check two duplicated variable constraints -->
-  <set name="query" value="
-    select $x
-    from &lt;@server@#allsame&gt;
-    where $x &lt;urn:test:property&gt; $x
-    order by $x ;"/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult15.txt" name="queryResult">
-    <save name="queryResult" file="badQuery15Result.xml"/>
-    <fail>Output failed.  Check badQuery15Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- local and remote model loading -->
-  <set name="modelName" value="@server@#model4" />
-  <set name="loadCommand" value="load local &lt;@baseuri@/jxdata/iTQL/data.rdf&gt; into &lt;@server@#model4&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result5.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult5.xml"/>
-    <fail>Output failed.  Check badLoadResult5.xml for output.</fail>
-  </ifEqual>
-
-  <set name="modelName" value="@server@#model5" />
-  <set name="loadCommand" value="load local &lt;@baseuri@/jxdata/iTQL/coins.rdf&gt; into &lt;@server@#model5&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result6.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult6.xml"/>
-    <fail>Output failed.  Check badLoadResult6.xml for output.</fail>
-  </ifEqual>
-
-  <set name="modelName" value="@server@#model6" />
-  <set name="loadCommand" value="load remote &lt;@baseuri@/jxdata/iTQL/security-tks.rdf&gt; into &lt;@server@#model6&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result7.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult7.xml"/>
-    <fail>Output failed.  Check badLoadResult7.xml for output.</fail>
-  </ifEqual>
-
-  <!-- jar loading -->
-  <set name="modelName" value="@server@#model7" />
-  <set name="loadCommand" value="load remote &lt;jar:@baseuri@/dist/@mulgara.jar@!/data/w3c-news.rss&gt; into &lt;@server@#model7&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result9.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult9.xml"/>
-    <fail>Output failed.  Check badLoadResult9.xml for output.</fail>
-  </ifEqual>
-
-  <set name="modelName" value="@server@#model7" />
-  <set name="loadCommand" value="load local &lt;jar:@baseuri@/dist/@mulgara.jar@!/data/w3c-news.rss&gt; into &lt;@server@#model7&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result9.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult9.xml"/>
-    <fail>Output failed.  Check badLoadResult9.xml for output.</fail>
-  </ifEqual>
-
-  <set name="modelName" value="@server@#model8" />
-  <set name="loadCommand" value="load local &lt;@baseuri@/jxdata/iTQL/numbers.rdf.gz&gt; into &lt;@server@#model8&gt; ;" />
-  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
-
-  <ifEqual converse="true" file="result10.txt" name="loadResult">
-    <save name="loadResult" file="badLoadResult10.xml"/>
-    <fail>Output failed.  Check badLoadResult10.xml for output.</fail>
-  </ifEqual>
-
-  <set name="query" value="
-    select $model
-    from &lt;@server@#&gt;
-    where $model &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; $type
-    and $s $p $o in $model ; "/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-
-  <!-- Test error message for non-existant model -->
-  <set name="query" value="
-    insert &lt;http://test.com/&gt;
-      &lt;http://cdls.nstl.gov.cn/cdls2/w3c/2003/Metadata/elements/title&gt;
-      &apos;test2 escape char &lt;&apos; into &lt;rmi://localhost/server1#nomodelexistswiththisname&gt; ; "/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult17.txt" name="queryResult">
-    <save name="queryResult" file="badQuery17Result.xml"/>
-    <fail>Output failed.  Check badQuery17Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Test error message for opaque URI for model name -->
-  <set name="query" value="
-    select $s $p $o from &lt;mailto:foo at bar.com&gt; where $s $p $o ; "/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult18.txt" name="queryResult">
-    <save name="queryResult" file="badQuery18Result.xml"/>
-    <fail>Output failed.  Check badQuery18Result.xml for output.</fail>
-  </ifEqual>
-
-  <!-- Test error message for non-existant server -->
-  <set name="query" value="
-    insert &lt;http://test.com/&gt;
-      &lt;http://cdls.nstl.gov.cn/cdls2/w3c/2003/Metadata/elements/title&gt;
-      &apos;test2 escape char &lt;&apos; into &lt;rmi://localhost/server2#nomodelexistswiththisname&gt; ; "/>
-
-  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
-  <ifEqual converse="true" file="queryResult19.txt" name="queryResult">
-    <save name="queryResult" file="badQuery19Result.xml"/>
-    <fail>Output failed.  Check badQuery19Result.xml for output.</fail>
-  </ifEqual>
-</jxu>
+<jxu>
+  <set name="debug" value="false" />
+
+  <set name="modelName" value="@server@#model1" />
+  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/data.rdf&gt; into &lt;@server@#model1&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result1.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult.xml"/>
+    <fail>Output failed.  Check badLoadResult.xml for output.</fail>
+  </ifEqual>
+
+  <set name="modelName" value="@server@#model2" />
+  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/coins.rdf&gt; into &lt;@server@#model2&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result2.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult2.xml"/>
+    <fail>Output failed.  Check badLoadResult2.xml for output.</fail>
+  </ifEqual>
+
+  <set name="modelName" value="@server@#model3" />
+  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/security-tks.rdf&gt; into &lt;@server@#model3&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result3.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult3.xml"/>
+    <fail>Output failed.  Check badLoadResult3.xml for output.</fail>
+  </ifEqual>
+
+  <!--  Add a dummy model to test duplicate constraint bug -->
+  <set name="modelName" value="@server@#allsame2" />
+  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/testpred.rdf&gt; into &lt;@server@#allsame2&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result8.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult8.xml"/>
+    <fail>Output failed.  Check badLoadResult8.xml for output.</fail>
+  </ifEqual>
+
+  <set name="modelName" value="@server@#allsame" />
+  <set name="loadCommand" value="load &lt;@baseuri@/jxdata/iTQL/testsame.rdf&gt; into &lt;@server@#allsame&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result4.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult4.xml"/>
+    <fail>Output failed.  Check badLoadResult4.xml for output.</fail>
+  </ifEqual>
+
+  <set name="query" value="select $pmid $title from &lt;@server@#model1&gt; where $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#year&gt; '2000' and $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#month&gt; '08' and $pmid &lt;urn:medline:creationDate&gt; $date and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title order by $pmid $title;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult1.txt" name="queryResult">
+    <save name="queryResult" file="badQuery1Result.xml"/>
+    <fail>Output failed.  Check badQuery1Result.xml for output.</fail>
+  </ifEqual>
+
+  <set name="query" value="select $pmid $title from &lt;@server@#model1&gt; where ( $pmid &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Birds' or $pmid &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Bird Diseases' )  and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title order by $pmid $title;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult2.txt" name="queryResult">
+    <save name="queryResult" file="badQuery2Result.xml"/>
+    <fail>Output failed.  Check badQuery2Result.xml for output.</fail>
+  </ifEqual>
+
+
+  <!-- check for invalid model name -->
+
+  <set name="query" value="select $pmid $title from &lt;@server@#badmodel&gt; where ( $pmid &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Birds' or $pmid &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Bird Diseases' )  and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title order by $pmid $title;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult3.txt" name="queryResult">
+    <save name="queryResult" file="badQuery3Result.xml"/>
+    <fail>Output failed.  Check badQuery3Result.xml for output.</fail>
+  </ifEqual>
+
+  <set name="query"
+  value="select $pmid2 $title from &lt;@server@#model1&gt; where $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#year&gt; '2000' and $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#month&gt; '08' and $pmid &lt;urn:medline:creationDate&gt; $date and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title order by $pmid $title;"/>
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult4.txt" name="queryResult">
+    <save name="queryResult" file="badQuery4Result.xml"/>
+    <fail>Output failed.  Check badQuery4Result.xml for output.</fail>
+  </ifEqual>
+
+
+  <!-- Check for prefix use of HybridTuples -->
+
+  <set name="query" value="select $coin $metal $shape from &lt;@server@#model2&gt; where ( ($coin &lt;coin:metal&gt; $metal) or ($coin &lt;coin:shape&gt; $shape) ) and ( ($metal &lt;coin:value&gt; &lt;coin:high&gt;) or ($shape &lt;coin:surface&gt; &lt;coin:smooth&gt;) ) order by $coin $metal $shape ;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult5.txt" name="queryResult">
+    <save name="queryResult" file="badQuery5Result.xml"/>
+    <fail>Output failed.  Check badQuery5Result.xml for output.</fail>
+  </ifEqual>
+
+<!-- Check for conjunction/disjunction bug -->
+
+  <set name="query" value="select $predicate $object from &lt;@server@#model3&gt; where &lt;http://mulgara.org/mulgara#user/test&gt; $predicate $object and ( $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canCreate&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canRead&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canWrite&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canDelete&gt; ) order by $predicate $object ;" />
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult6.txt" name="queryResult">
+    <save name="queryResult" file="badQuery6Result.xml"/>
+    <fail>Output failed.  Check badQuery6Result.xml for output.</fail>
+  </ifEqual>
+
+  <set name="query" value="select $subject $predicate $object from &lt;@server@#model3&gt; where $subject $predicate $object and $subject &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#user/test&gt; and ( $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canCreate&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canRead&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canWrite&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canDelete&gt; ) order by $predicate $object ;" />
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult7.txt" name="queryResult">
+    <save name="queryResult" file="badQuery7Result.xml"/>
+    <fail>Output failed.  Check badQuery7Result.xml for output.</fail>
+  </ifEqual>
+
+  <set name="query" value="select $predicate $object from &lt;@server@#model3&gt; where &lt;http://mulgara.org/mulgara#group/dev&gt; $predicate $object and ( $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canCreate&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canRead&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canWrite&gt; or $predicate &lt;http://mulgara.org/mulgara#is&gt; &lt;http://mulgara.org/mulgara#canDelete&gt; ) order by $predicate $object ;" />
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult8.txt" name="queryResult">
+    <save name="queryResult" file="badQuery8Result.xml"/>
+    <fail>Output failed.  Check badQuery8Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Test positive result (true) with empty select -->
+  <set name="query" value="
+    select
+    from &lt;@server@#model1&gt;
+    where &lt;urn:pmid:10941725&gt; &lt;http://mulgara.org/mulgara/Document#title&gt; 'Methylmercury accumulation in tissues and its effects on growth and appetite in captive great egrets.' ;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult9.txt" name="queryResult">
+    <save name="queryResult" file="badQuery9Result.xml"/>
+    <fail>Output failed.  Check badQuery9Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Test positive result (true) with completely constrained results joined with empty select -->
+  <set name="query" value="
+    select
+    from &lt;@server@#model1&gt;
+    where &lt;urn:pmid:10941725&gt; &lt;http://mulgara.org/mulgara/Document#title&gt; 'Methylmercury accumulation in tissues and its effects on growth and appetite in captive great egrets.' 
+    and &lt;urn:pmid:10941725&gt; &lt;http://mulgara.org/mulgara/Document#subject&gt; 'Selenium; pharmacokinetics' ;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult10.txt" name="queryResult">
+    <save name="queryResult" file="badQuery10Result.xml"/>
+    <fail>Output failed.  Check badQuery10Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Test negative result (false) empty select -->
+  <set name="query" value="
+  select
+  from &lt;@server@#model1&gt;
+  where &lt;urn:pmid:pmid&gt; &lt;urn:pmid:pmid&gt; &lt;urn:pmid:pmid&gt; ;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult11.txt" name="queryResult">
+    <save name="queryResult" file="badQuery11Result.xml"/>
+    <fail>Output failed.  Check badQuery11Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Test positive result (true) with variable constraints joined -->
+  <set name="query" value="
+  select
+  from &lt;@server@#model1&gt;
+  where $s &lt;http://mulgara.org/mulgara/Document#subject&gt; $o 
+  and $o &lt;urn:cas:name&gt; $o2 ;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult12.txt" name="queryResult">
+    <save name="queryResult" file="badQuery12Result.xml"/>
+    <fail>Output failed.  Check badQuery12Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Test multiple variables in the select clause -->
+  <set name="query" value="
+  select $pmid $pmid $title $pmid 
+  from &lt;@server@#model1&gt; 
+  where $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#year&gt; '2000' 
+  and $date &lt;http://mulgara.org/mulgara/tool/DateExtractor#month&gt; '08' 
+  and $pmid &lt;urn:medline:creationDate&gt; $date 
+  and $pmid &lt;http://mulgara.org/mulgara/Document#title&gt; $title 
+  order by $pmid $title;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult13.txt" name="queryResult">
+    <save name="queryResult" file="badQuery13Result.xml"/>
+    <fail>Output failed.  Check badQuery13Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Check three duplicated variable constraints -->
+  <set name="query" value="
+    select $x
+    from &lt;@server@#allsame&gt;
+    where $x $x $x
+    order by $x;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult14.txt" name="queryResult">
+    <save name="queryResult" file="badQuery14Result.xml"/>
+    <fail>Output failed.  Check badQuery14Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Check two duplicated variable constraints -->
+  <set name="query" value="
+    select $x
+    from &lt;@server@#allsame&gt;
+    where $x &lt;urn:test:property&gt; $x
+    order by $x ;"/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult15.txt" name="queryResult">
+    <save name="queryResult" file="badQuery15Result.xml"/>
+    <fail>Output failed.  Check badQuery15Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- local and remote model loading -->
+  <set name="modelName" value="@server@#model4" />
+  <set name="loadCommand" value="load local &lt;@baseuri@/jxdata/iTQL/data.rdf&gt; into &lt;@server@#model4&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result5.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult5.xml"/>
+    <fail>Output failed.  Check badLoadResult5.xml for output.</fail>
+  </ifEqual>
+
+  <set name="modelName" value="@server@#model5" />
+  <set name="loadCommand" value="load local &lt;@baseuri@/jxdata/iTQL/coins.rdf&gt; into &lt;@server@#model5&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result6.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult6.xml"/>
+    <fail>Output failed.  Check badLoadResult6.xml for output.</fail>
+  </ifEqual>
+
+  <set name="modelName" value="@server@#model6" />
+  <set name="loadCommand" value="load remote &lt;@baseuri@/jxdata/iTQL/security-tks.rdf&gt; into &lt;@server@#model6&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result7.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult7.xml"/>
+    <fail>Output failed.  Check badLoadResult7.xml for output.</fail>
+  </ifEqual>
+
+  <!-- jar loading -->
+  <set name="modelName" value="@server@#model7" />
+  <set name="loadCommand" value="load remote &lt;jar:@baseuri@/dist/@mulgara.jar@!/data/w3c-news.rss&gt; into &lt;@server@#model7&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result9.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult9.xml"/>
+    <fail>Output failed.  Check badLoadResult9.xml for output.</fail>
+  </ifEqual>
+
+  <set name="modelName" value="@server@#model7" />
+  <set name="loadCommand" value="load local &lt;jar:@baseuri@/dist/@mulgara.jar@!/data/w3c-news.rss&gt; into &lt;@server@#model7&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result9.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult9.xml"/>
+    <fail>Output failed.  Check badLoadResult9.xml for output.</fail>
+  </ifEqual>
+
+  <set name="modelName" value="@server@#model8" />
+  <set name="loadCommand" value="load local &lt;@baseuri@/jxdata/iTQL/numbers.rdf.gz&gt; into &lt;@server@#model8&gt; ;" />
+  <eval stepClass="org.mulgara.store.jxunit.LoadDataJX" />
+
+  <ifEqual converse="true" file="result10.txt" name="loadResult">
+    <save name="loadResult" file="badLoadResult10.xml"/>
+    <fail>Output failed.  Check badLoadResult10.xml for output.</fail>
+  </ifEqual>
+
+  <set name="query" value="
+    select $model
+    from &lt;@server@#&gt;
+    where $model &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; $type
+    and $s $p $o in $model ; "/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+
+  <!-- Test error message for non-existant model -->
+  <set name="query" value="
+    insert &lt;http://test.com/&gt;
+      &lt;http://cdls.nstl.gov.cn/cdls2/w3c/2003/Metadata/elements/title&gt;
+      &apos;test2 escape char &lt;&apos; into &lt;rmi://localhost/server1#nomodelexistswiththisname&gt; ; "/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult17.txt" name="queryResult">
+    <save name="queryResult" file="badQuery17Result.xml"/>
+    <fail>Output failed.  Check badQuery17Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Test error message for opaque URI for model name -->
+  <set name="query" value="
+    select $s $p $o from &lt;mailto:foo at bar.com&gt; where $s $p $o ; "/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult18.txt" name="queryResult">
+    <save name="queryResult" file="badQuery18Result.xml"/>
+    <fail>Output failed.  Check badQuery18Result.xml for output.</fail>
+  </ifEqual>
+
+  <!-- Test error message for non-existant server -->
+  <set name="query" value="
+    insert &lt;http://test.com/&gt;
+      &lt;http://cdls.nstl.gov.cn/cdls2/w3c/2003/Metadata/elements/title&gt;
+      &apos;test2 escape char &lt;&apos; into &lt;@server2@#nomodelexistswiththisname&gt; ; "/>
+
+  <eval stepClass="org.mulgara.store.jxunit.QueryJX" />
+  <ifEqual converse="true" file="queryResult19.txt" name="queryResult">
+    <save name="queryResult" file="badQuery19Result.xml"/>
+    <fail>Output failed.  Check badQuery19Result.xml for output.</fail>
+  </ifEqual>
+</jxu>

Modified: trunk/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java
===================================================================
--- trunk/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -176,6 +176,17 @@
 
     junit.textui.TestRunner.run(suite());
   }
+  
+  /**
+   * Convert Windows line endings...
+   */
+  private static String convertLineEndings(String str) {
+    String converted = str;
+    if (System.getProperty("os.name").toLowerCase().indexOf("win") > -1) {
+      converted = converted.replaceAll("\r\n", "\n");
+    }
+    return converted;
+  }
 
   /**
    * Test the interpreter via a direct call and a SOAP call
@@ -189,6 +200,7 @@
         "/server1#> where $s $p $o ;";
 
     String directAnswer = bean.executeQueryToString(queryString);
+    directAnswer = convertLineEndings(directAnswer);
     String soapAnswer = this.executeSoapCall(queryString);
 
     assertEquals(
@@ -205,6 +217,7 @@
 
     String queryString = "create <rmi://" + hostName + "/server1#model> ;";
     String directAnswer = bean.executeQueryToString(queryString);
+    directAnswer = convertLineEndings(directAnswer);
     String soapAnswer = this.executeSoapCall(queryString);
 
     assertEquals("A CREATE SOAP iTQL result is not the same as a direct call",
@@ -222,13 +235,12 @@
         "insert <http://google.blogspace.com/archives/000999836> <http://purl.org/rss/1.0/description> 'Google needs to stop sending it\\'s cookie and promise to only store aggregate data, with no connection between users and search terms. ; This issue was publically raised almost a year ago that Google still hasnt dealt with its inexcusable....' into <rmi://" +
         hostName + "/server1#model>;";
 
-    String lineChar = System.getProperty("line.separator");
-
     String result =
-        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + lineChar + "<answer xmlns=\"http://mulgara.org/tql#\"><query><message>Successfully inserted statements into rmi://" +
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<answer xmlns=\"http://mulgara.org/tql#\"><query><message>Successfully inserted statements into rmi://" +
         hostName + "/server1#model</message></query></answer>";
 
     String directAnswer = bean.executeQueryToString(queryString);
+    directAnswer = convertLineEndings(directAnswer);
     String soapAnswer = this.executeSoapCall(queryString);
 
     if (log.isDebugEnabled()) {
@@ -688,6 +700,7 @@
    *
    * @throws Exception if the test fails
    */
+  @SuppressWarnings("deprecation")
   public void testRestoreApi1() throws Exception {
 
     // log that we're executing the test
@@ -708,6 +721,7 @@
    *
    * @throws Exception if the test fails
    */
+  @SuppressWarnings("deprecation")
   public void testRoundTrip1() throws Exception {
 
     // log that we're executing the test
@@ -833,6 +847,7 @@
    *
    * @throws Exception if the test fails
    */
+  @SuppressWarnings("deprecation")
   public void testExplicitSession() throws Exception {
 
     // log that we're executing the test

Modified: trunk/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java
===================================================================
--- trunk/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -12,9 +12,8 @@
 package org.mulgara.itql;
 
 import java.net.URI;
-import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
@@ -68,7 +67,7 @@
   private boolean inTransaction;
 
   /** All the connections involved in the current transaction. */
-  private Collection<Connection> transConnections = new LinkedList<Connection>();
+  private Map<URI,Connection> transConnections = new HashMap<URI,Connection>();
   
   /**
    * Holds the client security domain. Need to connect this to URIs,
@@ -211,8 +210,11 @@
     if (serverUri == null && !cmd.isLocalOperation()) {
       // no server URI, but not local. Get a connection for a null URI
       // eg. select .... from <file:///...>
-      Connection connection = connectionFactory.newConnection(serverUri);
-      configureForTransaction(connection);
+      Connection connection = transConnections.get(serverUri);
+      if (connection == null) {
+        connection = connectionFactory.newConnection(serverUri);
+        configureForTransaction(serverUri, connection);
+      }
       return connection;
     }
     
@@ -233,9 +235,18 @@
    */
   Connection establishConnection(URI serverUri) throws ConnectionException, QueryException {
     // get a new connection, or use the local one for non-server operations
-    Connection connection = (serverUri == null) ? localStateConnection : connectionFactory.newConnection(serverUri);
-    // update the connection if it needs to enter a current transaction
-    configureForTransaction(connection);
+    Connection connection = null;
+    if (serverUri == null) {
+      connection = localStateConnection;
+    } else {
+      serverUri = ConnectionFactory.normalizeLocalUri(serverUri);
+      connection = transConnections.get(serverUri);
+      if (connection == null) {
+        connection = connectionFactory.newConnection(serverUri);
+        // update the connection if it needs to enter a current transaction
+        configureForTransaction(serverUri, connection);
+      }
+    }
     return connection;
   }
 
@@ -245,13 +256,13 @@
    * @param connection The connection to configure. The dummy connection is not configured.
    * @throws QueryException An error while setting up the connection for the transaction.
    */
-  private void configureForTransaction(Connection connection) throws QueryException {
+  private void configureForTransaction(URI serverUri, Connection connection) throws QueryException {
     // If in a transaction, turn off autocommit - ignore the dummy connection
     if (inTransaction && connection.getAutoCommit() && connection != localStateConnection) {
       assert !(connection instanceof DummyConnection);
       connection.setAutoCommit(false);
-      assert !transConnections.contains(connection);
-      transConnections.add(connection);
+      assert !transConnections.containsValue(connection);
+      transConnections.put(serverUri, connection);
     }
   }
 
@@ -367,7 +378,7 @@
     String errorMessage = null;
 
     // Operate on all outstanding transactions.
-    Iterator<Connection> c = transConnections.iterator();
+    Iterator<Connection> c = transConnections.values().iterator();
     while (c.hasNext()) {
       try {
         // do the work

Modified: trunk/src/jar/query/build.xml
===================================================================
--- trunk/src/jar/query/build.xml	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/query/build.xml	2008-05-22 19:21:05 UTC (rev 957)
@@ -1,167 +1,171 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE project>
-
-<!-- =================================================================== -->
-<!--                       Project definition                            -->
-<!-- =================================================================== -->
-<project name="query" default="query-jar" basedir="../../..">
-
-  <!-- =================================================================== -->
-  <!--                      Property Definitions                           -->
-  <!-- =================================================================== -->
-
-  <!-- =================================================================== -->
-  <!--                              Imports                                -->
-  <!-- =================================================================== -->
-
-  <!-- =================================================================== -->
-  <!--                          Path Definitions                           -->
-  <!-- =================================================================== -->
-  <path id="query-classpath">
-
-    <path refid="common-classpath"/>
-    <fileset file="${util.dist.dir}/${util.jar}"/>
-    <fileset file="${rules.dist.dir}/${rules.jar}"/>
-  </path>
-
-  <path id="query-test-classpath">
-
-    <path refid="query-classpath"/>
-
-    <fileset file="${query.dist.dir}/${query.jar}"/>
-    <fileset file="${rules.dist.dir}/${rules.jar}"/>
-  </path>
-
-  <target name="query-clean"
-          description="Removes all compile generated files for the query">
-
-    <tstamp/>
-
-    <delete dir="${query.obj.dir}"/>
-    <delete dir="${query.test.dir}"/>
-    <delete dir="${query.dist.dir}"/>
-  </target>
-
-  <target name="-query-prepare"
-          description="Creates all directories associated with the query's
-                       compilation"
-          depends="-prepare-build">
-
-    <mkdir dir="${query.obj.dir}"/>
-    <mkdir dir="${query.test.dir}"/>
-    <mkdir dir="${query.dist.dir}"/>
-    <mkdir dir="${query.obj.dir}/classes"/>
-    <mkdir dir="${query.obj.dir}/classes/conf"/>
-    <mkdir dir="${query.obj.dir}/java"/>
-  </target>
-
-  <target name="-query-unjar-config"
-          depends="-query-unjar-config-uptodate"
-          unless="query.unjar.config.uptodate">
-
-    <unjar src="${bin.dir}/${config.jar}" dest="${query.obj.dir}/classes"/>
-  </target>
-
-  <target name="-query-unjar-config-uptodate">
-
-    <available file="${query.obj.dir}/classes/org/mulgara/config/MulgaraConfig.class"
-               property="query.unjar.config.uptodate"/>
-  </target>
-
-  <target name="query-compile"
-          depends="-query-prepare, util-jar, rules-jar, config-jar, -query-unjar-config"
-          description="Compiles all query related files included generated
-                       source code"
-          unless="query.classes.uptodate">
-
-    <javac destdir="${query.obj.dir}/classes" debug="on"
-           deprecation="on" source="1.5">
-
-      <classpath refid="query-classpath"/>
-
-      <src path="${driver.src.dir}/java"/>
-      <src path="${query.src.dir}/java"/>
-    </javac>
-  </target>
-
-  <target name="query-jar"
-          depends="query-compile, config-database, -query-jar-uptodate"
-          unless="query.jar.uptodate"
-          description="Creates the query's jar/s">
-
-    <copy file="${obj.dir}/mulgara-x-config.xml"
-          tofile="${query.obj.dir}/classes/conf/mulgara-x-config.xml"/>
-
-    <jar jarfile="${query.dist.dir}/${query.jar}">
-
-      <fileset dir="${query.obj.dir}/classes"/>
-      <fileset dir="${query.obj.dir}/java" includes="**/*.dat"/>
-    </jar>
-  </target>
-
-  <target name="-query-jar-uptodate">
-
-    <uptodate property="query.jar.uptodate"
-              targetfile="${query.dist.dir}/${query.jar}">
-      <srcfiles dir="${query.obj.dir}" includes="**/*"/>
-    </uptodate>
-  </target>
-
-  <target name="query-dist"
-          depends="query-jar"
-          unless="query.uptodate"
-          description="Performs all tasks related to finalising this query
-                       and readying it for distribution">
-
-    <!-- All that's involved in the final version of the query library
-         is the jar so we don't need to do anything because the dependencies
-         take care of the work. -->
-  </target>
-
-  <target name="query-test"
-          depends="query-jar"
-          description="Carries out unit testing for this query">
-
-    <antcall target="component-test">
-
-      <param name="classpath.id" value="query-test-classpath"/>
-      <param name="dir" value="${query.src.dir}"/>
-      <param name="jar" value="${query.jar}"/>
-    </antcall>
-  </target>
-
-  <target name="query-javadoc"
-          depends="query-jar"
-          description="Creates the javadoc for this query">
-
-    <antcall target="javadoc">
-
-      <param name="javadoc.package" value="org.mulgara.query.*,
-                                           org.mulgara.server.*"/>
-      <param name="javadoc.classpath" value="query-classpath"/>
-      <param name="javadoc.sourcepath" value="${query.src.dir}/java"/>
-    </antcall>
-  </target>
-
-  <target name="query-help"
-          description="Displays the help information for this query">
-
-    <!-- This is similar to the main project's help except the information
-         is specific to this query -->
-
-    <echo message="Welcome to the build script for ${name}."/>
-    <echo message=""/>
-    <echo message="These targets can be invoked as follows:"/>
-    <echo message="  ./build.sh &lt;target&gt;"/>
-    <echo message=""/>
-
-    <java fork="false" classname="org.apache.tools.ant.Main"
-          newenvironment="false">
-
-      <jvmarg value="${arch.bits}"/>
-
-      <arg line="-buildfile ${query.src.dir}/build.xml -projecthelp"/>
-    </java>
-
-  </target>
-</project>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE project>
+
+<!-- =================================================================== -->
+<!--                       Project definition                            -->
+<!-- =================================================================== -->
+<project name="query" default="query-jar" basedir="../../..">
+
+  <!-- =================================================================== -->
+  <!--                      Property Definitions                           -->
+  <!-- =================================================================== -->
+
+  <!-- =================================================================== -->
+  <!--                              Imports                                -->
+  <!-- =================================================================== -->
+
+  <!-- =================================================================== -->
+  <!--                          Path Definitions                           -->
+  <!-- =================================================================== -->
+  <path id="query-classpath">
+
+    <path refid="common-classpath"/>
+    <fileset file="${util.dist.dir}/${util.jar}"/>
+    <fileset file="${rules.dist.dir}/${rules.jar}"/>
+  </path>
+
+  <path id="query-test-classpath">
+
+    <path refid="query-classpath"/>
+
+    <fileset file="${query.dist.dir}/${query.jar}"/>
+    <fileset file="${rules.dist.dir}/${rules.jar}"/>
+    <fileset file="${server-rmi.dist.dir}/${server-rmi.jar}"/>
+    <fileset file="${server-local.dist.dir}/${server-local.jar}"/>
+  </path>
+
+  <target name="query-clean"
+          description="Removes all compile generated files for the query">
+
+    <tstamp/>
+
+    <delete dir="${query.obj.dir}"/>
+    <delete dir="${query.test.dir}"/>
+    <delete dir="${query.dist.dir}"/>
+  </target>
+
+  <target name="-query-prepare"
+          description="Creates all directories associated with the query's
+                       compilation"
+          depends="-prepare-build">
+
+    <mkdir dir="${query.obj.dir}"/>
+    <mkdir dir="${query.test.dir}"/>
+    <mkdir dir="${query.dist.dir}"/>
+    <mkdir dir="${query.obj.dir}/classes"/>
+    <mkdir dir="${query.obj.dir}/classes/conf"/>
+    <mkdir dir="${query.obj.dir}/java"/>
+  </target>
+
+  <target name="-query-unjar-config"
+          depends="-query-unjar-config-uptodate"
+          unless="query.unjar.config.uptodate">
+
+    <unjar src="${bin.dir}/${config.jar}" dest="${query.obj.dir}/classes"/>
+  </target>
+
+  <target name="-query-unjar-config-uptodate">
+
+    <available file="${query.obj.dir}/classes/org/mulgara/config/MulgaraConfig.class"
+               property="query.unjar.config.uptodate"/>
+  </target>
+
+  <target name="query-compile"
+          depends="-query-prepare, util-jar, rules-jar, config-jar, -query-unjar-config"
+          description="Compiles all query related files included generated
+                       source code"
+          unless="query.classes.uptodate">
+
+    <javac destdir="${query.obj.dir}/classes" debug="on"
+           deprecation="on" source="1.5">
+
+      <classpath refid="query-classpath"/>
+
+      <src path="${driver.src.dir}/java"/>
+      <src path="${query.src.dir}/java"/>
+    </javac>
+  </target>
+
+  <target name="query-jar"
+          depends="query-compile, config-database, -query-jar-uptodate"
+          unless="query.jar.uptodate"
+          description="Creates the query's jar/s">
+
+    <copy file="${obj.dir}/mulgara-x-config.xml"
+          tofile="${query.obj.dir}/classes/conf/mulgara-x-config.xml"/>
+
+    <jar jarfile="${query.dist.dir}/${query.jar}">
+
+      <fileset dir="${query.obj.dir}/classes"/>
+      <fileset dir="${query.obj.dir}/java" includes="**/*.dat"/>
+    </jar>
+  </target>
+
+  <target name="-query-jar-uptodate">
+
+    <uptodate property="query.jar.uptodate"
+              targetfile="${query.dist.dir}/${query.jar}">
+      <srcfiles dir="${query.obj.dir}" includes="**/*"/>
+    </uptodate>
+  </target>
+
+  <target name="query-dist"
+          depends="query-jar"
+          unless="query.uptodate"
+          description="Performs all tasks related to finalising this query
+                       and readying it for distribution">
+
+    <!-- All that's involved in the final version of the query library
+         is the jar so we don't need to do anything because the dependencies
+         take care of the work. -->
+  </target>
+
+  <target name="query-test"
+          depends="query-jar, server-rmi-jar, server-local-jar"
+          description="Carries out unit testing for this query">
+
+    <antcall target="start"/>
+    <antcall target="component-test">
+
+      <param name="classpath.id" value="query-test-classpath"/>
+      <param name="dir" value="${query.src.dir}"/>
+      <param name="jar" value="${query.jar}"/>
+    </antcall>
+    <antcall target="stop"/>
+  </target>
+
+  <target name="query-javadoc"
+          depends="query-jar"
+          description="Creates the javadoc for this query">
+
+    <antcall target="javadoc">
+
+      <param name="javadoc.package" value="org.mulgara.query.*,
+                                           org.mulgara.server.*"/>
+      <param name="javadoc.classpath" value="query-classpath"/>
+      <param name="javadoc.sourcepath" value="${query.src.dir}/java"/>
+    </antcall>
+  </target>
+
+  <target name="query-help"
+          description="Displays the help information for this query">
+
+    <!-- This is similar to the main project's help except the information
+         is specific to this query -->
+
+    <echo message="Welcome to the build script for ${name}."/>
+    <echo message=""/>
+    <echo message="These targets can be invoked as follows:"/>
+    <echo message="  ./build.sh &lt;target&gt;"/>
+    <echo message=""/>
+
+    <java fork="false" classname="org.apache.tools.ant.Main"
+          newenvironment="false">
+
+      <jvmarg value="${arch.bits}"/>
+
+      <arg line="-buildfile ${query.src.dir}/build.xml -projecthelp"/>
+    </java>
+
+  </target>
+</project>

Modified: trunk/src/jar/query/java/org/mulgara/connection/Connection.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/connection/Connection.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/query/java/org/mulgara/connection/Connection.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -21,15 +21,31 @@
 import org.mulgara.query.operation.*;
 
 /**
- * This class abstracts connections to a server, holding any information relevant to that
+ * This interface abstracts connections to a server, holding any information relevant to that
  * connection.  For those operations that are to be performed on a server, this interface
  * is used to send the operations.  Other operations can be kept local, but the mechanism
  * appears the same to the user, thereby abstracting away the interaction that each command
  * has with servers.
  *
- * While Connections can be created with the normal constructor, it may be preferable to use
- * an instance of {@link org.mulgara.connection.ConnectionFactory} in order to cache connections
- * based on the server URI.
+ * The preferred method for instantiating a Connection is using the {@link ConnectionFactory}
+ * class.  The ConnectionFactory allows for re-use of underlying resources when connecting to
+ * servers using the server URI.  It is synchronized for use by multiple clients in a 
+ * multi-threaded environment; connections obtained concurrently by separate clients from the 
+ * same factory will not interfere with each other.  Note that while the factory is synchronized
+ * for concurrent access, the connection itself is not and should only be accessed by a single
+ * thread.  When a client connection is no longer in use, its underlying resources are returned
+ * to the factory for re-use by other clients.
+ * 
+ * Connections which are no longer in use should be closed using the {@link #close()} method.
+ * Calling this method allows the underlying session backing the connection to be released back
+ * to the factory for re-use by other clients.  This will result in increased performance in an
+ * environment where there are many short-lived connections in use.  Since the session stores
+ * credentials that are passed to the connection, a factory should only be used to cache
+ * connections in a single-user environment.  Alternatively, the {@link #dispose()} method may
+ * be used to explicitly destroy the underlying session, in which case it will not be cached and
+ * re-used by the factory.  Calling either {@link #close()} or {@link #dispose()} will cause the
+ * connection to be invalidated, and any subsequent attempts to execute an operation on it will
+ * cause an exception to be thrown.
  *
  * {@link org.mulgara.query.operation.Command}s to be issued may be executed with a Connection
  * as a parameter, or can be passed to a Connection.  The appropriate use depends on the usage.
@@ -116,6 +132,12 @@
    * Closes the current connection.
    */
   public void close() throws QueryException;
+  
+  /**
+   * Closes the current connection, disposing of any underlying resources rather
+   * than returning them to the factory for re-use.
+   */
+  public void dispose() throws QueryException;
 
   // Central execution of Command operations
 

Modified: trunk/src/jar/query/java/org/mulgara/connection/ConnectionFactory.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/connection/ConnectionFactory.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/query/java/org/mulgara/connection/ConnectionFactory.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -17,6 +17,7 @@
 import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -29,7 +30,11 @@
 
 /**
  * Creates new connections or reloads from a cache when possible connections.
- * This must NOT be shared between users, as it is designed to cache security credentials!
+ * This class is designed to be thread-safe, so that connections obtained from a factory
+ * simultaneously from different threads will be backed by different Sessions and will not
+ * interfere with each other.  When a connection is closed, it will release its underlying
+ * Session back to factory to be added to a cache for re-use by other clients.
+ * This factory must NOT be shared between users, as it is designed to cache security credentials!
  *
  * @created 2007-08-21
  * @author Paul Gearon
@@ -47,11 +52,17 @@
   /** IP constant for localhost, saved as a string */
   private final static String LOCALHOST_IP = "127.0.0.1";
   
+  /** Canonical hostname, used to normalize RMI connections on localhost */
+  private static String LOCALHOST_CANONICAL;
+  
   /** The scheme name for the local protocol */
   private final static String LOCAL_PROTOCOL = "local";
   
+  /** The scheme name for the RMI protocol */
+  private final static String RMI_PROTOCOL = "rmi";
+  
   /** The list of known protocols. */
-  private final static String[] PROTOCOLS = { "rmi", "beep", LOCAL_PROTOCOL };
+  private final static String[] PROTOCOLS = { RMI_PROTOCOL, "beep", LOCAL_PROTOCOL };
   
   /** The list of known local host aliases. */
   private final static List<String> LOCALHOSTS = new LinkedList<String>();
@@ -63,95 +74,185 @@
     try {
       LOCALHOSTS.add(InetAddress.getLocalHost().getHostAddress());
       LOCALHOSTS.add(InetAddress.getLocalHost().getHostName());
+      String name = InetAddress.getLocalHost().getCanonicalHostName();
+      LOCALHOSTS.add(name);
+      LOCALHOST_CANONICAL = name;
     } catch (UnknownHostException e) {
+      LOCALHOST_CANONICAL = LOCALHOST_NAME;
       logger.error("Unable to get local host address", e);
     }
   }
-
-  /** Cache of Connections, based on their server URI. */
-  private Map<URI,SessionConnection> cacheOnUri;
-  /** Cache of Connections, based on their session data. */
-  private Map<Session,SessionConnection> cacheOnSession;
   
-  /** A local connection.  This is only used if a local session is provided. */
-  private SessionConnection localConnection = null;
-
+  /** Cache to hold Sessions that have been released by closed connections. */
+  private Map<URI,Set<Session>> cacheOnUri;
+  
   /**
+   * Maintain references to all active sessions to prevent them from being
+   * garbage-collected.  This is necessary because we attempt to reclaim sessions from
+   * connections that have been abandoned but not closed.
+   */
+  private Set<Session> sessionsInUse;
+ 
+  /**
    * Default constructor.
    */
   public ConnectionFactory() {
-    cacheOnUri = new HashMap<URI,SessionConnection>();
-    cacheOnSession = new HashMap<Session,SessionConnection>();
+    cacheOnUri = new HashMap<URI,Set<Session>>();
+    sessionsInUse = new HashSet<Session>();
   }
+  
 
   /**
-   * Retrieve a connection based on a server URI.
+   * Retrieve a connection based on a server URI.  If there is already a cached Session
+   * for the server URI, it will be used; otherwise a new Session will be created when
+   * the SessionConnection is instantiated.
    * @param serverUri The URI to get the connection to.
    * @return The new Connection.
    * @throws ConnectionException There was an error getting a connection.
    */
   public Connection newConnection(URI serverUri) throws ConnectionException {
-    SessionConnection c = cacheOnUri.get(serverUri);
-    if (c == null) {
+    SessionConnection c = null;
+    Session session = null;
+    
+    // Try to map all addresses for localhost to the same server URI so they can share Sessions
+    serverUri = normalizeLocalUri(serverUri);
+    
+    synchronized(cacheOnUri) {
+      session = getFromCache(serverUri);
+    }
+    
+    // Let the existing re-try mecanism attempt to re-establish connectivity if necessary.
+    if (session != null && !isSessionValid(session)) {
+      session = null;
+    }
+      
+    if (session == null) {
       if (isLocalServer(serverUri)) {
-        c = (localConnection != null) ? localConnection : new SessionConnection(serverUri, false);
-        addLocalConnection(serverUri, c);
+        c = new SessionConnection(serverUri, false);
       } else {
         c = new SessionConnection(serverUri);
       }
-      cacheOnUri.put(serverUri, c);
-      cacheOnSession.put(c.getSession(), c);
+    } else {
+      c = new SessionConnection(session, null, serverUri);
     }
+    c.setFactory(this);
+    
+    // Maintain a reference to prevent garbage collection of the Session.
+    synchronized(cacheOnUri) {
+      sessionsInUse.add(c.getSession());
+    }
+     
     return c;
   }
 
 
   /**
-   * Retrieve a connection for a given session.
+   * Retrieve a connection for a given session.  This method bypasses the cache altogether
+   * and it is the responsibility of the client to manage the lifecycle of Connections and
+   * Sessions used with this method.
    * @param session The Session the Connection will use..
    * @return The new Connection.
    * @throws ConnectionException There was an error getting a connection.
    */
   public Connection newConnection(Session session) throws ConnectionException {
-    SessionConnection c = cacheOnSession.get(session);
-    if (c == null) {
-      c = new SessionConnection(session);
-      cacheOnSession.put(session, c);
-      URI serverURI = c.getServerUri();
-      if (serverURI != null) {
-        cacheOnUri.put(serverURI, c);
-        if (session.isLocal()) addLocalConnection(serverURI, c);
-      }
-      if (session.isLocal()) localConnection = c;
-    }
-    return c;
+    return new SessionConnection(session, null, null);
   }
 
 
   /**
-   * Close all connections served by this factory. Exceptions are logged, but not acted on.
+   * Close all Sessions cached by this factory. Sessions belonging to connections which are
+   * still in use will not be affected. Exceptions are logged, but not acted on.
    */
   public void closeAll() {
-    Set<SessionConnection> connectionsToClose = new HashSet<SessionConnection>(cacheOnSession.values());
-    connectionsToClose.addAll(cacheOnUri.values());
-    safeCloseAll(connectionsToClose);
+    Set<Session> sessionsToClose = null;
+    synchronized(cacheOnUri) {
+      sessionsToClose = clearCache();
+      sessionsToClose.addAll(sessionsInUse);
+      sessionsInUse.clear();
+    }
+    safeCloseAll(sessionsToClose);
   }
 
 
   /**
-   * Closes all connections in a collection. Exceptions are logged, but not acted on.
-   * @param connections The connections to close.
+   * Closes all sessions in a collection. Exceptions are logged, but not acted on.
+   * @param sessions The sessions to close.
    */
-  private void safeCloseAll(Iterable<SessionConnection> connections) {
-    for (Connection c: connections) {
+  private void safeCloseAll(Iterable<Session> sessions) {
+    for (Session s: sessions) {
       try {
-        c.close();
+        s.close();
       } catch (QueryException qe) {
-        logger.warn("Unable to close connection", qe);
+        logger.warn("Unable to close session", qe);
       }
     }
   }
   
+  
+  /**
+   * Returns a session to the cache to be re-used by new connections.  Removes it from the
+   * list of active sessions.
+   * @param serverUri The URI of the 
+   */
+  void releaseSession(URI serverUri, Session session) {
+    synchronized(cacheOnUri) {
+      addToCache(serverUri, session);
+      // The session is now referenced by the cache, no need to hold on to a second reference
+      sessionsInUse.remove(session);
+    }
+  }
+  
+  
+  /**
+   * Remove the session from the list of active sessions so it may be garbage-collected.
+   */
+  void disposeSession(Session session) {
+    synchronized(cacheOnUri) {
+      // The session was closed by the SessionConnection, no need to hold on to it any more.
+      sessionsInUse.remove(session);
+    }
+  }
+  
+  
+  /**
+   * If the given server URI uses the RMI scheme and the host is an alias for localhost,
+   * then attempt to construct a canonical server URI.  The purpose of this method is to
+   * allow multiple aliased URI's to the same server to share the same cached Sessions.
+   * @param serverUri A server URI
+   * @return The normalized server URI.
+   */
+  public static URI normalizeLocalUri(URI serverUri)
+  {
+    if (serverUri == null) {
+      return null;
+    }
+    
+    URI normalized = serverUri;
+    
+    if (RMI_PROTOCOL.equals(serverUri.getScheme())) {
+      String host = serverUri.getHost();
+      
+      boolean isLocal = false;
+      for (String h : LOCALHOSTS) {
+        if (h.equalsIgnoreCase(host)) {
+          isLocal = true;
+          break;
+        }
+      }
+      
+      if (isLocal) {
+        try {
+          normalized = new URI(RMI_PROTOCOL, null, LOCALHOST_CANONICAL, serverUri.getPort(), 
+              serverUri.getPath(), serverUri.getQuery(), serverUri.getFragment());
+        } catch (URISyntaxException use) {
+          logger.info("Error normalizing server URI to local host", use);
+        }
+      }
+    }
+    
+    return normalized;
+  }
+  
 
   /**
    * Test if a given URI is a local URI.
@@ -181,24 +282,82 @@
     // no matching hostnames
     return false;
   }
+  
+  
+  /**
+   * Tests whether the given cached Session is still valid.  This method uses the
+   * {@link Session#ping()} method to check connectivity with the remote server, and relies
+   * on the retry mechanism build into the remote session proxy to re-establish connectivity
+   * if it is lost.
+   * @param session A session.
+   * @return <code>true</code> if connectivity on the session was established.
+   */
+  static boolean isSessionValid(Session session) {
+    boolean valid;
+    try {
+      valid = session.ping();
+    }
+    catch (QueryException qe) {
+      logger.info("Error establishing connection with remote session", qe);
+      valid = false;
+    }
+    return valid;
+  }
 
 
   /**
-   * Maps all the possible localhost aliases onto the requested connection.
-   * @param serverUri The basic form of the localhost URI.
-   * @param connection The connection to associate with the local host.
+   * Retrieves a cached session for the given server URI.  If multiple sessions were
+   * cached for this URI, the first one found is returned in no particular order.  The
+   * calling code is responsible for synchronizing access to this method.  If a session is
+   * found, then it is removed from the cache and returned.
+   * @param serverURI A server URI
+   * @return A cached session for the server URI, or <code>null</code> if none was found.
    */
-  private void addLocalConnection(URI serverUri, SessionConnection connection) {
-    String path = serverUri.getRawPath();
-    for (String protocol: PROTOCOLS) {
-      for (String alias: LOCALHOSTS) {
-        try {
-          URI uri = new URI(protocol, alias, path, null);
-          cacheOnUri.put(uri, connection);
-        } catch (URISyntaxException e) {
-          logger.error("Unable to create a localhost alias URI.");
-        }
+  private Session getFromCache(URI serverURI) {
+    Session session = null;
+    
+    Set<Session> sessions = cacheOnUri.get(serverURI);
+    if (sessions != null) {
+      Iterator<Session> iter = sessions.iterator();
+      if (iter.hasNext()) {
+        session = iter.next();
       }
+      sessions.remove(session);
     }
+    
+    return session;
   }
+  
+  
+  /**
+   * Adds a session to the cache for the given URI.  The calling code is responsible for
+   * synchronizing access to this method.
+   * @param serverURI A server URI.
+   * @param session The session to cache for the server URI.
+   */
+  private void addToCache(URI serverURI, Session session) {
+    Set<Session> sessions = cacheOnUri.get(serverURI);
+    if (sessions == null) {
+      sessions = new HashSet<Session>();
+      cacheOnUri.put(serverURI, sessions);
+    }
+    sessions.add(session);
+  }
+  
+  
+  /**
+   * Clears all the contents of the cache, and returns a collection of all the Sessions that
+   * were in the cache.  The calling code is responsible for synchronizing access to this method.
+   * @return The cached Sessions.
+   */
+  private Set<Session> clearCache() {
+    Set<Session> sessions = new HashSet<Session>();
+    for (Map.Entry<URI,Set<Session>> entry : cacheOnUri.entrySet()) {
+      Set<Session> set = entry.getValue();
+      sessions.addAll(set);
+      set.clear();
+    }
+    cacheOnUri.clear();
+    return sessions;
+  }
 }

Modified: trunk/src/jar/query/java/org/mulgara/connection/DummyConnection.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/connection/DummyConnection.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/query/java/org/mulgara/connection/DummyConnection.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -95,4 +95,11 @@
   public void close() throws QueryException {
   }
   
+  
+  /**
+   * Disposes of the current connection.  Does nothing for this class.
+   */
+  public void dispose() throws QueryException {
+  }
+  
 }

Modified: trunk/src/jar/query/java/org/mulgara/connection/SessionConnection.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/connection/SessionConnection.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/query/java/org/mulgara/connection/SessionConnection.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -42,9 +42,15 @@
   
   /** The session to use for this connection. */
   private Session session;
-
+  
+  /** The factory used to create this connection */
+  private ConnectionFactory factory = null;
+  
   /** Indicates the current autocommit state */
   private boolean autoCommit = true;
+  
+  /** Indicates the connection has been closed */
+  private boolean closed = false;
 
   /**
    * Creates a new connection, given a URI to a server.
@@ -63,7 +69,7 @@
    * @param isRemote <code>true</code> for a remote session, <code>false</code> for local.
    * @throws ConnectionException There was a problem establishing the details needed for a connection.
    */
-  SessionConnection(URI serverUri, boolean isRemote) throws ConnectionException {
+  public SessionConnection(URI serverUri, boolean isRemote) throws ConnectionException {
     setServerUri(serverUri, isRemote);
   }
 
@@ -71,25 +77,54 @@
   /**
    * Creates a new connection, given a preassigned session.
    * @param session The session to connect with.
-   * @throws ConnectionException There was a problem establishing the details needed for a connection.
    */
   public SessionConnection(Session session) {
-    this(session, null);
+    this(session, null, null);
   }
   
-  
   /**
    * Creates a new connection, given a preassigned session.
    * @param session The session to connect with.
-   * @throws ConnectionException There was a problem establishing the details needed for a connection.
+   * @param securityDomainUri The security domain URI for the session
    */
   public SessionConnection(Session session, URI securityDomainUri) {
+    this(session, securityDomainUri, null);
+  }
+  
+  
+  /**
+   * Creates a new connection, given a preassigned session
+   * @param session The session to connect with
+   * @param securityDomainUri The security domain URI for the session
+   * @param serverUri The server URI, needed for re-caching the session with the factory
+   */
+  public SessionConnection(Session session, URI securityDomainUri, URI serverUri) {
     if (session == null) throw new IllegalArgumentException("Cannot create a connection without a server.");
-    setSession(session, securityDomainUri);
+    setSession(session, securityDomainUri, serverUri);    
   }
   
+    
+  /**
+   * If a Connection was abandoned by the client without being closed first, attempt to
+   * reclaim the session for use by future clients.
+   */
+  protected void finalize() throws QueryException {
+    if (!closed) {
+      close();
+    }
+  }
   
   /**
+   * Used to set a reference back to the factory that created it.  If the factory
+   * reference is set, then the session will be re-cached when this connection is closed.
+   * @param factory The factory that created this connection.
+   */
+  void setFactory(ConnectionFactory factory) {
+    this.factory = factory;
+  }
+  
+  
+  /**
    * Give login credentials and security domain to the current session.  This should only be needed
    * once since the session does not change.
    * @param securityDomainUri The security domain for the login.
@@ -97,6 +132,7 @@
    * @param password The password for the given username.
    */
   public void setCredentials(URI securityDomainUri, String user, char[] password) {
+    checkState();
     if (securityDomainUri == null) throw new IllegalArgumentException("Must have a security domain to yuse credentials");
     this.securityDomainUri = securityDomainUri;
     setCredentials(user, password);
@@ -111,6 +147,7 @@
    * @param password The password for the given username.
    */
   public void setCredentials(String user, char[] password) {
+    checkState();
     if (securityDomainUri == null) throw new IllegalArgumentException("Must have a security domain to yuse credentials");
     session.login(securityDomainUri, user, password);
   }
@@ -120,6 +157,7 @@
    * @return the session
    */
   public Session getSession() {
+    checkState();
     return session;
   }
 
@@ -131,6 +169,7 @@
    * @throws QueryException The session could not change state.
    */
   public void setAutoCommit(boolean autoCommit) throws QueryException {
+    checkState();
     if (this.autoCommit != autoCommit) {
       this.autoCommit = autoCommit;
       session.setAutoCommit(autoCommit);
@@ -142,6 +181,7 @@
    * @return the autoCommit value
    */
   public boolean getAutoCommit() {
+    checkState();
     return autoCommit;
   }
 
@@ -150,6 +190,26 @@
    * Closes the current connection.
    */
   public void close() throws QueryException {
+    checkState();
+    closed = true;
+    
+    if (factory != null) {
+      factory.releaseSession(serverUri, session);
+    }
+  }
+  
+  
+  /**
+   * Disposes of the current connection and any underlying resources.
+   */
+  public void dispose() throws QueryException {
+    checkState();
+    closed = true;
+    
+    if (factory != null) {
+      factory.disposeSession(session);
+    }
+    
     if (session != null) {
       session.close();
       session = null;
@@ -173,15 +233,26 @@
     return securityDomainUri;
   }
 
+  
+  /**
+   * Throws an IllegalStateException if the connection has already been closed.
+   */
+  private void checkState() {
+    if (closed) {
+      throw new IllegalStateException("Attempt to access a closed connection");
+    }
+  }
 
   /**
    * Sets the session information for this connection
    * @param session The session to set to.
    * @param securityDomainURI The security domain to use for the session.
    */
-  private void setSession(Session session, URI securityDomainUri) {
+  private void setSession(Session session, URI securityDomainUri, URI serverUri) {
     this.session = session;
     this.securityDomainUri = securityDomainUri;
+    this.serverUri = serverUri;
+    if (logger.isDebugEnabled()) logger.debug("Set server URI to: " + serverUri);
   }
 
 
@@ -196,21 +267,18 @@
     try {
       if (uri == null) {
         // no model given, and the factory didn't cache a connection, so make one up.
-        serverUri = SessionFactoryFinder.findServerURI();
-      } else {
-        serverUri = uri;
+        uri = SessionFactoryFinder.findServerURI();
       }
-      if (logger.isDebugEnabled()) logger.debug("Set server URI to: " + serverUri);
 
       if (logger.isDebugEnabled()) logger.debug("Finding session factory for " + uri);
       
-      SessionFactory sessionFactory = SessionFactoryFinder.newSessionFactory(serverUri, isRemote);
+      SessionFactory sessionFactory = SessionFactoryFinder.newSessionFactory(uri, isRemote);
       if (logger.isDebugEnabled()) logger.debug("Found " + sessionFactory.getClass() +
           " session factory, obtaining session with " + uri);
 
       // create a new session and set this connection to it
       if (securityDomainUri == null) securityDomainUri = sessionFactory.getSecurityDomain();
-      setSession(sessionFactory.newSession(), sessionFactory.getSecurityDomain());
+      setSession(sessionFactory.newSession(), sessionFactory.getSecurityDomain(), uri);
 
     } catch (SessionFactoryFinderException e) {
       throw new ConnectionException("Unable to connect to a server", e);

Modified: trunk/src/jar/query/java/org/mulgara/server/Session.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/server/Session.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/query/java/org/mulgara/server/Session.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -316,6 +316,14 @@
    */
   public XAResource getXAResource() throws QueryException;
   public XAResource getReadOnlyXAResource() throws QueryException;
+  
+  /**
+   * Test the connectivity of a session.  All implementing classes should return
+   * <code>true</code>.  This method is intended for session proxies to establish
+   * connectivity on a remote session.
+   * @return <code>true</code> if connectivity with the session was established.
+   */
+  public boolean ping() throws QueryException;
 
   /**
    * This class is just a devious way to get static initialization for the

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -685,4 +685,8 @@
     assertExternallyManagedXA();
     return externalFactory.getXAResource(this, false);
   }
+  
+  public boolean ping() {
+    return true;
+  }
 }

Modified: trunk/src/jar/server-beep/java/org/mulgara/server/beep/BEEPSession.java
===================================================================
--- trunk/src/jar/server-beep/java/org/mulgara/server/beep/BEEPSession.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/server-beep/java/org/mulgara/server/beep/BEEPSession.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -546,4 +546,8 @@
  public XAResource getReadOnlyXAResource() throws QueryException {
    throw new QueryException("External transactions not implemented under Beep");
  }
+ 
+ public boolean ping() {
+   return true;
+ }
 }

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -308,4 +308,10 @@
    */
   public RemoteXAResource getXAResource() throws QueryException, RemoteException;
   public RemoteXAResource getReadOnlyXAResource() throws QueryException, RemoteException;
+  
+  /**
+   * Test the connectivity of the remote session.
+   * @return <code>true</code> if connectivity was established.
+   */
+  public boolean ping() throws QueryException, RemoteException;
 }

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -627,4 +627,15 @@
       throw new QueryException("Java RMI failure", re);
     }
   }
+  
+  public boolean ping() throws QueryException {
+    try {
+      boolean ping = remoteSession.ping();
+      resetRetries();
+      return ping;
+    } catch (RemoteException re) {
+      testRetry(re);
+      return ping();
+    }
+  }
 }

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -475,6 +475,14 @@
       throw convertToQueryException(t);
     }
   }
+  
+  public boolean ping() throws QueryException, RemoteException {
+    try {
+      return session.ping();
+    } catch (Throwable t) {
+      throw convertToQueryException(t);
+    }
+  }
 
 
   // Construct an exception chain that will pass over RMI.

Modified: trunk/tools/src/org/mulgara/tools/Sparql.java
===================================================================
--- trunk/tools/src/org/mulgara/tools/Sparql.java	2008-05-22 07:25:13 UTC (rev 956)
+++ trunk/tools/src/org/mulgara/tools/Sparql.java	2008-05-22 19:21:05 UTC (rev 957)
@@ -75,7 +75,7 @@
     }
 
     // clean up the server connection
-    conn.close();
+    conn.dispose();
   }
 
   /**




More information about the Mulgara-svn mailing list