[Mulgara-svn] r828 - in branches/mgr-61-sparql/src/jar: resolver/java/org/mulgara/resolver resolver-spi/java/org/mulgara/resolver/spi

pag at mulgara.org pag at mulgara.org
Wed Apr 23 16:34:36 UTC 2008


Author: pag
Date: 2008-04-23 09:34:35 -0700 (Wed, 23 Apr 2008)
New Revision: 828

Modified:
   branches/mgr-61-sparql/src/jar/resolver-spi/java/org/mulgara/resolver/spi/QueryEvaluationContext.java
   branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java
   branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java
Log:
Removed the special resolve(ModelVariable,Constraint) method for QueryEvaluationContext, as the model renaming is better done in the ModelResolutionHandler for ModelVariable. This also let me remove the ModelResource casts on nulls in the ConstraintResolutionHandler for ConstraintImpl

Modified: branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java
===================================================================
--- branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java	2008-04-23 15:56:26 UTC (rev 827)
+++ branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java	2008-04-23 16:34:35 UTC (rev 828)
@@ -130,7 +130,7 @@
         new NVPair(ModelVariable.class, new ModelResolutionHandler() {
           public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr,
                                 Constraint constraint) throws Exception {
-            return context.resolve((ModelVariable)modelExpr, (Constraint)constraint);
+            return context.resolve(null, ConstraintOperations.rewriteConstraintModel(((ModelVariable)modelExpr).getVariable(), constraint));
           }
         })
       });
@@ -209,9 +209,9 @@
             } else if (constraintElem instanceof URIReference) {
               return ConstraintOperations.resolveModelExpression(context, new ModelResource(((URIReference)constraintElem).getURI()), (Constraint)constraintExpr);
             } else if (constraintElem instanceof LocalNode) {
-              return context.resolve((ModelResource)null, (ConstraintImpl)constraintExpr);
+              return context.resolve(null, (ConstraintImpl)constraintExpr);
             } else if (constraintElem instanceof Variable) {
-              return context.resolve((ModelResource)null, (ConstraintImpl)constraintExpr);
+              return context.resolve(null, (ConstraintImpl)constraintExpr);
             }
             else {
               throw new QueryException("Specified model not a URIReference/Variable: " + constraintElem +" is a " + constraintElem.getClass().getName() );

Modified: branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java
===================================================================
--- branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java	2008-04-23 15:56:26 UTC (rev 827)
+++ branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java	2008-04-23 16:34:35 UTC (rev 828)
@@ -197,38 +197,6 @@
   }
 
 
-  /**
-   * Resolve the variable leaf node of the <code>FROM</code> and
-   * <code>WHERE</code> clause product.
-   * @param modelVariable the <code>FROM<code> clause to resolve, never <code>null</codE>
-   * @param constraint the <code>WHERE</code> clause to resolve, which must
-   *   have a {@link Variable#FROM} as its fourth element, and never be <code>null</code>
-   * @throws QueryException if resolution can't be obtained
-   */
-  public Tuples resolve(ModelVariable modelVariable, Constraint constraint) throws QueryException
-  {
-    assert modelVariable != null || !constraint.getModel().equals(Variable.FROM);
-    assert constraint != null;
-
-    // Delegate constraint resolution back to the database session
-    try {
-      Constraint localized = ConstraintOperations.localize(this, constraint);
-
-      if (localized.getModel().equals(Variable.FROM)) {
-        localized = ConstraintOperations.rewriteConstraintModel(modelVariable.getVariable(), localized);
-      }
-
-      return operationContext.resolve(localized);
-
-    } catch (LocalizeException e) {
-      throw new QueryException("Unable to resolve FROM " + modelVariable + " WHERE " + constraint, e);
-    } catch (QueryException eq) {
-      throw new QueryException("Error resolving " + constraint + " from " + modelVariable, eq);
-    } catch (Exception e) {
-      throw new QueryException("Unexpected error resolving " + constraint + " from " + modelVariable, e);
-    }
-  }
-
   public Tuples resolve(ModelExpression modelExpression, ConstraintExpression constraintExpression) throws QueryException {
     return ConstraintOperations.resolveConstraintExpression(this, modelExpression, constraintExpression);
   }

Modified: branches/mgr-61-sparql/src/jar/resolver-spi/java/org/mulgara/resolver/spi/QueryEvaluationContext.java
===================================================================
--- branches/mgr-61-sparql/src/jar/resolver-spi/java/org/mulgara/resolver/spi/QueryEvaluationContext.java	2008-04-23 15:56:26 UTC (rev 827)
+++ branches/mgr-61-sparql/src/jar/resolver-spi/java/org/mulgara/resolver/spi/QueryEvaluationContext.java	2008-04-23 16:34:35 UTC (rev 828)
@@ -81,8 +81,6 @@
    */
   public Tuples resolve(ModelResource modelResource, Constraint constraint) throws QueryException;
 
-  public Tuples resolve(ModelVariable modelVariable, Constraint constraint) throws QueryException;
-
   public Tuples resolve(ModelExpression modelExpression, ConstraintExpression constraintExpression) throws QueryException;
 
   public ResolverSession getResolverSession();




More information about the Mulgara-svn mailing list