Strabon
changeset 376:f043fdd4afa9
some more comments in GeneralDBEvaluation
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Wed Jun 27 14:44:59 2012 +0300 (2012-06-27) |
parents | 5860fc473f03 |
children | 0e417864a3a6 |
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 14:27:05 2012 +0300 1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Wed Jun 27 14:44:59 2012 +0300 1.3 @@ -240,34 +240,10 @@ 1.4 } 1.5 } 1.6 1.7 + // get the function corresponding to the function call 1.8 Function function = FunctionRegistry.getInstance().get(fc.getURI()); 1.9 - 1.10 - // if(fc.getParentNode() instanceof Filter) 1.11 - // { 1.12 - // //Traditional Behavior! 1.13 - // try { 1.14 - // if (function == null) { 1.15 - // throw new QueryEvaluationException("Unknown function '" + fc.getURI() + "'"); 1.16 - // } 1.17 - // 1.18 - // List<ValueExpr> args = fc.getArgs(); 1.19 - // 1.20 - // Value[] argValues = new Value[args.size()]; 1.21 - // 1.22 - // for (int i = 0; i < args.size(); i++) { 1.23 - // 1.24 - // argValues[i] = evaluate(args.get(i), bindings); 1.25 - // 1.26 - // } 1.27 - // 1.28 - // return function.evaluate(tripleSource.getValueFactory(), argValues);} catch (ValueExprEvaluationException e) { 1.29 - // e.printStackTrace(); 1.30 - // } catch (QueryEvaluationException e) { 1.31 - // e.printStackTrace(); 1.32 - // } 1.33 - // } 1.34 1.35 - // get the first argument of the function 1.36 + // get the first argument of the function call 1.37 ValueExpr left = fc.getArgs().get(0); 1.38 1.39 // evaluated first argument of function 1.40 @@ -286,16 +262,20 @@ 1.41 rightResult = evaluate(right, bindings); 1.42 } 1.43 1.44 + // having evaluated the arguments of the function, evaluate the function 1.45 try { 1.46 - if ( function instanceof SpatialConstructFunc ) 1.47 + if ( function instanceof SpatialConstructFunc ) { 1.48 return spatialConstructPicker(function, leftResult, rightResult); 1.49 - //Any boolean function present in HAVING - Must evaluate here! 1.50 - else if(function instanceof SpatialRelationshipFunc) 1.51 - { 1.52 + 1.53 + } else if(function instanceof SpatialRelationshipFunc) { 1.54 + // Any boolean function present in HAVING - Must evaluate here! 1.55 + 1.56 boolean funcResult = false; 1.57 + 1.58 //For the time being I only include stSPARQL ones 1.59 Geometry leftGeom = null; 1.60 Geometry rightGeom = null; 1.61 + 1.62 if(leftResult instanceof StrabonPolyhedron) 1.63 { 1.64 leftGeom = ((StrabonPolyhedron) leftResult).getGeometry(); 1.65 @@ -415,7 +395,6 @@ 1.66 int targetSRID = leftGeom.getSRID(); 1.67 int sourceSRID = rightGeom.getSRID(); 1.68 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 1.69 - //System.out.println(rightConverted.toString()); 1.70 funcResult = leftGeom.overlaps(rightConverted); 1.71 } 1.72 else if(function instanceof RightFunc) 1.73 @@ -444,6 +423,7 @@ 1.74 for (int i = 0; i < args.size(); i++) { 1.75 argValues[i] = evaluate(args.get(i), bindings); 1.76 } 1.77 + 1.78 return function.evaluate(tripleSource.getValueFactory(), argValues); 1.79 } 1.80 } catch (Exception e) {