Strabon

changeset 1415:cd490830c36d

refixed bug #69
author Babis Nikolaou <charnik@di.uoa.gr>
date Mon Sep 22 14:41:06 2014 +0300 (2014-09-22)
parents eb28e195755a
children df3595d612f3
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java	Mon Sep 22 14:12:58 2014 +0300
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java	Mon Sep 22 14:41:06 2014 +0300
     1.3 @@ -66,6 +66,12 @@
     1.4  	 */
     1.5  	private int srid;
     1.6  	
     1.7 +	/**
     1.8 +	 * NOTICE: no check of the validity of the supplied WKT is done
     1.9 +	 * 
    1.10 +	 * @param literalValue
    1.11 +	 * @param datatype
    1.12 +	 */
    1.13  	public AbstractWKT(String literalValue, String datatype) {
    1.14  		this.datatype = datatype;
    1.15  		
    1.16 @@ -86,10 +92,12 @@
    1.17  	 * It should be used only when one does not have such information
    1.18  	 * available.
    1.19  	 * 
    1.20 -	 * NOTICE: it is not guaranteed that guessing will fill-in the
    1.21 +	 * NOTICE 1: it is not guaranteed that guessing will fill-in the
    1.22  	 * datatype, but it is guaranteed that parsing will be done
    1.23  	 * correctly in any case (well, except for illegal cases).
    1.24  	 * 
    1.25 +	 * NOTICE 2: no check of the validity of the supplied WKT is done
    1.26 +	 * 
    1.27  	 * @param literalValue
    1.28  	 */
    1.29  	public AbstractWKT(String literalValue) {
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Mon Sep 22 14:12:58 2014 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Mon Sep 22 14:41:06 2014 +0300
     2.3 @@ -492,7 +492,7 @@
     2.4  			}
     2.5  			
     2.6  		} catch (Exception e) {
     2.7 -			logger.error("[Strabon.evaluate(FunctionCall)] Error during evaluation of extension function.", e);
     2.8 +			logger.error("[Strabon.evaluate(FunctionCall)] Error during evaluation of extension function {}: {}", function.getURI(), e.getMessage());
     2.9  			return null;
    2.10  		}
    2.11  	}
    2.12 @@ -1004,8 +1004,11 @@
    2.13  	 * 
    2.14  	 * @param value
    2.15  	 * @return
    2.16 +	 * @throws ParseException
    2.17 +	 * 			when the supplied value is a constant ({@link Literal}) and is not
    2.18 +	 * 			a valid WKT literal
    2.19  	 */
    2.20 -	public String getSRIDFromValue(Value value) {
    2.21 +	public String getSRIDFromValue(Value value) throws ParseException {
    2.22  		boolean iswktLiteral = false;
    2.23  		int srid = -1;
    2.24  		
    2.25 @@ -1025,7 +1028,7 @@
    2.26  				iswktLiteral = true;
    2.27  			}
    2.28  			
    2.29 -		} else if (value instanceof Literal) {
    2.30 +		} else if (value instanceof Literal) { // this is actually a constant 
    2.31  			Literal literal = (Literal) value;
    2.32  			AbstractWKT wkt;
    2.33  			
    2.34 @@ -1035,11 +1038,16 @@
    2.35  			} else {
    2.36  				wkt = new AbstractWKT(literal.stringValue());
    2.37  			}
    2.38 -			 
    2.39 +			
    2.40  			srid = wkt.getSRID();
    2.41 +			
    2.42  			if (!wkt.isstRDFWKT()) {
    2.43  				iswktLiteral = true;
    2.44  			}
    2.45 +			
    2.46 +			// we are constructing a {@link StrabonPolyhedron} now to check
    2.47 +			// its validity
    2.48 +			JTSWrapper.getInstance().WKTread(wkt.getWKT());
    2.49  		}
    2.50  		
    2.51  		if (iswktLiteral && srid == GeoConstants.EPSG4326_SRID) {