[Mulgara-svn] r109 - in trunk/src/jar: itql/java/org/mulgara/itql itql/sablecc query/java/org/mulgara/query resolver/java/org/mulgara/resolver resolver-relational/java/org/mulgara/resolver/relational resolver-test/java/org/mulgara/resolver/test resolver-view/java/org/mulgara/resolver/view

andrae at mulgara.org andrae at mulgara.org
Mon Oct 23 10:47:07 UTC 2006


Author: andrae
Date: 2006-10-23 05:47:07 -0500 (Mon, 23 Oct 2006)
New Revision: 109

Removed:
   trunk/src/jar/query/java/org/mulgara/query/RelatedExpression.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandler.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandlerImpl.java
Modified:
   trunk/src/jar/itql/java/org/mulgara/itql/ItqlInterpreter.java
   trunk/src/jar/itql/sablecc/itql.grammar
   trunk/src/jar/query/java/org/mulgara/query/Query.java
   trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java
   trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java
   trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/Database.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactory.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java
Log:
The full test for my previous commit returned 100% so this is the removal
of the relatedTo stubs and harness functionality.

This is code that exists solely to support proprietary features that
existed in Tucana's proprietary product built on top of Kowari.  They are
therefore deadcode, and both clutter and complicate the structure of the
code.  Therefore this commit removes this and cleans up those affected
components.



Modified: trunk/src/jar/itql/java/org/mulgara/itql/ItqlInterpreter.java
===================================================================
--- trunk/src/jar/itql/java/org/mulgara/itql/ItqlInterpreter.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/itql/java/org/mulgara/itql/ItqlInterpreter.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -1166,127 +1166,7 @@
     }
   }
 
-  // outARollbackCommand()
-
   /**
-   * Executes a related query.
-   *
-   * @param node  the <code>relate</code> command
-   */
-  public void outARelateCommand(ARelateCommand node) {
-
-    this.setLastError(null);
-    this.setLastAnswer(null);
-    this.setLastMessage("");
-
-    // log the command
-    if (logger.isDebugEnabled()) {
-      logger.debug("Processing relate command " + node);
-    }
-
-    try {
-      // build the query
-      URIReference base = null;
-      int maxRelated = 50;
-      double minScore = 0;
-
-      // build the query
-      Query query = this.buildQuery(node.getQuery());
-
-      // insure the correct session is obtained
-      updateSession(query.getModelExpression());
-
-      if (node.getBaseClause() != null) {
-        base = new URIReferenceImpl(new URI(
-            ( (ABaseClause) node.getBaseClause()).getResource().getText()
-            ));
-      }
-
-      if (node.getLimitClause() != null) {
-        maxRelated = Integer.parseInt(
-            ( (ALimitClause) node.getLimitClause()).getNumber().getText()
-            );
-      }
-
-      if (node.getThresholdClause() != null) {
-        String text;
-        if (node.getThresholdClause() instanceof AFloatThresholdClause) {
-          text = ( (AFloatThresholdClause) node.getThresholdClause()).getFloat().
-              getText();
-        }
-        else if (node.getThresholdClause() instanceof AIntegerThresholdClause) {
-          text = ( (AIntegerThresholdClause) node.getThresholdClause()).
-              getNumber().getText();
-        }
-        else {
-          throw new QueryException(
-              "Unimplemented threshold variant: " + node.getThresholdClause()
-              );
-        }
-        assert text != null;
-
-        minScore = Double.parseDouble(text);
-      }
-
-      if (executeQuery) {
-
-        // log that we've created the query and will execute it
-        if (logger.isDebugEnabled()) {
-          logger.debug("Executing query RELATED BASE " + base +
-                       " LIMIT " + maxRelated +
-                       " THRESHOLD " + minScore + " " + query);
-        }
-
-        RelatedExpression related = new RelatedExpression(base, maxRelated,
-            minScore);
-        query = new Query(related, query.getVariableList(), query.getModelExpression(),
-            query.getConstraintExpression(), query.getHavingExpression(),
-            query.getOrderList(), query.getLimit(), query.getOffset(),
-            new UnconstrainedAnswer());
-
-        // build the query
-        Answer answer = null;
-        answer = getSession().query(query);
-
-        // make sure we got an answer
-        if (answer == null) {
-          throw new QueryException("Invalid answer received");
-        }
-
-        // log that we've executed the query
-        if (logger.isDebugEnabled()) {
-          logger.debug("Successfully executed query " + node);
-        }
-
-        // inform the user of the answer
-        this.setLastAnswer(answer);
-      }
-    }
-    catch (QueryException qe) {
-      // let the user know the problem
-      this.setLastError(qe);
-      this.setLastAnswer(null);
-      this.setLastMessage("Couldn't answer releated query." + EOL + this.getCause(qe, 2) + EOL + qe);
-      logger.warn("Bad user query", qe);
-    }
-    catch (URISyntaxException use) {
-      // let the user know the problem
-      this.setLastError(use);
-      this.setLastAnswer(null);
-      this.setLastMessage("Couldn't answer query: Invalid resource URI.");
-      logger.warn("Invalid resource URI." + EOL + this.getCause(use, 0));
-    }
-    catch (RuntimeException re) {
-      // let the user know the problem
-      this.setLastError(re);
-      this.setLastAnswer(null);
-      this.setLastMessage("Couldn't answer query :" + this.getCause(re, 0));
-      logger.fatal("Failed to select statements", re);
-    }
-
-  }
-
-  /**
    * Executes a query.
    *
    * @param node the query command

Modified: trunk/src/jar/itql/sablecc/itql.grammar
===================================================================
--- trunk/src/jar/itql/sablecc/itql.grammar	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/itql/sablecc/itql.grammar	2006-10-23 10:47:07 UTC (rev 109)
@@ -60,7 +60,6 @@
   {def}                order       = 'order';
   {def}                on          = 'on';
   {def}                quit        = 'quit';
-  {def}                relate      = 'relate';
   {def}                restore     = 'restore';
   {def}                rollback    = 'rollback';
   {def}                select      = 'select';
@@ -130,7 +129,6 @@
     {insert}    insert triple_factor into resource                           |
     {load}      load [locality]:locality? [source]:resource into [destination]:resource |
     {quit}      quit                                                         |
-    {relate}    relate base_clause? limit_clause? threshold_clause? query    |
     {restore}   restore [destination]:resource from [locality]:locality? [source]:resource |
     {rollback}  rollback                                                     |
     {select}    query                                                        |

Modified: trunk/src/jar/query/java/org/mulgara/query/Query.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/Query.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/query/java/org/mulgara/query/Query.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -62,8 +62,9 @@
   * have not occurred with the class.
   * NOTE : update this serialVersionUID when a method or a public member is
   * deleted.
+  * NOTE: Incremented UID to reflect removal of relatedTo.
   */
-  static final long serialVersionUID = 7973523792022156620L;
+  static final long serialVersionUID = 7973523792022156621L;
 
   /**
    * Logger.
@@ -71,11 +72,6 @@
   private static Logger logger = Logger.getLogger(Query.class.getName());
 
   /**
-   * The limited variables or null if not a related query.
-   */
-  private RelatedExpression related;
-
-  /**
    * The variable list. This may only contain {@link Variable}s. It corresponds
    * to the <code>select</code> clause. If it is <code>null</code>, it indicates
    * that there is no <code>select</code> clause and that no projection will be
@@ -212,42 +208,6 @@
   }
 
   /**
-   * Construct a query.
-   *
-   * @param variableList {@link Variable}s or node values to appear as bindings
-   *     in the solution (i.e. columns of the result {@link Answer});
-   *     <code>null</code> indicates that all columns are to be retained
-   * @param modelExpression an expression defining the model to query, never
-   *     <code>null</code>
-   * @param constraintExpression an expression defining the constraints to
-   *     satisfy, never <code>null</code>
-   * @param havingExpression an expression defining the conditions to apply to
-   *     aggregate functions or null if not given.
-   * @param orderList sort order column names, currently a list of {@link
-   *     Variable}s with the order assumed to be ascending in all cases
-   * @param limit the maximum number of rows to return, which must be
-   *     non-negative; <code>null</code> indicates no limit
-   * @param offset the number of rows to skip from the beginning of the result,
-   *     never negative
-   * @param answer an existing solution set to which results must belong, or
-   *     {@link UnconstrainedAnswer} for no constraints; never
-   *     <code>null</code> is
-   * @throws IllegalArgumentException if <var>limit</var> or <var>offset</var>
-   *     are negative, or if <var>modelExpression</var>,
-   *     <var>constraintExpression</var>, <var>orderList<var> or
-   *     <var>answer</var> are <code>null</code>
-   */
-  public Query(RelatedExpression related, List variableList,
-      ModelExpression modelExpression,
-      ConstraintExpression constraintExpression,
-      ConstraintHaving havingExpression, List orderList, Integer limit,
-      int offset, Answer answer) {
-    this(variableList, modelExpression, constraintExpression, havingExpression,
-        orderList, limit, offset, answer);
-    this.related = related;
-  }
-
-  /**
    * Cloning must always be supported.
    */
   public Object clone() {
@@ -282,16 +242,6 @@
   //
 
   /**
-   * Accessor for the <code>related</code> property.
-   *
-   * @return a related expression which is either null, not a related query,
-   *   or values to be used by a related query.
-   */
-  public RelatedExpression getRelated() {
-    return related;
-  }
-
-  /**
    * Accessor for the <code>variableList</code> property.
    *
    * @return a {@link List} containing one or more {@link Variable}s

Deleted: trunk/src/jar/query/java/org/mulgara/query/RelatedExpression.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/RelatedExpression.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/query/java/org/mulgara/query/RelatedExpression.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -1,119 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-import org.jrdf.graph.*;
-
-import java.io.Serializable;
-
-/**
- * An object which contains the various parameters in a related query.
- *
- * @created 2004-10-20
- *
- * @author Andrew Newman
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy; 2004 <A href="http://www.PIsoftware.com/">Plugged In
- *      Software Pty Ltd</A>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class RelatedExpression implements Cloneable, Serializable {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = 3476137906321174349L;
-
-  /**
-   * The optionally empty base node.
-   */
-  private URIReference baseNode;
-
-  /**
-   * The optionally 0 limit clause.  0 indicating no limit.
-   */
-  private int limit = 0;
-
-  /**
-   * The optionally 0 threshold clause.  0 indicating no threshold.
-   */
-  private double threshold = 0.0d;
-
-  /**
-   * Create a new related expression.
-   *
-   * @param newBaseNode the base node to start from.
-   * @param newLimit how many results to limit returning.
-   * @param newThreshold the threshold to remove results with.
-   */
-  public RelatedExpression(URIReference newBaseNode, int newLimit,
-      double newThreshold) {
-    baseNode = newBaseNode;
-    limit = newLimit;
-    threshold = newThreshold;
-  }
-
-  /**
-   * Returns the base node value.
-   *
-   * @return the base node value.
-   */
-  public URIReference getBaseNode() {
-    return baseNode;
-  }
-
-  /**
-   * Returns the limit value.
-   *
-   * @return the limit value.
-   */
-  public int getLimit() {
-    return limit;
-  }
-
-  /**
-   * Returns the threshold value.
-   *
-   * @return the threshold value.
-   */
-  public double getThresholdValue() {
-    return threshold;
-  }
-}

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -155,9 +155,6 @@
     String systemResolverFactoryClassName =
       "org.mulgara.resolver.memory.MemoryResolverFactory";
 
-    String relatedQueryHandlerClassName =
-      "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
     // Create a database which keeps its system models on the Java heap
     database = new Database(
         databaseURI,
@@ -178,7 +175,6 @@
         systemResolverFactoryClassName,   // temporary
         null,
         "",                               // no rules engine
-        relatedQueryHandlerClassName,
         "org.mulgara.content.rdfxml.RDFXMLContentHandler");
   }
 

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/Database.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/Database.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/Database.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -271,11 +271,6 @@
   private final SessionFactory unsecuredSessionFactory =
     new UnsecuredSessionFactory();
 
-  /**
-   * The related query handler.
-   */
-  private final String relatedQueryHandler;
-
   //
   // Constructor
   //
@@ -355,7 +350,6 @@
            config.getTemporaryResolverFactory().getDir()
          ),
          config.getRuleLoader().getType(),
-         config.getRelatedQueryHandler().getType(),
          config.getDefaultContentHandler().getType());
 
     if (logger.isDebugEnabled()) {
@@ -402,8 +396,6 @@
    * @param ruleLoaderClassName  the name of a
    *   {@link RuleLoader} implementation which will be used for loading
    *   rule frameworks, never <code>null</code>
-   * @param relatedQueryHandler the name of the class that implements
-   *   {@link RelatedQueryHandler}
    * @param defaultContentHandlerClassName the name of the class that should be
    *   used to parse external content of unknown MIME type, or
    *   <code>null</code> to disable blind parsing
@@ -433,7 +425,6 @@
                   String temporaryResolverFactoryClassName,
                   File   temporaryResolverDirectory,
                   String ruleLoaderClassName,
-                  String relatedQueryHandler,
                   String defaultContentHandlerClassName)
     throws ConfigurationException, InitializerException, LocalizeException,
            NamingException, NodePoolException, QueryException,
@@ -495,12 +486,6 @@
     if (temporaryResolverFactoryClassName == null) {
       throw new IllegalArgumentException("Null 'temporaryResolverFactoryClassName' parameter");
     }
-    if (ruleLoaderClassName == null) {
-      throw new IllegalArgumentException("Null 'ruleLoaderClassName' parameter");
-    }
-    if (relatedQueryHandler == null) {
-      throw new IllegalArgumentException("Null 'relatedQueryHandler' parameter");
-    }
 
     // Initialize fields
     this.uri                       = uri;
@@ -537,9 +522,6 @@
       );
     }
 
-    // Set related query handler
-    this.relatedQueryHandler = relatedQueryHandler;
-
     // Enable resolver initialization
     if (logger.isDebugEnabled()) {
       logger.debug("Creating initialization session");
@@ -716,7 +698,6 @@
         metadata,
 		    contentHandlers,
         unmodifiableCachedResolverFactorySet,
-        relatedQueryHandler,
         temporaryModelTypeURI,
         ruleLoaderClassName);
 
@@ -933,7 +914,6 @@
         metadata,
         contentHandlers,
         unmodifiableCachedResolverFactorySet,
-        relatedQueryHandler,
         temporaryModelTypeURI,
         ruleLoaderClassName);
     } catch (ResolverFactoryException e) {
@@ -962,7 +942,6 @@
           metadata,
           contentHandlers,
           cachedResolverFactorySet,
-          relatedQueryHandler,
           temporaryModelTypeURI);
     }
     catch (ResolverFactoryException e) {
@@ -1202,7 +1181,6 @@
           metadata,
           contentHandlers,
           unmodifiableCachedResolverFactorySet,
-          relatedQueryHandler,
           temporaryModelTypeURI,
           ruleLoaderClassName);
       }
@@ -1232,7 +1210,6 @@
           metadata,
           contentHandlers,
           cachedResolverFactorySet,
-          relatedQueryHandler,
           temporaryModelTypeURI);
       }
       catch (ResolverFactoryException e) {

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactory.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactory.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseFactory.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -127,7 +127,6 @@
       config.getTemporaryResolverFactory().getType(),
       subdir(directory, config.getTemporaryResolverFactory().getDir()),
       config.getRuleLoader().getType(),
-      config.getRelatedQueryHandler().getType(),
       config.getDefaultContentHandler().getType());
 
     if (logger.isDebugEnabled()) {

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -164,9 +164,6 @@
   /** Session transaction */
   private Transaction transaction;
 
-  /** The related query handler */
-  private RelatedQueryHandler relatedQueryHandler;
-
   /** The name of the rule loader to use */
   private String ruleLoaderClassName;
 
@@ -245,8 +242,6 @@
    *   never <code>null</code>
    * @param contentHandlers contains the list of valid registered content handles
    *   never <code>null</code>
-   * @param relatedQueryClass the name of the class that implements
-   *   {@link RelatedQueryHandler}
    * @param temporaryModelTypeURI  the URI of the model type to use to cache
    *   external models
    * @throws IllegalArgumentException if any argument is <code>null</code>
@@ -263,7 +258,6 @@
       DatabaseMetadata metadata,
       ContentHandlerManager contentHandlers,
       Set cachedResolverFactorySet,
-      String relatedQueryClass,
       URI temporaryModelTypeURI,
       String ruleLoaderClassName) throws ResolverFactoryException {
 
@@ -296,8 +290,6 @@
       throw new IllegalArgumentException("Null \"contentHandlers\" parameter");
     } else if (metadata == null) {
       throw new IllegalArgumentException("Null \"metadata\" parameter");
-    } else if (relatedQueryClass == null) {
-      throw new IllegalArgumentException("Null \"relatedQueryClass\" parameter");
     } else if (ruleLoaderClassName == null) {
       ruleLoaderClassName = DUMMY_RULE_LOADER;
     }
@@ -314,26 +306,6 @@
       );
     }
 
-    try {
-      if (relatedQueryClass != null) {
-        //load class
-        Class storeClass = Class.forName(relatedQueryClass);
-
-        //get appropriate constructor
-        Constructor constructor = storeClass.getConstructor(new Class[] {
-            Session.class });
-
-        //instantiate
-        relatedQueryHandler = (RelatedQueryHandler) constructor.newInstance(
-            new Object[] { this });
-      }
-    }
-    catch (Exception e) {
-      //throw new IllegalArgumentException("Cannot find class: " +
-      throw new ResolverFactoryException("Cannot find class: " +
-          relatedQueryClass, e);
-    }
-
     // Initialize fields
     this.transactionManager = transactionManager;
     this.securityAdapterList = securityAdapterList;
@@ -460,12 +432,11 @@
       DatabaseMetadata metadata,
       ContentHandlerManager contentHandlers,
       Set cachedResolverFactorySet,
-      String relatedQueryClass,
       URI temporaryModelTypeURI) throws ResolverFactoryException {
     this(transactionManager, securityAdapterList, symbolicTransformationList, resolverSessionFactory,
         systemResolverFactory, temporaryResolverFactory, resolverFactoryList, externalResolverFactoryMap,
         internalResolverFactoryMap, metadata, contentHandlers, cachedResolverFactorySet,
-        relatedQueryClass, temporaryModelTypeURI, "");
+        temporaryModelTypeURI, "");
   }
 
   public ResolverSession getResolverSession() {
@@ -808,25 +779,17 @@
   {
     Answer result;
 
-    // If a related query, do not enter into a transaction as we can't have
-    // nested transactions.
-    if (query.getRelated() != null) {
-      RelatedExpression related = query.getRelated();
-      result = databaseSession.relatedQueryHandler.related(((Node) related.getBaseNode()),
-          new Query[] {query}, related.getLimit(), related.getThresholdValue());
-    } else {
-      LocalQuery localQuery =
-        new LocalQuery(query, systemResolver, databaseSession);
+    LocalQuery localQuery =
+      new LocalQuery(query, systemResolver, databaseSession);
 
-      transform(databaseSession, localQuery);
+    transform(databaseSession, localQuery);
 
-      // Complete the numerical phase of resolution
-      Tuples tuples = localQuery.resolve();
-      result = new SubqueryAnswer(databaseSession, systemResolver, tuples,
-          query.getVariableList());
-      tuples.close();
-      localQuery.close();
-    }
+    // Complete the numerical phase of resolution
+    Tuples tuples = localQuery.resolve();
+    result = new SubqueryAnswer(databaseSession, systemResolver, tuples,
+        query.getVariableList());
+    tuples.close();
+    localQuery.close();
 
     if (logger.isDebugEnabled()) {
       logger.debug("Answer rows = " + result.getRowCount());

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -171,9 +171,6 @@
     String systemResolverFactoryClassName =
         "org.mulgara.resolver.memory.MemoryResolverFactory";
 
-    String relatedQueryHandlerClassName =
-        "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
     // Create a database which keeps its system models on the Java heap
     database = new Database(
         databaseURI,
@@ -194,7 +191,6 @@
         systemResolverFactoryClassName, // temporary
         null,
         "",                          // no rule loader
-        relatedQueryHandlerClassName,
         null);  // no default content handler
 
     //create and populate models

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -519,9 +519,6 @@
     String systemResolverFactoryClassName =
       "org.mulgara.resolver.memory.MemoryResolverFactory";
 
-    String relatedQueryHandlerClassName =
-      "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
     // Create a database which keeps its system models on the Java heap
     database = new Database(
         databaseURI,
@@ -542,7 +539,6 @@
         systemResolverFactoryClassName,  // temporary
         null,
         "",                              // no rule loader
-        relatedQueryHandlerClassName,
         null);                           // no default content handler
 
     if (test.resolvers != null) {

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseUnitTest.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -112,7 +112,7 @@
   {
     try {
       new Database(null, null, null, null, 0, null, null, null, null, null,
-                   null, null, null, null, null, null, null, null, null, null);
+                   null, null, null, null, null, null, null, null, null);
       fail("Expected " + IllegalArgumentException.class);
     } catch (IllegalArgumentException e) {
       // correct behavior
@@ -170,8 +170,7 @@
           null,
           "org.mulgara.resolver.memory.MemoryResolverFactory",
           null,
-          "",
-          "org.mulgara.resolver.RelatedQueryHandlerImpl",
+          null,
           null);  // no default content handler
     } catch (Exception e) {
       fail(e);

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -118,8 +118,6 @@
    * @param cachedResolverFactorySet  contains the resolver factories that are
    *   to have access to their models cached, never <code>null</code>
    *   never <code>null</code>
-   * @param relatedQueryHandler the name of the class that implements
-   *   {@link RelatedQueryHandler}
    * @param temporaryModelTypeURI  the type of model to use as a cache for
    *   external models
    * @throws IllegalArgumentException if any argument is <code>null</code>
@@ -131,15 +129,13 @@
       ResolverFactory temporaryResolverFactory, List resolverFactoryList,
       Map externalResolverFactoryMap, Map internalResolverFactoryMap,
       DatabaseMetadata metadata, ContentHandlerManager contentHandlers,
-      Set cachedResolverFactorySet, String relatedQueryHandler,
-      URI temporaryModelTypeURI)
+      Set cachedResolverFactorySet, URI temporaryModelTypeURI)
       throws ResolverFactoryException {
     super(transactionManager, securityAdapterList, symbolicTransformationList,
         resolverSessionFactory,
         systemResolverFactory, temporaryResolverFactory, resolverFactoryList,
         externalResolverFactoryMap, internalResolverFactoryMap, metadata,
-        contentHandlers, cachedResolverFactorySet, relatedQueryHandler,
-        temporaryModelTypeURI);
+        contentHandlers, cachedResolverFactorySet, temporaryModelTypeURI);
 
     jrdfFactory = new JRDFFactoryImpl();
   }

Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandler.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandler.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandler.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -1,123 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// JRDF
-import org.jrdf.graph.Node;
-
-// Locally written packages
-import org.mulgara.query.Answer;
-import org.mulgara.query.Query;
-import org.mulgara.query.QueryException;
-import org.mulgara.server.Session;
-
-/**
- * Base class for related query handler implementations.
- *
- * @created 2003-10-27
- *
- * @author David Makepeace
- * @author Andrew Newman
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:24 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy; 2001-2003 <A href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</A>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public abstract class RelatedQueryHandler {
-
-  /**
-   * The session currently being used.
-   */
-  protected Session session;
-
-  /*
-   * Create a new related queries.
-   *
-   * @param newSession the session being used to do the querying.
-   * @throws IllegalArgumentException if the session is not DatabaseSession.
-   */
-  public RelatedQueryHandler(Session newSession) throws IllegalArgumentException {
-    if (!(newSession instanceof DatabaseSession)) {
-      throw new IllegalArgumentException("Session must be a DatabaseSession");
-    }
-    session = newSession;
-  }
-
-  /**
-   * Performs an inner query required for {@link #related}
-   *
-   * @param query the query to execute.
-   * @return Answer the result of the query.
-   * @throws QueryException if there was an error executing the query.
-   */
-  protected Answer innerQuery(Query query) throws QueryException {
-    return ((DatabaseSession) session).innerQuery(query);
-  }
-
-  /**
-   * Find related RDF nodes.
-   *
-   * @param baseNode the base RDF node.
-   * @param queries the queries to perform
-   * @param maxRelated the maximum number of rows to return
-   * @param minScore related nodes must have at least this score
-   * @return a non-<code>null</code> answer with two columns. The first column
-   *      is the RDF node and the second column is the score.
-   * @throws QueryException if any of the <var>queries</var> can't be processed
-   */
-  public abstract Answer related(Node baseNode, Query[] queries,
-      int maxRelated, double minScore) throws QueryException;
-
-  /**
-   * Show how two nodes are related.
-   *
-   * @param baseNode the base RDF node.
-   * @param relatedNode the related RDF node.
-   * @param queries the queries to perform.
-   * @param nrPColumns the number of columns in the query results which identify
-   *      a category of arc linking the two RDF nodes. The columns used for this
-   *      purpose start at column 2 (the second column) of the result.
-   * @return a non-<code>null</code> answer with two or more columns. The number
-   *      of columns is the value of the <code>nrColumns</code> parameter plus
-   *      one. The initial <code>nrPColumns</code> columns identify a particular
-   *      category of arc linking the two RDF nodes and the last column is the
-   *      score.
-   * @throws QueryException if any of the <var>queries</var> can't be processed
-   */
-  public abstract Answer howRelated(Node baseNode, Node relatedNode,
-      Query[] queries, int nrPColumns) throws QueryException;
-}

Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandlerImpl.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandlerImpl.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/RelatedQueryHandlerImpl.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -1,94 +0,0 @@
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.sql.SQLException;
-import java.text.NumberFormat;
-import java.util.*;
-
-// Logging classes
-import org.apache.log4j.Logger;
-
-// JRDF
-import org.jrdf.graph.Node;
-
-// Locally written packages
-import org.mulgara.query.*;
-import org.mulgara.query.rdf.LiteralImpl;
-import org.mulgara.server.*;
-import org.mulgara.store.*;
-import org.mulgara.util.ResultSetRow;
-import org.mulgara.util.TestResultSet;
-
-/**
- * All related queries are found here.
- *
- * @created 2003-10-27
- *
- * @author David Makepeace
- * @author Andrew Newman
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:24 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy; 2001-2004 <A href="http://www.PIsoftware.com/">Plugged In
- *      Software Pty Ltd</A>
- */
-public class RelatedQueryHandlerImpl extends RelatedQueryHandler {
-
-  /**
-   * Logger. This is named after the class.
-   */
-  private final static Logger logger =
-      Logger.getLogger(RelatedQueryHandlerImpl.class.getName());
-
-  /*
-   * Create a new related queries.
-   *
-   * @param newSession the session being used to do the querying.
-   */
-  public RelatedQueryHandlerImpl(Session newSession) {
-    super(newSession);
-  }
-
-  /**
-   * Find related RDF nodes.
-   *
-   * @param baseNode the base RDF node.
-   * @param queries the queries to perform
-   * @param maxRelated the maximum number of rows to return
-   * @param minScore related nodes must have at least this score
-   * @return a non-<code>null</code> answer with two columns. The first column
-   *      is the RDF node and the second column is the score.
-   * @throws QueryException if any of the <var>queries</var> can't be processed
-   */
-  public synchronized Answer related(Node baseNode, Query[] queries,
-      int maxRelated, double minScore) throws QueryException {
-    throw new QueryException("Related queries are not supported in Mulgara");
-  }
-
-  /**
-   * Show how two nodes are related.
-   *
-   * @param baseNode the base RDF node.
-   * @param relatedNode the related RDF node.
-   * @param queries the queries to perform.
-   * @param nrPColumns the number of columns in the query results which identify
-   *      a category of arc linking the two RDF nodes. The columns used for this
-   *      purpose start at column 2 (the second column) of the result.
-   * @return a non-<code>null</code> answer with two or more columns. The number
-   *      of columns is the value of the <code>nrColumns</code> parameter plus
-   *      one. The initial <code>nrPColumns</code> columns identify a particular
-   *      category of arc linking the two RDF nodes and the last column is the
-   *      score.
-   * @throws QueryException if any of the <var>queries</var> can't be processed
-   */
-  public synchronized Answer howRelated(Node baseNode, Node relatedNode,
-      Query[] queries, int nrPColumns) throws QueryException {
-    throw new QueryException("Related queries are not supported in Mulgara");
-  }
-}

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -563,9 +563,6 @@
     String tempResolverFactoryClassName =
       "org.mulgara.resolver.memory.MemoryResolverFactory";
 
-    String relatedQueryHandlerClassName =
-      "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
     String ruleLoaderFactoryClassName =
       "org.mulgara.rules.RuleLoaderFactory";
 
@@ -589,7 +586,6 @@
                  tempResolverFactoryClassName,    // temporary models
                  null,                            // no dir for temp models
                  "",                              // no rule loader
-                 relatedQueryHandlerClassName,
                  "org.mulgara.content.rdfxml.RDFXMLContentHandler");
 
     database.addResolverFactory("org.mulgara.resolver.url.URLResolverFactory", null);

Modified: trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java
===================================================================
--- trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -225,9 +225,6 @@
       String tempResolverFactoryClassName =
         "org.mulgara.resolver.memory.MemoryResolverFactory";
 
-      String relatedQueryHandlerClassName =
-        "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
       String ruleLoaderFactoryClassName =
         "org.mulgara.rules.RuleLoaderFactory";
 
@@ -251,7 +248,6 @@
                    tempResolverFactoryClassName,    // temporary models
                    null,                            // no dir for temp models
                    "",                              // no rule loader
-                   relatedQueryHandlerClassName,
                    "org.mulgara.content.rio.RDFXMLContentHandler");
 
       database.addResolverFactory("org.mulgara.resolver.url.URLResolverFactory", null);

Modified: trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java
===================================================================
--- trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -408,9 +408,6 @@
 
 			String tmfClassName = "org.mulgara.resolver.JotmTransactionManagerFactory";
 
-			String relatedQueryHandlerClassName =
-				"org.mulgara.resolver.RelatedQueryHandlerImpl";
-
 			TransactionManagerFactory transactionManagerFactory =
 				(TransactionManagerFactory) Beans.instantiate(null, tmfClassName);
 
@@ -434,7 +431,6 @@
 					systemResolverFactoryClassName,   // temporary
 					new File(persistenceDirectory, "cache"),
           "",                               // no rule loader
-					relatedQueryHandlerClassName,
 					null);                            // no default content handler
 
 			database.addResolverFactory("org.mulgara.resolver.test.TestResolverFactory", null);

Modified: trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
===================================================================
--- trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java	2006-10-23 06:13:44 UTC (rev 108)
+++ trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java	2006-10-23 10:47:07 UTC (rev 109)
@@ -573,9 +573,6 @@
 
     String tmfClassName = "org.mulgara.resolver.JotmTransactionManagerFactory";
 
-    String relatedQueryHandlerClassName =
-        "org.mulgara.resolver.RelatedQueryHandlerImpl";
-
     TransactionManagerFactory transactionManagerFactory =
       (TransactionManagerFactory) Beans.instantiate(null, tmfClassName);
 
@@ -599,7 +596,6 @@
         systemResolverFactoryClassName,   // temporary
         new File(persistenceDirectory, "cache"),
         "",                               // no rule loader
-        relatedQueryHandlerClassName,
         null);                            // no default content handler
 
     database.addResolverFactory("org.mulgara.resolver.url.URLResolverFactory", null);




More information about the Mulgara-svn mailing list