[Mulgara-svn] r418 - in branches/mgr-69/src/jar: query/java/org/mulgara/query resolver/java/org/mulgara/resolver

andrae at mulgara.org andrae at mulgara.org
Tue Sep 11 05:51:26 UTC 2007


Author: andrae
Date: 2007-09-11 00:51:26 -0500 (Tue, 11 Sep 2007)
New Revision: 418

Modified:
   branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelExpression.java
   branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelIntersection.java
   branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelLiteral.java
   branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelOperation.java
   branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelPartition.java
   branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelResource.java
   branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelUnion.java
   branches/mgr-69/src/jar/resolver/java/org/mulgara/resolver/LocalQuery.java
Log:
The third time I've cleaned this mess up - next commit will finish removing the
Transform cruft from the *Expression hierarchy.



Modified: branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelExpression.java
===================================================================
--- branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelExpression.java	2007-09-11 04:15:43 UTC (rev 417)
+++ branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelExpression.java	2007-09-11 05:51:26 UTC (rev 418)
@@ -49,7 +49,7 @@
  *
  * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
  */
-public interface ModelExpression extends Transformable, Cloneable {
+public interface ModelExpression extends Cloneable {
 
   /**
    * Allow newer compiled version of the stub to operate when changes
@@ -70,27 +70,6 @@
   public Set getDatabaseURIs();
 
   /**
-   * Generate the WHERE constraint equivalent to this FROM constraint. This
-   * method is really part of query resolution, and properly would belong in the
-   * resolver package.
-   *
-   * @param constraint the WHERE constraint which we want to further constraint
-   *      according to this FROM clause
-   * @param transformation localizing transformation
-   * @param modelProperty the local node representing the
-   *   <code>mulgara:model</code> property
-   * @param systemModel the local node representing the system model
-   *   (<code>#</code>)
-   * @param variableFactory a factory for anonymous link variables
-   * @return the expanded WHERE constraint, incorporating this FROM clause
-   * @throws TransformationException if <var>transformation</var> fails to
-   *      convert a model resource from the global (RDF) namespace
-   */
-  public ConstraintExpression toConstraintExpression(Constraint constraint,
-      Transformation transformation, Value modelProperty, Value systemModel,
-      VariableFactory variableFactory) throws TransformationException;
-
-  /**
    * Clones sets of models in the rhs and lhs objects.
    */
   public Object clone();

Modified: branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelIntersection.java
===================================================================
--- branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelIntersection.java	2007-09-11 04:15:43 UTC (rev 417)
+++ branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelIntersection.java	2007-09-11 05:51:26 UTC (rev 418)
@@ -70,33 +70,6 @@
   }
 
   /**
-   * METHOD TO DO
-   *
-   * @param constraint PARAMETER TO DO
-   * @param transformation PARAMETER TO DO
-   * @param modelProperty PARAMETER TO DO
-   * @param systemModel PARAMETER TO DO
-   * @param variableFactory PARAMETER TO DO
-   * @return RETURNED VALUE TO DO
-   * @throws TransformationException EXCEPTION TO DO
-   */
-  public ConstraintExpression toConstraintExpression(Constraint constraint,
-
-  // (s p o m)
-  Transformation transformation, Value modelProperty,
-  // mulgara:model
-  Value systemModel,
-  // #SYSTEM
-  VariableFactory variableFactory) throws TransformationException {
-
-    return new ConstraintConjunction(getLHS().toConstraintExpression(constraint,
-        transformation, modelProperty, systemModel, variableFactory),
-      getRHS().toConstraintExpression(constraint, transformation,
-        modelProperty, systemModel, variableFactory));
-  }
-
-
-  /**
    * Legible representation
    *
    * @return RETURNED VALUE TO DO

Modified: branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelLiteral.java
===================================================================
--- branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelLiteral.java	2007-09-11 04:15:43 UTC (rev 417)
+++ branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelLiteral.java	2007-09-11 05:51:26 UTC (rev 418)
@@ -148,27 +148,6 @@
     return in;
   }
 
-  /**
-   * @param constraint PARAMETER TO DO
-   * @param transformation PARAMETER TO DO
-   * @param modelProperty PARAMETER TO DO
-   * @param systemModel PARAMETER TO DO
-   * @param variableFactory PARAMETER TO DO
-   * @return RETURNED VALUE TO DO
-   * @throws UnsupportedOperationException always
-   */
-  public ConstraintExpression toConstraintExpression(Constraint constraint,
-      // (s p o m)
-      Transformation transformation, Value modelProperty,
-      // mulgara:model
-      Value systemModel,
-      // #SYSTEM
-      VariableFactory variableFactory) {
-
-    throw new UnsupportedOperationException(
-        "Literal models can't be converted to WHERE clauses yet");
-  }
-
   //
   // Methods implementing Transformable
   //

Modified: branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelOperation.java
===================================================================
--- branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelOperation.java	2007-09-11 04:15:43 UTC (rev 417)
+++ branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelOperation.java	2007-09-11 05:51:26 UTC (rev 418)
@@ -144,27 +144,6 @@
   }
 
   /**
-   * METHOD TO DO
-   *
-   * @param constraint PARAMETER TO DO
-   * @param transformation PARAMETER TO DO
-   * @param modelProperty PARAMETER TO DO
-   * @param systemModel PARAMETER TO DO
-   * @param variableFactory PARAMETER TO DO
-   * @return RETURNED VALUE TO DO
-   * @throws TransformationException EXCEPTION TO DO
-   */
-  public abstract ConstraintExpression toConstraintExpression(
-      Constraint constraint,
-      // (s p o m)
-      Transformation transformation,
-      Value modelProperty,
-      // mulgara:model
-      Value systemModel,
-      // #SYSTEM
-      VariableFactory variableFactory) throws TransformationException;
-
-  /**
    * Transform the left and right hand sides of this operation.
    *
    * @param transformation the {@link Transformation} to apply

Modified: branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelPartition.java
===================================================================
--- branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelPartition.java	2007-09-11 04:15:43 UTC (rev 417)
+++ branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelPartition.java	2007-09-11 05:51:26 UTC (rev 418)
@@ -83,34 +83,6 @@
   }
 
   /**
-   * METHOD TO DO
-   *
-   * @param constraint PARAMETER TO DO
-   * @param transformation PARAMETER TO DO
-   * @param modelProperty PARAMETER TO DO
-   * @param systemModel PARAMETER TO DO
-   * @param variableFactory PARAMETER TO DO
-   * @return RETURNED VALUE TO DO
-   * @throws TransformationException EXCEPTION TO DO
-   */
-  public ConstraintExpression toConstraintExpression(Constraint constraint,
-
-  // (s p o m)
-  Transformation transformation, Value modelProperty,
-  // mulgara:model
-  Value systemModel,
-  // #SYSTEM
-  VariableFactory variableFactory) throws TransformationException {
-
-    logger.warn("Replacing partition operation with disjunction");
-
-    return new ConstraintDisjunction(getLHS().toConstraintExpression(constraint,
-        transformation, modelProperty, systemModel, variableFactory),
-      getRHS().toConstraintExpression(constraint, transformation,
-        modelProperty, systemModel, variableFactory));
-  }
-
-  /**
    * Legible representation
    *
    * @return RETURNED VALUE TO DO

Modified: branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelResource.java
===================================================================
--- branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelResource.java	2007-09-11 04:15:43 UTC (rev 417)
+++ branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelResource.java	2007-09-11 05:51:26 UTC (rev 418)
@@ -149,39 +149,6 @@
     return uri;
   }
 
-  /**
-   * METHOD TO DO
-   *
-   * @param constraint PARAMETER TO DO
-   * @param transformation PARAMETER TO DO
-   * @param modelProperty PARAMETER TO DO
-   * @param systemModel PARAMETER TO DO
-   * @param variableFactory PARAMETER TO DO
-   * @return RETURNED VALUE TO DO
-   * @throws TransformationException EXCEPTION TO DO
-   */
-  public ConstraintExpression toConstraintExpression(Constraint constraint,
-      // (s p o m)
-      Transformation transformation, Value modelProperty,
-      // mulgara:model
-      Value systemModel,
-      // #SYSTEM
-      VariableFactory variableFactory) throws TransformationException {
-
-    // Localize this model resource
-    Value model = transformation.transform(new URIReferenceImpl(uri));
-
-    // Generate the anonymous join variable $group
-    Variable group = variableFactory.newVariable();
-
-    // Return (s p o m) or ((s p o $group) and ($group mulgara:model m #SYSTEM))
-    return new ConstraintDisjunction(new ConstraintImpl(constraint.getElement(0),
-        constraint.getElement(1), constraint.getElement(2), model),
-        new ConstraintConjunction(new ConstraintImpl(constraint.getElement(0),
-        constraint.getElement(1), constraint.getElement(2), group),
-        new ConstraintImpl(group, modelProperty, model, systemModel)));
-  }
-
   //
   // Methods implementing Transformable
   //

Modified: branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelUnion.java
===================================================================
--- branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelUnion.java	2007-09-11 04:15:43 UTC (rev 417)
+++ branches/mgr-69/src/jar/query/java/org/mulgara/query/ModelUnion.java	2007-09-11 05:51:26 UTC (rev 418)
@@ -70,32 +70,6 @@
   }
 
   /**
-   * METHOD TO DO
-   *
-   * @param constraint PARAMETER TO DO
-   * @param transformation PARAMETER TO DO
-   * @param modelProperty PARAMETER TO DO
-   * @param systemModel PARAMETER TO DO
-   * @param variableFactory PARAMETER TO DO
-   * @return RETURNED VALUE TO DO
-   * @throws TransformationException EXCEPTION TO DO
-   */
-  public ConstraintExpression toConstraintExpression(Constraint constraint,
-
-  // (s p o m)
-  Transformation transformation, Value modelProperty,
-  // mulgara:model
-  Value systemModel,
-  // #SYSTEM
-  VariableFactory variableFactory) throws TransformationException {
-
-    return new ConstraintDisjunction(getLHS().toConstraintExpression(constraint,
-        transformation, modelProperty, systemModel, variableFactory),
-      getRHS().toConstraintExpression(constraint, transformation,
-        modelProperty, systemModel, variableFactory));
-  }
-
-  /**
    * Legible representation
    *
    * @return RETURNED VALUE TO DO

Modified: branches/mgr-69/src/jar/resolver/java/org/mulgara/resolver/LocalQuery.java
===================================================================
--- branches/mgr-69/src/jar/resolver/java/org/mulgara/resolver/LocalQuery.java	2007-09-11 04:15:43 UTC (rev 417)
+++ branches/mgr-69/src/jar/resolver/java/org/mulgara/resolver/LocalQuery.java	2007-09-11 05:51:26 UTC (rev 418)
@@ -97,6 +97,8 @@
 
   private LocalQueryResolver context;
 
+  private Query query;
+
   //
   // Constructor
   //
@@ -128,6 +130,8 @@
       throw new IllegalArgumentException("Null \"resolverSession\" parameter");
     }
 
+    this.query = (Query)query.clone();
+
     // Initialize fields
     this.context = new LocalQueryResolver(context, resolverSession);
     this.resolverSession = resolverSession;
@@ -176,7 +180,7 @@
         logger.debug("Stacktrace: ", new Throwable());
       }
 
-      Tuples result = ConstraintOperations.resolveConstraintExpression(context, modelExpression, constraintExpression);
+      Tuples result = ConstraintOperations.resolveConstraintExpression(context, query.getModelExpression(), constraintExpression);
 
       if (logger.isDebugEnabled()) {
         logger.debug("Tuples result = " + TuplesOperations.formatTuplesTree(result));
@@ -316,6 +320,7 @@
   {
     try {
       given.close();
+      query.close();
     } catch (TuplesException et) {
       throw new QueryException("Failed to close given clause", et);
     }




More information about the Mulgara-svn mailing list