Strabon
changeset 1414:eb28e195755a
fixed bug that would cause a class cast exception for grounded expressions with function nesting in the SELECT clause
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Mon Sep 22 14:12:58 2014 +0300 (2014-09-22) |
parents | 97064bbd8442 |
children | cd490830c36d |
files | generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java |
line diff
1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Mon Sep 22 13:34:35 2014 +0300 1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Mon Sep 22 14:12:58 2014 +0300 1.3 @@ -308,7 +308,7 @@ 1.4 1.5 // function call with 2 or more arguments, evaluate the second one now 1.6 // see distance function as example 1.7 - if ( fc.getArgs().size() > 2 ) 1.8 + if ( fc.getArgs().size() >= 2 ) 1.9 { 1.10 ValueExpr right = fc.getArgs().get(1); 1.11 rightResult = evaluate(right, bindings); 1.12 @@ -502,7 +502,7 @@ 1.13 StrabonPolyhedron leftArg = getValueAsStrabonPolyhedron(left); 1.14 if(function.getURI().equals(GeoConstants.stSPARQLunion)) 1.15 { 1.16 - StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 1.17 + StrabonPolyhedron rightArg = getValueAsStrabonPolyhedron(right); 1.18 return StrabonPolyhedron.union(leftArg, rightArg); 1.19 } 1.20 else if (function instanceof BufferFunc) { 1.21 @@ -556,17 +556,17 @@ 1.22 } 1.23 else if(function.getURI().equals(GeoConstants.stSPARQLintersection)) 1.24 { 1.25 - StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 1.26 + StrabonPolyhedron rightArg = getValueAsStrabonPolyhedron(right); 1.27 return StrabonPolyhedron.intersection(leftArg, rightArg); 1.28 } 1.29 else if(function.getURI().equals(GeoConstants.stSPARQLdifference)) 1.30 { 1.31 - StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 1.32 + StrabonPolyhedron rightArg = getValueAsStrabonPolyhedron(right); 1.33 return StrabonPolyhedron.difference(leftArg, rightArg); 1.34 } 1.35 else if(function.getURI().equals(GeoConstants.stSPARQLsymDifference)) 1.36 { 1.37 - StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 1.38 + StrabonPolyhedron rightArg = getValueAsStrabonPolyhedron(right); 1.39 return StrabonPolyhedron.symDifference(leftArg, rightArg); 1.40 1.41 } else if (function instanceof Centroid) {
2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Mon Sep 22 13:34:35 2014 +0300 2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Mon Sep 22 14:12:58 2014 +0300 2.3 @@ -996,13 +996,14 @@ 2.4 GeneralDBSqlExpr sqlExpr = null; 2.5 String name = elem.getName(); 2.6 2.7 - if(expr instanceof FunctionCall && !isFuncExprGrounded(expr)) 2.8 + //if (expr instanceof FunctionCall) 2.9 + if (expr instanceof FunctionCall && !isFuncExprGrounded(expr)) 2.10 { // if the expr is grounded we are going to evaluate it in Java 2.11 if(!evaluateInJava(expr)) 2.12 { 2.13 Function function = FunctionRegistry.getInstance().get(((FunctionCall) expr).getURI()); 2.14 - if(function instanceof SpatialPropertyFunc || function instanceof SpatialRelationshipFunc 2.15 - || function instanceof SpatialConstructFunc || function instanceof SpatialMetricFunc) 2.16 + if(function instanceof SpatialPropertyFunc || function instanceof SpatialRelationshipFunc || 2.17 + function instanceof SpatialConstructFunc || function instanceof SpatialMetricFunc) 2.18 { 2.19 try { 2.20 sqlExpr = sql.getBooleanExprFactory().spatialFunction((FunctionCall) expr);