Strabon

changeset 373:617f0030d0af

added some comments to GeneralDBEvaluation
author Babis Nikolaou <charnik@di.uoa.gr>
date Wed Jun 27 13:50:33 2012 +0300 (2012-06-27)
parents 8714353b3a2c
children 615faa3fed91
files generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Wed Jun 27 13:31:06 2012 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Wed Jun 27 13:50:33 2012 +0300
     1.3 @@ -150,8 +150,8 @@
     1.4  	@Override
     1.5  	public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(TupleExpr expr,
     1.6  			BindingSet bindings)
     1.7 -					throws QueryEvaluationException
     1.8 -					{
     1.9 +	throws QueryEvaluationException
    1.10 +	{
    1.11  		if (expr instanceof GeneralDBSelectQuery)
    1.12  			return evaluate((GeneralDBSelectQuery)expr, bindings);
    1.13  		else if (expr instanceof Group) {
    1.14 @@ -165,8 +165,8 @@
    1.15  	
    1.16  	@Override
    1.17  	public Value evaluate(ValueExpr expr, BindingSet bindings)
    1.18 -			throws ValueExprEvaluationException, QueryEvaluationException
    1.19 -			{
    1.20 +	throws ValueExprEvaluationException, QueryEvaluationException
    1.21 +	{
    1.22  		if (expr instanceof Var) {
    1.23  			return evaluate((Var)expr, bindings);
    1.24  		}
    1.25 @@ -174,7 +174,7 @@
    1.26  			return evaluate((FunctionCall)expr, bindings);
    1.27  		}
    1.28  		return super.evaluate(expr, bindings);
    1.29 -			}
    1.30 +	}
    1.31  
    1.32  	/**
    1.33  	 * Had to use it for the cases met in group by (Union as an aggregate)
    1.34 @@ -227,8 +227,6 @@
    1.35  	@Override
    1.36  	public Value evaluate(FunctionCall fc, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException
    1.37  	{
    1.38 -		//System.out.println("FunctionCall placeholder");
    1.39 -
    1.40  		if(fc.getParentNode() instanceof Avg)
    1.41  		{
    1.42  			if(fc.getParentNode().getParentNode() instanceof GroupElem)
    1.43 @@ -268,34 +266,24 @@
    1.44  		//					e.printStackTrace();
    1.45  		//				}
    1.46  		//		}
    1.47 +		
    1.48 +		// get the first argument of the function
    1.49  		ValueExpr left = fc.getArgs().get(0);
    1.50  
    1.51 -
    1.52 +		// evaluated first argument of function
    1.53  		Value leftResult = null;
    1.54 +		
    1.55 +		// evaluated second argument of function (if any)
    1.56  		Value rightResult = null;
    1.57  
    1.58 -		//		try {
    1.59 +		// evaluate first argument
    1.60  		leftResult = evaluate(left,bindings);
    1.61 -		//		} catch (ValueExprEvaluationException e) {
    1.62 -		//			e.printStackTrace();
    1.63 -		//		} catch (QueryEvaluationException e) {
    1.64 -		//			e.printStackTrace();
    1.65 -		//		}
    1.66  
    1.67 -
    1.68 -		//		if(!(function instanceof EnvelopeFunc) 
    1.69 -		//				&& !(function instanceof ConvexHullFunc) 
    1.70 -		//				&& !(function instanceof BoundaryFunc))
    1.71 +		// function call with 2 arguments, evaluate the second one now
    1.72  		if ( fc.getArgs().size() == 2 )
    1.73  		{
    1.74  			ValueExpr right = fc.getArgs().get(1);
    1.75 -			//			try {
    1.76  			rightResult = evaluate(right,bindings);
    1.77 -			//			} catch (ValueExprEvaluationException e) {
    1.78 -			//				e.printStackTrace();
    1.79 -			//			} catch (QueryEvaluationException e) {
    1.80 -			//				e.printStackTrace();
    1.81 -			//			}
    1.82  		}
    1.83  
    1.84  		try {
    1.85 @@ -352,7 +340,6 @@
    1.86  					return null;
    1.87  				}
    1.88  
    1.89 -
    1.90  				if(function instanceof AboveFunc)
    1.91  				{
    1.92  					int targetSRID = leftGeom.getSRID();