Strabon

changeset 162:b73979490392

meeeeerge
author Konstantina Mpereta <grad1110@di.uoa.gr>
date Fri May 18 15:30:14 2012 +0300 (2012-05-18)
parents 7ad30411591b 18a4e7fd3922
children 0e40bd909071
files
line diff
     1.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri May 18 15:25:48 2012 +0300
     1.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri May 18 15:30:14 2012 +0300
     1.3 @@ -104,6 +104,12 @@
     1.4   */
     1.5  public class PostGISQueryBuilder extends GeneralDBQueryBuilder {
     1.6  
     1.7 +	/**
     1.8 +	 * If (spatial) label column met is null, I must not try to retrieve its srid. 
     1.9 +	 * Opting to ask for 'null' instead
    1.10 +	 */
    1.11 +	boolean nullLabel = false;
    1.12 +	
    1.13  	public enum SpatialOperandsPostGIS { anyInteract, equals, contains, inside, left, right, above, below; }
    1.14  	public enum SpatialFunctionsPostGIS 
    1.15  	{ 	//stSPARQL++
    1.16 @@ -211,6 +217,7 @@
    1.17  	protected void append(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) {
    1.18  		if (var.getRdbmsVar().isResource()) {
    1.19  			filter.appendNull();
    1.20 +			nullLabel = true;
    1.21  		}
    1.22  		else {
    1.23  			if(var.isSpatial())
    1.24 @@ -759,8 +766,17 @@
    1.25  					if(tmp instanceof GeneralDBLabelColumn)
    1.26  					{
    1.27  						//Reached the innermost left var -> need to capture its SRID
    1.28 -						String alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
    1.29 -						alias=alias+".srid";
    1.30 +						String alias;
    1.31 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    1.32 +							//Predicates used in triple patterns non-existent in db
    1.33 +							alias="NULL";
    1.34 +						}
    1.35 +						else
    1.36 +						{
    1.37 +							//Reached the innermost left var -> need to capture its SRID
    1.38 +							alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
    1.39 +							alias=alias+".srid";
    1.40 +						}
    1.41  						sridExpr = alias;
    1.42  						filter.append(sridExpr);
    1.43  						filter.closeBracket();
    1.44 @@ -1085,7 +1101,6 @@
    1.45  							alias=alias+".srid";
    1.46  						}
    1.47  						sridExpr = alias;
    1.48 -						//						((GeneralDBSqlSpatialConstructBinary)expr).setSrid(alias);
    1.49  						break;
    1.50  					}
    1.51  					else if (tmp instanceof GeneralDBStringValue) //Constant!!
    1.52 @@ -1219,10 +1234,18 @@
    1.53  					if(tmp instanceof GeneralDBLabelColumn)
    1.54  					{
    1.55  						//Reached the innermost left var -> need to capture its SRID
    1.56 -						String alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
    1.57 -						alias=alias+".srid";
    1.58 +						String alias;
    1.59 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    1.60 +							//Predicates used in triple patterns non-existent in db
    1.61 +							alias="NULL";
    1.62 +						}
    1.63 +						else
    1.64 +						{
    1.65 +							//Reached the innermost left var -> need to capture its SRID
    1.66 +							alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
    1.67 +							alias=alias+".srid";
    1.68 +						}
    1.69  						sridExpr = alias;
    1.70 -						//						((GeneralDBSqlSpatialConstructBinary)expr).setSrid(alias);
    1.71  						break;
    1.72  					}
    1.73  					else if (tmp instanceof GeneralDBStringValue) //Constant!!
    1.74 @@ -1415,9 +1438,17 @@
    1.75  					if(tmp instanceof GeneralDBLabelColumn)
    1.76  					{
    1.77  						//Reached the innermost left var -> need to capture its SRID
    1.78 -						String alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
    1.79 -						alias=alias+".srid";
    1.80 -						//((GeneralDBSqlSpatialConstructUnary)expr).setSrid(alias);
    1.81 +						String alias;
    1.82 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    1.83 +							//Predicates used in triple patterns non-existent in db
    1.84 +							alias="NULL";
    1.85 +						}
    1.86 +						else
    1.87 +						{
    1.88 +							//Reached the innermost left var -> need to capture its SRID
    1.89 +							alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
    1.90 +							alias=alias+".srid";
    1.91 +						}
    1.92  						sridExpr = alias;
    1.93  						break;
    1.94  					}