# HG changeset patch # User Babis Nikolaou # Date 1411392925 -10800 # Node ID a232e330769333d599dca222cb2ffb2ad5a7f42b # Parent a1cf22bfb573ad20a6a0c45998fd87e668d73f9c more type checking in extension functions in SELECT clause; added also some FIXME and TODO notes diff -r a1cf22bfb573 -r a232e3307693 generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Mon Sep 22 16:24:07 2014 +0300 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Mon Sep 22 16:35:25 2014 +0300 @@ -812,7 +812,9 @@ return null; } - + /** + * TODO check required number of arguments + */ GeneralDBSqlExpr spatialRelationshipFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException { ValueExpr left = functionCall.getArgs().get(0); @@ -852,6 +854,9 @@ return spatialRelationshipPicker(function, leftArg, rightArg, thirdArg); } + /** + * TODO check required number of arguments + */ GeneralDBSqlExpr spatialConstructFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException { GeneralDBSqlExpr leftArg = null; @@ -948,6 +953,9 @@ } + /** + * TODO check required number of arguments + */ GeneralDBSqlExpr spatialMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException { GeneralDBSqlExpr leftArg = null; @@ -1188,6 +1196,10 @@ } + + /** + * FIXME don't check function using getURI(); use instanceof instead + */ GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg) { if(function.getURI().equals(GeoConstants.stSPARQLunion)) @@ -1278,6 +1290,7 @@ * * @author George Garbis * + * FIXME don't check function using getURI(); use instanceof instead */ GeneralDBSqlExpr dateTimeMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) { @@ -1290,7 +1303,10 @@ return null; } - //TODO more to be added here probably + /** + * TODO check required number of arguments + * FIXME don't check function using getURI(); use instanceof instead + */ GeneralDBSqlExpr spatialMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg) { if(function.getURI().equals(GeoConstants.stSPARQLdistance)) @@ -1310,6 +1326,9 @@ return null; } + /** + * FIXME don't check function using getURI(); use instanceof instead + */ GeneralDBSqlExpr spatialPropertyPicker(Function function, GeneralDBSqlExpr arg) { if(function.getURI().equals(GeoConstants.stSPARQLdimension)) diff -r a1cf22bfb573 -r a232e3307693 generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Mon Sep 22 16:24:07 2014 +0300 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Mon Sep 22 16:35:25 2014 +0300 @@ -375,6 +375,9 @@ else if(function instanceof SpatialRelationshipFunc) { // Any boolean function present in HAVING - Must evaluate here! + // check required number of arguments + checkArgs(leftResult, rightResult, thirdResult, 2); + boolean funcResult = false; // get the geometries and the SRIDs of the left/right arguments @@ -541,6 +544,9 @@ } } + /** + * FIXME don't check function using getURI(); use instanceof instead + */ public StrabonPolyhedron spatialConstructPicker(Function function, Value left, Value right, Value third) throws Exception { StrabonPolyhedron leftArg = getValueAsStrabonPolyhedron(left); @@ -705,7 +711,7 @@ return Long.MAX_VALUE; } - //XXX brought it here to override it somehow.. + // brought it here to override it somehow.. // @Override // public CloseableIteration evaluate(Extension extension, // BindingSet bindings) @@ -714,7 +720,7 @@ // CloseableIteration result; // // /** - // * XXX additions + // * additions // */ // Iterator iter = extension.getElements().iterator(); // //for(ExtensionElem elem : extension.getElements()) @@ -781,7 +787,7 @@ for (String name : qb.getBindingNames(var)) { if (!bindings.hasBinding(name)) { var.setIndex(index); - //XXX if the variable is actually a GeoVar + // if the variable is actually a GeoVar if(var.isSpatial()) { this.geoNames.put(var.getName(), var.getIndex() + 2); @@ -792,7 +798,7 @@ query.select(proj.getStringValue()); index += 2; if (var.getTypes().isLiterals()) { - //FIXME changed to remove extra unneeded joins + selections + // NOTE: changed to remove extra unneeded joins + selections //Original: //query.select(proj.getLanguage()); //query.select(proj.getDatatype()); @@ -816,7 +822,7 @@ } } - //XXX Attention: Will try to add projections in select for the constructs + // Attention: Will try to add projections in select for the constructs Iterator it = qb.getSpatialConstructs().entrySet().iterator(); while (it.hasNext()) { @SuppressWarnings("rawtypes")