Strabon

changeset 1338:135662fde67f

#51: added a null alias for the variables that exist inside spatial functions that
do not occur in the where clause.
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Mon May 26 17:48:04 2014 +0300 (2014-05-26)
parents e5abd174045f
children b4ed3e06712c
files generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java	Wed May 07 01:19:31 2014 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java	Mon May 26 17:48:04 2014 +0300
     1.3 @@ -377,7 +377,8 @@
     1.4  
     1.5  		Number id = ids.idOf(num);
     1.6  		try {
     1.7 -			return new GeneralDBPolyhedron(id, literals.getIdVersion(), vf.createURI(datatype), wkb, srid);
     1.8 +			if(wkb != null)
     1.9 +				return new GeneralDBPolyhedron(id, literals.getIdVersion(), vf.createURI(datatype), wkb, srid);
    1.10  		} catch (IOException e) {
    1.11  			e.printStackTrace();
    1.12  		} catch (ClassNotFoundException e) {
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Wed May 07 01:19:31 2014 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Mon May 26 17:48:04 2014 +0300
     2.3 @@ -1154,7 +1154,7 @@
     2.4  	{
     2.5  		//I seriously doubt it will ever visit this case
     2.6  
     2.7 -		if (var.getRdbmsVar().isResource()) {
     2.8 +		if (var.getRdbmsVar()==null || var.getRdbmsVar().isResource()) {
     2.9  			filter.appendNull();
    2.10  
    2.11  		}
     3.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Wed May 07 01:19:31 2014 +0300
     3.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Mon May 26 17:48:04 2014 +0300
     3.3 @@ -267,7 +267,7 @@
     3.4  	
     3.5  	@Override
     3.6  	protected void append(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) {
     3.7 -		if (var.getRdbmsVar().isResource()) {
     3.8 +		if (var.getRdbmsVar() == null || var.getRdbmsVar().isResource()) {
     3.9  			filter.appendNull();
    3.10  			nullLabel = true;
    3.11  		}
    3.12 @@ -847,7 +847,7 @@
    3.13  		boolean check2 = false;
    3.14  		if(expr.getArg() instanceof GeneralDBLabelColumn)
    3.15  		{
    3.16 -			if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource())
    3.17 +			if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar() == null || ((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource())
    3.18  			{
    3.19  				check2 = true;
    3.20  			}
    3.21 @@ -892,7 +892,7 @@
    3.22  					{
    3.23  						//Reached the innermost left var -> need to capture its SRID
    3.24  						String alias;
    3.25 -						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.26 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.27  							//Predicates used in triple patterns non-existent in db
    3.28  							alias="NULL";
    3.29  						}
    3.30 @@ -1197,7 +1197,7 @@
    3.31  
    3.32  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
    3.33  		boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
    3.34 -
    3.35 +	
    3.36  		if(check1)
    3.37  		{
    3.38  			this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
    3.39 @@ -1229,7 +1229,7 @@
    3.40  					if(tmp instanceof GeneralDBLabelColumn)
    3.41  					{
    3.42  						String alias;
    3.43 -						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.44 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null ||  ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.45  							//Predicates used in triple patterns non-existent in db
    3.46  							alias="NULL";
    3.47  						}
    3.48 @@ -1377,7 +1377,7 @@
    3.49  					{
    3.50  						//Reached the innermost left var -> need to capture its SRID
    3.51  						String alias;
    3.52 -						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.53 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.54  							//Predicates used in triple patterns non-existent in db
    3.55  							alias="NULL";
    3.56  						}
    3.57 @@ -1495,7 +1495,7 @@
    3.58  					{
    3.59  						//Reached the innermost left var -> need to capture its SRID
    3.60  						String alias;
    3.61 -						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.62 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.63  							//Predicates used in triple patterns non-existent in db
    3.64  							alias="NULL";
    3.65  						}
    3.66 @@ -1891,7 +1891,7 @@
    3.67  					{
    3.68  						//Reached the innermost left var -> need to capture its SRID
    3.69  						String alias;
    3.70 -						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.71 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.72  							//Predicates used in triple patterns non-existent in db
    3.73  							alias="NULL";
    3.74  						}
    3.75 @@ -2098,7 +2098,7 @@
    3.76  		boolean check2 = false;
    3.77  		if(expr.getArg() instanceof GeneralDBLabelColumn)
    3.78  		{
    3.79 -			if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource())
    3.80 +			if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar() ==null || ((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource())
    3.81  			{
    3.82  				check2 = true;
    3.83  			}
    3.84 @@ -2143,7 +2143,7 @@
    3.85  					{
    3.86  						//Reached the innermost left var -> need to capture its SRID
    3.87  						String alias;
    3.88 -						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.89 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar() == null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    3.90  							//Predicates used in triple patterns non-existent in db
    3.91  							alias="NULL";
    3.92  						}