Strabon
changeset 1419:f602e11d476f
fixed a test that was using strdf:distance in ORDER BY clause with two arguments (expecting three arguments always) and de-activated evaluation of grounded expressions in SELECT queries in Java (see the respective #72 the reason I did so)
line diff
1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Mon Sep 22 16:35:25 2014 +0300 1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Mon Sep 22 18:15:44 2014 +0300 1.3 @@ -700,6 +700,14 @@ 1.4 return poly; 1.5 } 1.6 1.7 + /** 1.8 + * Think that this computation is done in meters and there is no way of doing it 1.9 + * in degrees, except if one calculate the corresponding transformation, which 1.10 + * depends on the spatial reference system used! 1.11 + * 1.12 + * A not so good approximation of meters for degrees: 1.13 + * double meters = (degrees * 6378137 * Math.PI) / 180; 1.14 + */ 1.15 public static StrabonPolyhedron buffer(StrabonPolyhedron A, double B) throws Exception { 1.16 return new StrabonPolyhedron(A.geometry.buffer(B), A.getGeometry().getSRID(), A.getGeometryDatatype()); 1.17 }
2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Mon Sep 22 16:35:25 2014 +0300 2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Mon Sep 22 18:15:44 2014 +0300 2.3 @@ -562,22 +562,22 @@ 2.4 // check required number of arguments 2.5 checkArgs(left, right, third, 3); 2.6 2.7 - // TODO implement computation of the buffer in meters 2.8 + // TODO implement computation of the buffer in degrees 2.9 // you'll get the type (degrees/meter) from the thirdResult, which 2.10 // would be a URI. 2.11 - if (OGCConstants.OGCmetre.equals(third.stringValue())) { 2.12 - logger.info("[GeneraDBEvaluation] Computation of {} will be done in degrees.", function.getURI()); 2.13 + if (OGCConstants.OGCdegree.equals(third.stringValue())) { 2.14 + logger.info("[GeneraDBEvaluation] Computation of {} will be done in meters.", function.getURI()); 2.15 } 2.16 2.17 if(right instanceof LiteralImpl) 2.18 { 2.19 - LiteralImpl radius = (LiteralImpl) right; 2.20 - return StrabonPolyhedron.buffer(leftArg, radius.doubleValue()); 2.21 + LiteralImpl meters = (LiteralImpl) right; 2.22 + return StrabonPolyhedron.buffer(leftArg, meters.doubleValue()); 2.23 } 2.24 else if (right instanceof RdbmsLiteral) 2.25 { 2.26 - RdbmsLiteral radius = (RdbmsLiteral) right; 2.27 - return StrabonPolyhedron.buffer(leftArg, radius.doubleValue()); 2.28 + RdbmsLiteral meters = (RdbmsLiteral) right; 2.29 + return StrabonPolyhedron.buffer(leftArg, meters.doubleValue()); 2.30 } 2.31 } 2.32 else if(function.getURI().equals(GeoConstants.stSPARQLtransform))
3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Mon Sep 22 16:35:25 2014 +0300 3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Mon Sep 22 18:15:44 2014 +0300 3.3 @@ -183,16 +183,15 @@ 3.4 } 3.5 3.6 @Override 3.7 - public void meet(Distinct node) 3.8 - throws RuntimeException 3.9 - { 3.10 + public void meet(Distinct node) throws RuntimeException 3.11 + { 3.12 super.meet(node); 3.13 if (node.getArg() instanceof GeneralDBSelectQuery) { 3.14 GeneralDBSelectQuery query = (GeneralDBSelectQuery)node.getArg(); 3.15 query.setDistinct(true); 3.16 node.replaceWith(query); 3.17 } 3.18 - } 3.19 + } 3.20 3.21 @Override 3.22 public void meet(Union node) throws RuntimeException 3.23 @@ -238,9 +237,8 @@ 3.24 } 3.25 3.26 @Override 3.27 - public void meet(Join node) 3.28 - throws RuntimeException 3.29 - { 3.30 + public void meet(Join node) throws RuntimeException 3.31 + { 3.32 super.meet(node); 3.33 TupleExpr l = node.getLeftArg(); 3.34 TupleExpr r = node.getRightArg(); 3.35 @@ -261,12 +259,11 @@ 3.36 * This change was made before altering the spatial joins operation 3.37 */ 3.38 reference = left; 3.39 - } 3.40 + } 3.41 3.42 @Override 3.43 - public void meet(LeftJoin node) 3.44 - throws RuntimeException 3.45 - { 3.46 + public void meet(LeftJoin node) throws RuntimeException 3.47 + { 3.48 super.meet(node); 3.49 TupleExpr l = node.getLeftArg(); 3.50 TupleExpr r = node.getRightArg(); 3.51 @@ -297,7 +294,7 @@ 3.52 } 3.53 node.replaceWith(left); 3.54 reference = left; 3.55 - } 3.56 + } 3.57 3.58 @Override 3.59 public void meet(StatementPattern sp) { 3.60 @@ -484,10 +481,8 @@ 3.61 } 3.62 3.63 @Override 3.64 - public void meet(Filter node) 3.65 - throws RuntimeException 3.66 - { 3.67 - 3.68 + public void meet(Filter node) throws RuntimeException 3.69 + { 3.70 /** 3.71 * XXX 21/09/2011 addition for spatial joins 3.72 * Ekmetalleyomai to gegonos oti exw 'fytepsei' sta embolima filters twn joins mia statement pattern me to onoma -dummy-
4.1 --- a/resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java Mon Sep 22 16:35:25 2014 +0300 4.2 +++ b/resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java Mon Sep 22 18:15:44 2014 +0300 4.3 @@ -22,8 +22,6 @@ 4.4 import org.openrdf.model.BNode; 4.5 import org.openrdf.model.Literal; 4.6 import org.openrdf.model.Value; 4.7 -import org.openrdf.model.impl.LiteralImpl; 4.8 -import org.openrdf.model.impl.URIImpl; 4.9 import org.openrdf.query.Binding; 4.10 import org.openrdf.query.BindingSet; 4.11 import org.openrdf.query.TupleQueryResultHandlerException;
5.1 --- a/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Distance_stRDF.rq Mon Sep 22 16:35:25 2014 +0300 5.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Distance_stRDF.rq Mon Sep 22 18:15:44 2014 +0300 5.3 @@ -9,5 +9,5 @@ 5.4 5.5 FILTER(str(?x) < str(?y)) 5.6 } 5.7 -ORDER BY DESC(strdf:distance(?g1,?g2)) 5.8 +ORDER BY DESC(strdf:distance(?g1, ?g2, ogc:degree)) 5.9 LIMIT 2 5.10 \ No newline at end of file