Strabon

changeset 24:e8f9e1b518b4

Fixed issues that occurred with newest version of Sesame. Query Tree created differed slightly.
Copied these changes from TELEIOS-M18 version.
author Manos Karpathiotakis <mk@di.uoa.gr>
date Fri Feb 24 15:58:11 2012 +0200 (2012-02-24)
parents e46020b5867f
children 47efa6a1ae1e
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/iterator/StSPARQLGroupIterator.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/iterator/StSPARQLGroupIterator.java	Thu Feb 23 17:57:17 2012 +0200
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/iterator/StSPARQLGroupIterator.java	Fri Feb 24 15:58:11 2012 +0200
     1.3 @@ -92,21 +92,21 @@
     1.4  	 *--------------*/
     1.5  
     1.6  	public StSPARQLGroupIterator(EvaluationStrategy strategy, Group group, BindingSet parentBindings)
     1.7 -	throws QueryEvaluationException
     1.8 -	{
     1.9 +			throws QueryEvaluationException
    1.10 +			{
    1.11  		this.strategy = strategy;
    1.12  		this.group = group;
    1.13  		this.parentBindings = parentBindings;
    1.14  		super.setIterator(createIterator());
    1.15 -	}
    1.16 +			}
    1.17  
    1.18  	/*---------*
    1.19  	 * Methods *
    1.20  	 *---------*/
    1.21  
    1.22  	private Iterator<BindingSet> createIterator()
    1.23 -	throws QueryEvaluationException
    1.24 -	{
    1.25 +			throws QueryEvaluationException
    1.26 +			{
    1.27  		Collection<Entry> entries = buildEntries();
    1.28  		Collection<BindingSet> bindingSets = new LinkedList<BindingSet>();
    1.29  
    1.30 @@ -139,11 +139,11 @@
    1.31  		}
    1.32  
    1.33  		return bindingSets.iterator();
    1.34 -	}
    1.35 +			}
    1.36  
    1.37  	private Collection<Entry> buildEntries()
    1.38 -	throws QueryEvaluationException
    1.39 -	{
    1.40 +			throws QueryEvaluationException
    1.41 +			{
    1.42  		CloseableIteration<BindingSet, QueryEvaluationException> iter;
    1.43  		iter = strategy.evaluate(group.getArg(), parentBindings);
    1.44  
    1.45 @@ -181,7 +181,7 @@
    1.46  			iter.close();
    1.47  		}
    1.48  
    1.49 -	}
    1.50 +			}
    1.51  
    1.52  	/**
    1.53  	 * A unique key for a set of existing bindings.
    1.54 @@ -242,8 +242,8 @@
    1.55  		private Map<FunctionCall, Geometry> spatialAggregatesResult;
    1.56  
    1.57  		public Entry(BindingSet prototype)
    1.58 -		throws ValueExprEvaluationException, QueryEvaluationException
    1.59 -		{
    1.60 +				throws ValueExprEvaluationException, QueryEvaluationException
    1.61 +				{
    1.62  			this.prototype = prototype;
    1.63  			this.aggregates = new LinkedHashMap<String, Aggregate>();
    1.64  			this.spatialAggregates = new LinkedHashMap<String, FunctionCall>();
    1.65 @@ -284,15 +284,15 @@
    1.66  					}
    1.67  				}
    1.68  			}
    1.69 -		}
    1.70 +				}
    1.71  
    1.72  		public BindingSet getPrototype() {
    1.73  			return prototype;
    1.74  		}
    1.75  
    1.76  		public void addSolution(BindingSet bindingSet)
    1.77 -		throws QueryEvaluationException
    1.78 -		{
    1.79 +				throws QueryEvaluationException
    1.80 +				{
    1.81  			for (Aggregate aggregate : aggregates.values()) {
    1.82  				aggregate.processAggregate(bindingSet);
    1.83  			}
    1.84 @@ -300,11 +300,11 @@
    1.85  				processSpatialAggregate(spatialAggregate, bindingSet);
    1.86  				//spatialAggregates.processAggregate(bindingSet);
    1.87  			}
    1.88 -		}
    1.89 +				}
    1.90  
    1.91  		public void bindSolution(QueryBindingSet sol)
    1.92 -		throws QueryEvaluationException
    1.93 -		{
    1.94 +				throws QueryEvaluationException
    1.95 +				{
    1.96  			for (String name : aggregates.keySet()) {
    1.97  				try {
    1.98  					Value value = aggregates.get(name).getValue();
    1.99 @@ -361,7 +361,7 @@
   1.100  
   1.101  
   1.102  
   1.103 -		}
   1.104 +				}
   1.105  
   1.106  		/**
   1.107  		 * XXX addition
   1.108 @@ -386,7 +386,7 @@
   1.109  				StrabonPolyhedron rightArg = null;
   1.110  
   1.111  				Function function = FunctionRegistry.getInstance().get(((FunctionCall) expr).getURI());
   1.112 -				
   1.113 +
   1.114  				if(function instanceof UnionFunc)
   1.115  				{
   1.116  					if(((FunctionCall) expr).getArgs().size()==1)
   1.117 @@ -398,7 +398,7 @@
   1.118  					{
   1.119  						leftArg = (StrabonPolyhedron) evaluateConstruct(((FunctionCall) expr).getArgs().get(0),prototype);
   1.120  						rightArg = (StrabonPolyhedron) evaluateConstruct(((FunctionCall) expr).getArgs().get(1),prototype);
   1.121 -						
   1.122 +
   1.123  						int leftSRID = leftArg.getGeometry().getSRID();
   1.124  						int rightSRID = rightArg.getGeometry().getSRID();
   1.125  						if(leftSRID != rightSRID)
   1.126 @@ -587,7 +587,7 @@
   1.127  					Geometry aggr = this.spatialAggregatesResult.get(expr);
   1.128  					if(aggr==null)
   1.129  					{
   1.130 -						
   1.131 +
   1.132  						if(function instanceof UnionFunc)
   1.133  						{
   1.134  							this.spatialAggregatesResult.put((FunctionCall) expr, poly.getGeometry());
   1.135 @@ -693,8 +693,8 @@
   1.136  		//		}
   1.137  
   1.138  		private Aggregate create(AggregateOperator operator)
   1.139 -		throws ValueExprEvaluationException, QueryEvaluationException
   1.140 -		{
   1.141 +				throws ValueExprEvaluationException, QueryEvaluationException
   1.142 +				{
   1.143  			if (operator instanceof Count) {
   1.144  				return new CountAggregate((Count)operator);
   1.145  			}
   1.146 @@ -717,7 +717,7 @@
   1.147  				return new ConcatAggregate((GroupConcat)operator);
   1.148  			}
   1.149  			return null;
   1.150 -		}
   1.151 +				}
   1.152  	}
   1.153  
   1.154  	private abstract class Aggregate {
   1.155 @@ -737,10 +737,10 @@
   1.156  		}
   1.157  
   1.158  		public abstract Value getValue()
   1.159 -		throws ValueExprEvaluationException;
   1.160 +				throws ValueExprEvaluationException;
   1.161  
   1.162  		public abstract void processAggregate(BindingSet bindingSet)
   1.163 -		throws QueryEvaluationException;
   1.164 +				throws QueryEvaluationException;
   1.165  
   1.166  		protected boolean distinct(Value value) {
   1.167  			return distinct == null || distinct.add(value);
   1.168 @@ -751,15 +751,15 @@
   1.169  		}
   1.170  
   1.171  		protected Value evaluate(BindingSet s)
   1.172 -		throws QueryEvaluationException
   1.173 -		{
   1.174 +				throws QueryEvaluationException
   1.175 +				{
   1.176  			try {
   1.177  				return strategy.evaluate(getArg(), s);
   1.178  			}
   1.179  			catch (ValueExprEvaluationException e) {
   1.180  				return null; // treat missing or invalid expressions as null
   1.181  			}
   1.182 -		}
   1.183 +				}
   1.184  	}
   1.185  
   1.186  	private class CountAggregate extends Aggregate {
   1.187 @@ -772,8 +772,8 @@
   1.188  
   1.189  		@Override
   1.190  		public void processAggregate(BindingSet s)
   1.191 -		throws QueryEvaluationException
   1.192 -		{
   1.193 +				throws QueryEvaluationException
   1.194 +				{
   1.195  			if (getArg() != null) {
   1.196  				Value value = evaluate(s);
   1.197  				if (value != null && distinct(value)) {
   1.198 @@ -783,7 +783,7 @@
   1.199  			else {
   1.200  				count++;
   1.201  			}
   1.202 -		}
   1.203 +				}
   1.204  
   1.205  		@Override
   1.206  		public Value getValue() {
   1.207 @@ -803,8 +803,8 @@
   1.208  
   1.209  		@Override
   1.210  		public void processAggregate(BindingSet s)
   1.211 -		throws QueryEvaluationException
   1.212 -		{
   1.213 +				throws QueryEvaluationException
   1.214 +				{
   1.215  			Value v = evaluate(s);
   1.216  			if (distinct(v)) {
   1.217  				if (min == null) {
   1.218 @@ -814,7 +814,7 @@
   1.219  					min = v;
   1.220  				}
   1.221  			}
   1.222 -		}
   1.223 +				}
   1.224  
   1.225  		@Override
   1.226  		public Value getValue() {
   1.227 @@ -834,8 +834,8 @@
   1.228  
   1.229  		@Override
   1.230  		public void processAggregate(BindingSet s)
   1.231 -		throws QueryEvaluationException
   1.232 -		{
   1.233 +				throws QueryEvaluationException
   1.234 +				{
   1.235  			Value v = evaluate(s);
   1.236  			if (distinct(v)) {
   1.237  				if (max == null) {
   1.238 @@ -845,7 +845,7 @@
   1.239  					max = v;
   1.240  				}
   1.241  			}
   1.242 -		}
   1.243 +				}
   1.244  
   1.245  		@Override
   1.246  		public Value getValue() {
   1.247 @@ -865,8 +865,8 @@
   1.248  
   1.249  		@Override
   1.250  		public void processAggregate(BindingSet s)
   1.251 -		throws QueryEvaluationException
   1.252 -		{
   1.253 +				throws QueryEvaluationException
   1.254 +				{
   1.255  			if (typeError != null) {
   1.256  				// halt further processing if a type error has been raised
   1.257  				return;
   1.258 @@ -889,18 +889,18 @@
   1.259  					typeError = new ValueExprEvaluationException("not a number: " + v);
   1.260  				}
   1.261  			}
   1.262 -		}
   1.263 +				}
   1.264  
   1.265  		@Override
   1.266  		public Value getValue()
   1.267 -		throws ValueExprEvaluationException
   1.268 -		{
   1.269 +				throws ValueExprEvaluationException
   1.270 +				{
   1.271  			if (typeError != null) {
   1.272  				throw typeError;
   1.273  			}
   1.274  
   1.275  			return sum;
   1.276 -		}
   1.277 +				}
   1.278  	}
   1.279  
   1.280  	private class AvgAggregate extends Aggregate {
   1.281 @@ -917,8 +917,8 @@
   1.282  
   1.283  		@Override
   1.284  		public void processAggregate(BindingSet s)
   1.285 -		throws QueryEvaluationException
   1.286 -		{
   1.287 +				throws QueryEvaluationException
   1.288 +				{
   1.289  			if (typeError != null) {
   1.290  				// Prevent calculating the aggregate further if a type error has
   1.291  				// occured.
   1.292 @@ -946,12 +946,12 @@
   1.293  					typeError = new ValueExprEvaluationException("not a number: " + v);
   1.294  				}
   1.295  			}
   1.296 -		}
   1.297 +				}
   1.298  
   1.299  		@Override
   1.300  		public Value getValue()
   1.301 -		throws ValueExprEvaluationException
   1.302 -		{
   1.303 +				throws ValueExprEvaluationException
   1.304 +				{
   1.305  			if (typeError != null) {
   1.306  				// a type error occurred while processing the aggregate, throw it
   1.307  				// now.
   1.308 @@ -964,7 +964,7 @@
   1.309  
   1.310  			Literal sizeLit = vf.createLiteral(count);
   1.311  			return MathUtil.compute(sum, sizeLit, MathOp.DIVIDE);
   1.312 -		}
   1.313 +				}
   1.314  	}
   1.315  
   1.316  	private class SampleAggregate extends Aggregate {
   1.317 @@ -977,12 +977,12 @@
   1.318  
   1.319  		@Override
   1.320  		public void processAggregate(BindingSet s)
   1.321 -		throws QueryEvaluationException
   1.322 -		{
   1.323 +				throws QueryEvaluationException
   1.324 +				{
   1.325  			if (sample == null) {
   1.326  				sample = evaluate(s);
   1.327  			}
   1.328 -		}
   1.329 +				}
   1.330  
   1.331  		@Override
   1.332  		public Value getValue() {
   1.333 @@ -997,26 +997,26 @@
   1.334  		private String separator = " ";
   1.335  
   1.336  		public ConcatAggregate(GroupConcat groupConcatOp)
   1.337 -		throws ValueExprEvaluationException, QueryEvaluationException
   1.338 -		{
   1.339 +				throws ValueExprEvaluationException, QueryEvaluationException
   1.340 +				{
   1.341  			super(groupConcatOp);
   1.342  			ValueExpr separatorExpr = groupConcatOp.getSeparator();
   1.343  			if (separatorExpr != null) {
   1.344  				Value separatorValue = strategy.evaluate(separatorExpr, parentBindings);
   1.345  				separator = separatorValue.stringValue();
   1.346  			}
   1.347 -		}
   1.348 +				}
   1.349  
   1.350  		@Override
   1.351  		public void processAggregate(BindingSet s)
   1.352 -		throws QueryEvaluationException
   1.353 -		{
   1.354 +				throws QueryEvaluationException
   1.355 +				{
   1.356  			Value v = evaluate(s);
   1.357  			if (v != null && distinct(v)) {
   1.358  				concatenated.append(v.stringValue());
   1.359  				concatenated.append(separator);
   1.360  			}
   1.361 -		}
   1.362 +				}
   1.363  
   1.364  		@Override
   1.365  		public Value getValue() {
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Thu Feb 23 17:57:17 2012 +0200
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Fri Feb 24 15:58:11 2012 +0200
     2.3 @@ -198,6 +198,12 @@
     2.4  	public Value evaluate(Var var, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException
     2.5  	{
     2.6  		boolean groupBy = false;
     2.7 +//		//Case met when ORDER BY involved (?)
     2.8 +//		if(var.getName().startsWith("-mbbVar-"))
     2.9 +//		{
    2.10 +//			var.setName(var.getName().replace("-mbbVar-",""));
    2.11 +//		}
    2.12 +		
    2.13  		//Case met when evaluating a construct function inside an aggregate 
    2.14  		if(var.getName().endsWith("?spatial"))
    2.15  		{
    2.16 @@ -751,7 +757,7 @@
    2.17  			//					var = reference;
    2.18  			//				}
    2.19  			//			}
    2.20 -			String name = ((GeneralDBLongLabelColumn) expr).getVarName();
    2.21 +			String name = ((GeneralDBLongLabelColumn) expr).getVarName().replace("?spatial","");
    2.22  
    2.23  			for(GeneralDBColumnVar reference: allKnown)
    2.24  			{
    2.25 @@ -765,7 +771,7 @@
    2.26  		}
    2.27  		else if(expr instanceof GeneralDBLabelColumn)//ColumnVar at least
    2.28  		{
    2.29 -			String name = ((GeneralDBLabelColumn) expr).getVarName();
    2.30 +			String name = ((GeneralDBLabelColumn) expr).getVarName().replace("?spatial","");;
    2.31  
    2.32  			for(GeneralDBColumnVar reference: allKnown)
    2.33  			{
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java	Thu Feb 23 17:57:17 2012 +0200
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java	Fri Feb 24 15:58:11 2012 +0200
     3.3 @@ -1173,7 +1173,7 @@
     3.4  	throws RuntimeException
     3.5  	{
     3.6  		int mbbCounter = 0;
     3.7 -		super.meet(node);
     3.8 +//		super.meet(node);
     3.9  		if (!(node.getArg() instanceof GeneralDBSelectQuery))
    3.10  			//In other words, I have encountered having/groupby
    3.11  		{
    3.12 @@ -1196,13 +1196,24 @@
    3.13  							//XXX volatile - using an extra arg to 'hang' the name I need
    3.14  							fc.addArg(new Var("-mbb-"+originalName));
    3.15  							ExtensionElem extElem = new ExtensionElem(fc,"-mbb-"+originalName);
    3.16 -							if(node.getParentNode() instanceof Projection)
    3.17 +							if(node.getArg() instanceof Extension)
    3.18  							{
    3.19  								Extension ext = new Extension();
    3.20  								ext.addElement(extElem);
    3.21 -								((Projection)(node.getParentNode())).setArg(ext);
    3.22 -								ext.setArg(node);
    3.23 +//								((Projection)(node.getParentNode())).setArg(ext);
    3.24 +//								ext.setArg(node);
    3.25 +								Extension tmpExt = (Extension) node.getArg();
    3.26 +								node.setArg(ext);
    3.27 +								ext.setArg(tmpExt);
    3.28 +								
    3.29  							}
    3.30 +//							else if(node.getParentNode() instanceof Projection)
    3.31 +//							{
    3.32 +//								Extension ext = new Extension();
    3.33 +//								ext.addElement(extElem);
    3.34 +//								((Projection)(node.getParentNode())).setArg(ext);
    3.35 +//								ext.setArg(node);
    3.36 +//							}
    3.37  							else if(node.getParentNode() instanceof Extension)
    3.38  							{
    3.39  								((Extension)node.getParentNode()).addElement(extElem);
    3.40 @@ -1220,13 +1231,23 @@
    3.41  
    3.42  					fc.addArg(new Var("-mbb-"+(++mbbCounter)));
    3.43  					ExtensionElem extElem = new ExtensionElem(fc,"-mbb-"+(mbbCounter));
    3.44 -					if(node.getParentNode() instanceof Projection)
    3.45 +					if(node.getArg() instanceof Extension)
    3.46  					{
    3.47  						Extension ext = new Extension();
    3.48  						ext.addElement(extElem);
    3.49 -						((Projection)(node.getParentNode())).setArg(ext);
    3.50 -						ext.setArg(node);
    3.51 +//						((Projection)(node.getParentNode())).setArg(ext);
    3.52 +//						ext.setArg(node);
    3.53 +						Extension tmpExt = (Extension) node.getArg();
    3.54 +						node.setArg(ext);
    3.55 +						ext.setArg(tmpExt);
    3.56  					}
    3.57 +//					else if(node.getParentNode() instanceof Projection)
    3.58 +//					{
    3.59 +//						Extension ext = new Extension();
    3.60 +//						ext.addElement(extElem);
    3.61 +//						((Projection)(node.getParentNode())).setArg(ext);
    3.62 +//						ext.setArg(node);
    3.63 +//					}
    3.64  					else if(node.getParentNode() instanceof Extension)
    3.65  					{
    3.66  						((Extension)node.getParentNode()).addElement(extElem);
    3.67 @@ -1235,8 +1256,10 @@
    3.68  				}
    3.69  
    3.70  			}
    3.71 +			super.meet(node);
    3.72  			return;
    3.73  		}
    3.74 +		super.meet(node);
    3.75  		GeneralDBSelectQuery query = (GeneralDBSelectQuery)node.getArg();
    3.76  		try {
    3.77  			for (OrderElem e : node.getElements()) {
     4.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Thu Feb 23 17:57:17 2012 +0200
     4.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri Feb 24 15:58:11 2012 +0200
     4.3 @@ -180,16 +180,16 @@
     4.4  
     4.5  	@Override
     4.6  	protected void append(GeneralDBSqlIsNull expr, GeneralDBSqlExprBuilder filter)
     4.7 -	throws UnsupportedRdbmsOperatorException
     4.8 -	{
     4.9 +			throws UnsupportedRdbmsOperatorException
    4.10 +			{
    4.11  		dispatch(expr.getArg(), filter);
    4.12  		filter.isNull();
    4.13 -	}
    4.14 +			}
    4.15  
    4.16  	@Override
    4.17  	protected void append(GeneralDBSqlNot expr, GeneralDBSqlExprBuilder filter)
    4.18 -	throws UnsupportedRdbmsOperatorException
    4.19 -	{
    4.20 +			throws UnsupportedRdbmsOperatorException
    4.21 +			{
    4.22  		if (expr.getArg() instanceof GeneralDBSqlIsNull) {
    4.23  			GeneralDBSqlIsNull arg = (GeneralDBSqlIsNull)expr.getArg();
    4.24  			dispatch(arg.getArg(), filter);
    4.25 @@ -200,7 +200,7 @@
    4.26  			dispatch(expr.getArg(), (GeneralDBSqlExprBuilder) open);
    4.27  			open.close();
    4.28  		}
    4.29 -	}
    4.30 +			}
    4.31  
    4.32  	@Override
    4.33  	protected void append(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) {
    4.34 @@ -238,16 +238,16 @@
    4.35  
    4.36  	@Override
    4.37  	protected void append(GeneralDBSqlAnd expr, GeneralDBSqlExprBuilder filter)
    4.38 -	throws UnsupportedRdbmsOperatorException
    4.39 -	{
    4.40 +			throws UnsupportedRdbmsOperatorException
    4.41 +			{
    4.42  		dispatch(expr.getLeftArg(), filter);
    4.43  		filter.and();
    4.44  		dispatch(expr.getRightArg(), filter);
    4.45 -	}
    4.46 +			}
    4.47  
    4.48  	protected GeneralDBSqlJoinBuilder subJoinAndFilter(GeneralDBSqlJoinBuilder query, GeneralDBFromItem from)
    4.49 -	throws RdbmsException, UnsupportedRdbmsOperatorException
    4.50 -	{
    4.51 +			throws RdbmsException, UnsupportedRdbmsOperatorException
    4.52 +			{
    4.53  		if (from instanceof GeneralDBUnionItem) {
    4.54  			GeneralDBUnionItem union = (GeneralDBUnionItem)from;
    4.55  			List<String> names = union.getSelectVarNames();
    4.56 @@ -279,13 +279,13 @@
    4.57  			dispatch(expr, query.on().and());
    4.58  		}
    4.59  		return query;
    4.60 -	}
    4.61 +			}
    4.62  
    4.63  	//FIXME my addition from here on
    4.64  	@Override
    4.65  	public GeneralDBQueryBuilder construct(GeneralDBSqlExpr expr)
    4.66 -	throws UnsupportedRdbmsOperatorException
    4.67 -	{
    4.68 +			throws UnsupportedRdbmsOperatorException
    4.69 +			{
    4.70  		if(!(expr instanceof GeneralDBSqlSpatialMetricBinary) 
    4.71  				&&!(expr instanceof GeneralDBSqlSpatialMetricUnary)
    4.72  				&&!(expr instanceof GeneralDBSqlMathExpr)
    4.73 @@ -306,372 +306,372 @@
    4.74  			dispatchUnarySqlOperator((UnaryGeneralDBOperator) expr, query.select);
    4.75  		}
    4.76  		return this;
    4.77 -	}
    4.78 +			}
    4.79  
    4.80  	//Spatial Relationship Functions
    4.81  	@Override
    4.82  	protected void append(GeneralDBSqlAnyInteract expr, GeneralDBSqlExprBuilder filter)
    4.83 -	throws UnsupportedRdbmsOperatorException
    4.84 -	{
    4.85 +			throws UnsupportedRdbmsOperatorException
    4.86 +			{
    4.87  		appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.anyInteract);
    4.88 -	}
    4.89 +			}
    4.90  
    4.91  	@Override
    4.92  	protected void append(GeneralDBSqlContains expr, GeneralDBSqlExprBuilder filter)
    4.93 -	throws UnsupportedRdbmsOperatorException {
    4.94 +			throws UnsupportedRdbmsOperatorException {
    4.95  
    4.96  		appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.contains);
    4.97  	}
    4.98  
    4.99  	@Override
   4.100  	protected void append(GeneralDBSqlEqualsSpatial expr, GeneralDBSqlExprBuilder filter)
   4.101 -	throws UnsupportedRdbmsOperatorException {
   4.102 +			throws UnsupportedRdbmsOperatorException {
   4.103  
   4.104  		appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.equals);
   4.105  	}
   4.106  
   4.107  	@Override
   4.108  	protected void append(GeneralDBSqlInside expr, GeneralDBSqlExprBuilder filter)
   4.109 -	throws UnsupportedRdbmsOperatorException {
   4.110 +			throws UnsupportedRdbmsOperatorException {
   4.111  
   4.112  		appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.inside);
   4.113  	}
   4.114  
   4.115  	@Override
   4.116  	protected void append(GeneralDBSqlCovers expr, GeneralDBSqlExprBuilder filter)
   4.117 -	throws UnsupportedRdbmsOperatorException {
   4.118 +			throws UnsupportedRdbmsOperatorException {
   4.119  
   4.120  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Covers);
   4.121  	}
   4.122  
   4.123  	@Override
   4.124  	protected void append(GeneralDBSqlCoveredBy expr, GeneralDBSqlExprBuilder filter)
   4.125 -	throws UnsupportedRdbmsOperatorException {
   4.126 +			throws UnsupportedRdbmsOperatorException {
   4.127  
   4.128  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_CoveredBy);
   4.129  	}
   4.130  
   4.131  	@Override
   4.132  	protected void append(GeneralDBSqlTouch expr, GeneralDBSqlExprBuilder filter)
   4.133 -	throws UnsupportedRdbmsOperatorException {
   4.134 +			throws UnsupportedRdbmsOperatorException {
   4.135  
   4.136  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Touches);
   4.137  	}
   4.138  
   4.139  	@Override
   4.140  	protected void append(GeneralDBSqlOverlap expr, GeneralDBSqlExprBuilder filter)
   4.141 -	throws UnsupportedRdbmsOperatorException {
   4.142 +			throws UnsupportedRdbmsOperatorException {
   4.143  
   4.144  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Overlaps);
   4.145  	}
   4.146  
   4.147  	@Override
   4.148  	protected void append(GeneralDBSqlDisjoint expr, GeneralDBSqlExprBuilder filter)
   4.149 -	throws UnsupportedRdbmsOperatorException {
   4.150 +			throws UnsupportedRdbmsOperatorException {
   4.151  
   4.152  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Disjoint);
   4.153  	}
   4.154  
   4.155  	@Override
   4.156  	protected void append(GeneralDBSqlRelate expr, GeneralDBSqlExprBuilder filter)
   4.157 -	throws UnsupportedRdbmsOperatorException
   4.158 -	{
   4.159 +			throws UnsupportedRdbmsOperatorException
   4.160 +			{
   4.161  		appendGeneralDBSpatialFunctionTriple(expr, filter, SpatialFunctionsPostGIS.ST_Relate);
   4.162 -	}
   4.163 +			}
   4.164  
   4.165  	@Override	
   4.166  	protected void append(GeneralDBSqlLeft expr, GeneralDBSqlExprBuilder filter)
   4.167 -	throws UnsupportedRdbmsOperatorException
   4.168 -	{
   4.169 +			throws UnsupportedRdbmsOperatorException
   4.170 +			{
   4.171  		appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.left);
   4.172 -	}
   4.173 +			}
   4.174  
   4.175  	@Override
   4.176  	protected void append(GeneralDBSqlRight expr, GeneralDBSqlExprBuilder filter)
   4.177 -	throws UnsupportedRdbmsOperatorException
   4.178 -	{
   4.179 +			throws UnsupportedRdbmsOperatorException
   4.180 +			{
   4.181  		appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.right);
   4.182 -	}
   4.183 +			}
   4.184  
   4.185  	@Override
   4.186  	protected void append(GeneralDBSqlAbove expr, GeneralDBSqlExprBuilder filter)
   4.187 -	throws UnsupportedRdbmsOperatorException
   4.188 -	{
   4.189 +			throws UnsupportedRdbmsOperatorException
   4.190 +			{
   4.191  		appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.above);
   4.192 -	}
   4.193 +			}
   4.194  
   4.195  	@Override
   4.196  	protected void append(GeneralDBSqlBelow expr, GeneralDBSqlExprBuilder filter)
   4.197 -	throws UnsupportedRdbmsOperatorException
   4.198 -	{
   4.199 +			throws UnsupportedRdbmsOperatorException
   4.200 +			{
   4.201  		appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.below);
   4.202 -	}
   4.203 +			}
   4.204  
   4.205  	//GeoSPARQL - Spatial Relationship Functions 
   4.206  	//Simple Features
   4.207  	@Override
   4.208  	protected void append(GeneralDBSqlSF_Contains expr, GeneralDBSqlExprBuilder filter)
   4.209 -	throws UnsupportedRdbmsOperatorException
   4.210 -	{
   4.211 +			throws UnsupportedRdbmsOperatorException
   4.212 +			{
   4.213  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Contains);
   4.214 -	}
   4.215 +			}
   4.216  
   4.217  	@Override
   4.218  	protected void append(GeneralDBSqlSF_Crosses expr, GeneralDBSqlExprBuilder filter)
   4.219 -	throws UnsupportedRdbmsOperatorException
   4.220 -	{
   4.221 +			throws UnsupportedRdbmsOperatorException
   4.222 +			{
   4.223  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Crosses);
   4.224 -	}
   4.225 +			}
   4.226  
   4.227  	@Override
   4.228  	protected void append(GeneralDBSqlSF_Disjoint expr, GeneralDBSqlExprBuilder filter)
   4.229 -	throws UnsupportedRdbmsOperatorException
   4.230 -	{
   4.231 +			throws UnsupportedRdbmsOperatorException
   4.232 +			{
   4.233  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Disjoint);
   4.234 -	}
   4.235 +			}
   4.236  
   4.237  	@Override
   4.238  	protected void append(GeneralDBSqlSF_Equals expr, GeneralDBSqlExprBuilder filter)
   4.239 -	throws UnsupportedRdbmsOperatorException
   4.240 -	{
   4.241 +			throws UnsupportedRdbmsOperatorException
   4.242 +			{
   4.243  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Equals);
   4.244 -	}
   4.245 +			}
   4.246  
   4.247  	@Override
   4.248  	protected void append(GeneralDBSqlSF_Intersects expr, GeneralDBSqlExprBuilder filter)
   4.249 -	throws UnsupportedRdbmsOperatorException
   4.250 -	{
   4.251 +			throws UnsupportedRdbmsOperatorException
   4.252 +			{
   4.253  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Intersects);
   4.254 -	}
   4.255 +			}
   4.256  
   4.257  	@Override
   4.258  	protected void append(GeneralDBSqlSF_Overlaps expr, GeneralDBSqlExprBuilder filter)
   4.259 -	throws UnsupportedRdbmsOperatorException
   4.260 -	{
   4.261 +			throws UnsupportedRdbmsOperatorException
   4.262 +			{
   4.263  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Overlaps);
   4.264 -	}
   4.265 +			}
   4.266  
   4.267  	@Override
   4.268  	protected void append(GeneralDBSqlSF_Touches expr, GeneralDBSqlExprBuilder filter)
   4.269 -	throws UnsupportedRdbmsOperatorException
   4.270 -	{
   4.271 +			throws UnsupportedRdbmsOperatorException
   4.272 +			{
   4.273  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Touches);
   4.274 -	}
   4.275 +			}
   4.276  
   4.277  	@Override
   4.278  	protected void append(GeneralDBSqlSF_Within expr, GeneralDBSqlExprBuilder filter)
   4.279 -	throws UnsupportedRdbmsOperatorException
   4.280 -	{
   4.281 +			throws UnsupportedRdbmsOperatorException
   4.282 +			{
   4.283  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Within);
   4.284 -	}
   4.285 +			}
   4.286  
   4.287  	//Egenhofer
   4.288  	@Override
   4.289  	protected void append(GeneralDBSqlEgenhofer_CoveredBy expr, GeneralDBSqlExprBuilder filter)
   4.290 -	throws UnsupportedRdbmsOperatorException
   4.291 -	{
   4.292 +			throws UnsupportedRdbmsOperatorException
   4.293 +			{
   4.294  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_CoveredBy);
   4.295 -	}
   4.296 +			}
   4.297  
   4.298  	@Override
   4.299  	protected void append(GeneralDBSqlEgenhofer_Covers expr, GeneralDBSqlExprBuilder filter)
   4.300 -	throws UnsupportedRdbmsOperatorException
   4.301 -	{
   4.302 +			throws UnsupportedRdbmsOperatorException
   4.303 +			{
   4.304  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Covers);
   4.305 -	}
   4.306 +			}
   4.307  
   4.308  	@Override
   4.309  	protected void append(GeneralDBSqlEgenhofer_Contains expr, GeneralDBSqlExprBuilder filter)
   4.310 -	throws UnsupportedRdbmsOperatorException
   4.311 -	{
   4.312 +			throws UnsupportedRdbmsOperatorException
   4.313 +			{
   4.314  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Contains);
   4.315 -	}
   4.316 +			}
   4.317  
   4.318  	@Override
   4.319  	protected void append(GeneralDBSqlEgenhofer_Disjoint expr, GeneralDBSqlExprBuilder filter)
   4.320 -	throws UnsupportedRdbmsOperatorException
   4.321 -	{
   4.322 +			throws UnsupportedRdbmsOperatorException
   4.323 +			{
   4.324  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Disjoint);
   4.325 -	}
   4.326 +			}
   4.327  
   4.328  	@Override
   4.329  	protected void append(GeneralDBSqlEgenhofer_Equals expr, GeneralDBSqlExprBuilder filter)
   4.330 -	throws UnsupportedRdbmsOperatorException
   4.331 -	{
   4.332 +			throws UnsupportedRdbmsOperatorException
   4.333 +			{
   4.334  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Equals);
   4.335 -	}
   4.336 +			}
   4.337  
   4.338  	@Override
   4.339  	protected void append(GeneralDBSqlEgenhofer_Inside expr, GeneralDBSqlExprBuilder filter)
   4.340 -	throws UnsupportedRdbmsOperatorException
   4.341 -	{
   4.342 +			throws UnsupportedRdbmsOperatorException
   4.343 +			{
   4.344  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Inside);
   4.345 -	}
   4.346 +			}
   4.347  
   4.348  	@Override
   4.349  	protected void append(GeneralDBSqlEgenhofer_Meet expr, GeneralDBSqlExprBuilder filter)
   4.350 -	throws UnsupportedRdbmsOperatorException
   4.351 -	{
   4.352 +			throws UnsupportedRdbmsOperatorException
   4.353 +			{
   4.354  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Meet);
   4.355 -	}
   4.356 +			}
   4.357  
   4.358  	@Override
   4.359  	protected void append(GeneralDBSqlEgenhofer_Overlap expr, GeneralDBSqlExprBuilder filter)
   4.360 -	throws UnsupportedRdbmsOperatorException
   4.361 -	{
   4.362 +			throws UnsupportedRdbmsOperatorException
   4.363 +			{
   4.364  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Overlap);
   4.365 -	}
   4.366 +			}
   4.367  
   4.368  	//RCC8
   4.369  	@Override
   4.370  	protected void append(GeneralDBSqlRCC8_Dc expr, GeneralDBSqlExprBuilder filter)
   4.371 -	throws UnsupportedRdbmsOperatorException
   4.372 -	{
   4.373 +			throws UnsupportedRdbmsOperatorException
   4.374 +			{
   4.375  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Dc);
   4.376 -	}
   4.377 +			}
   4.378  
   4.379  	@Override
   4.380  	protected void append(GeneralDBSqlRCC8_Eq expr, GeneralDBSqlExprBuilder filter)
   4.381 -	throws UnsupportedRdbmsOperatorException
   4.382 -	{
   4.383 +			throws UnsupportedRdbmsOperatorException
   4.384 +			{
   4.385  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Eq);
   4.386 -	}
   4.387 +			}
   4.388  
   4.389  	@Override
   4.390  	protected void append(GeneralDBSqlRCC8_Ec expr, GeneralDBSqlExprBuilder filter)
   4.391 -	throws UnsupportedRdbmsOperatorException
   4.392 -	{
   4.393 +			throws UnsupportedRdbmsOperatorException
   4.394 +			{
   4.395  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ec);
   4.396 -	}
   4.397 +			}
   4.398  
   4.399  	@Override
   4.400  	protected void append(GeneralDBSqlRCC8_Po expr, GeneralDBSqlExprBuilder filter)
   4.401 -	throws UnsupportedRdbmsOperatorException
   4.402 -	{
   4.403 +			throws UnsupportedRdbmsOperatorException
   4.404 +			{
   4.405  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Po);
   4.406 -	}
   4.407 +			}
   4.408  
   4.409  	@Override
   4.410  	protected void append(GeneralDBSqlRCC8_Tppi expr, GeneralDBSqlExprBuilder filter)
   4.411 -	throws UnsupportedRdbmsOperatorException
   4.412 -	{
   4.413 +			throws UnsupportedRdbmsOperatorException
   4.414 +			{
   4.415  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Tppi);
   4.416 -	}
   4.417 +			}
   4.418  
   4.419  	@Override
   4.420  	protected void append(GeneralDBSqlRCC8_Tpp expr, GeneralDBSqlExprBuilder filter)
   4.421 -	throws UnsupportedRdbmsOperatorException
   4.422 -	{
   4.423 +			throws UnsupportedRdbmsOperatorException
   4.424 +			{
   4.425  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Tpp);
   4.426 -	}
   4.427 +			}
   4.428  
   4.429  	@Override
   4.430  	protected void append(GeneralDBSqlRCC8_Ntpp expr, GeneralDBSqlExprBuilder filter)
   4.431 -	throws UnsupportedRdbmsOperatorException
   4.432 -	{
   4.433 +			throws UnsupportedRdbmsOperatorException
   4.434 +			{
   4.435  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ntpp);
   4.436 -	}
   4.437 +			}
   4.438  
   4.439  	@Override
   4.440  	protected void append(GeneralDBSqlRCC8_Ntppi expr, GeneralDBSqlExprBuilder filter)
   4.441 -	throws UnsupportedRdbmsOperatorException
   4.442 -	{
   4.443 +			throws UnsupportedRdbmsOperatorException
   4.444 +			{
   4.445  		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ntppi);
   4.446 -	}
   4.447 +			}
   4.448  
   4.449  	//Spatial Construct Functions
   4.450  	@Override
   4.451  	protected void append(GeneralDBSqlGeoUnion expr, GeneralDBSqlExprBuilder filter)
   4.452 -	throws UnsupportedRdbmsOperatorException
   4.453 -	{
   4.454 +			throws UnsupportedRdbmsOperatorException
   4.455 +			{
   4.456  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Union);
   4.457 -	}
   4.458 +			}
   4.459  
   4.460  	@Override
   4.461  	protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter)
   4.462 -	throws UnsupportedRdbmsOperatorException
   4.463 -	{
   4.464 +			throws UnsupportedRdbmsOperatorException
   4.465 +			{
   4.466  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Buffer);
   4.467 -	}
   4.468 +			}
   4.469  
   4.470  	@Override
   4.471  	protected void append(GeneralDBSqlGeoEnvelope expr, GeneralDBSqlExprBuilder filter)
   4.472 -	throws UnsupportedRdbmsOperatorException
   4.473 -	{
   4.474 +			throws UnsupportedRdbmsOperatorException
   4.475 +			{
   4.476  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Envelope);
   4.477 -	}
   4.478 +			}
   4.479  
   4.480  	@Override
   4.481  	protected void append(GeneralDBSqlGeoConvexHull expr, GeneralDBSqlExprBuilder filter)
   4.482 -	throws UnsupportedRdbmsOperatorException
   4.483 -	{
   4.484 +			throws UnsupportedRdbmsOperatorException
   4.485 +			{
   4.486  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_ConvexHull);
   4.487 -	}
   4.488 +			}
   4.489  
   4.490  	@Override
   4.491  	protected void append(GeneralDBSqlGeoBoundary expr, GeneralDBSqlExprBuilder filter)
   4.492 -	throws UnsupportedRdbmsOperatorException
   4.493 -	{
   4.494 +			throws UnsupportedRdbmsOperatorException
   4.495 +			{
   4.496  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Boundary);
   4.497 -	}
   4.498 +			}
   4.499  
   4.500  	@Override
   4.501  	protected void append(GeneralDBSqlGeoIntersection expr, GeneralDBSqlExprBuilder filter)
   4.502 -	throws UnsupportedRdbmsOperatorException
   4.503 -	{
   4.504 +			throws UnsupportedRdbmsOperatorException
   4.505 +			{
   4.506  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersection);
   4.507 -	}
   4.508 +			}
   4.509  
   4.510  	@Override
   4.511  	protected void append(GeneralDBSqlGeoDifference expr, GeneralDBSqlExprBuilder filter)
   4.512 -	throws UnsupportedRdbmsOperatorException
   4.513 -	{
   4.514 +			throws UnsupportedRdbmsOperatorException
   4.515 +			{
   4.516  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Difference);
   4.517 -	}
   4.518 +			}
   4.519  
   4.520  	@Override
   4.521  	protected void append(GeneralDBSqlGeoSymDifference expr, GeneralDBSqlExprBuilder filter)
   4.522 -	throws UnsupportedRdbmsOperatorException
   4.523 -	{
   4.524 +			throws UnsupportedRdbmsOperatorException
   4.525 +			{
   4.526  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_SymDifference);
   4.527 -	}
   4.528 +			}
   4.529  
   4.530  	//Spatial Metric Functions
   4.531  	@Override
   4.532  	protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter)
   4.533 -	throws UnsupportedRdbmsOperatorException
   4.534 -	{
   4.535 +			throws UnsupportedRdbmsOperatorException
   4.536 +			{
   4.537  		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Distance);
   4.538 -	}
   4.539 +			}
   4.540  
   4.541  	@Override
   4.542  	protected void append(GeneralDBSqlGeoArea expr, GeneralDBSqlExprBuilder filter)
   4.543 -	throws UnsupportedRdbmsOperatorException
   4.544 -	{
   4.545 +			throws UnsupportedRdbmsOperatorException
   4.546 +			{
   4.547  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Area);
   4.548 -	}
   4.549 +			}
   4.550  
   4.551  	//Spatial Property Functions
   4.552  	@Override
   4.553  	protected void append(GeneralDBSqlGeoDimension expr, GeneralDBSqlExprBuilder filter)
   4.554 -	throws UnsupportedRdbmsOperatorException
   4.555 -	{
   4.556 +			throws UnsupportedRdbmsOperatorException
   4.557 +			{
   4.558  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Dimension);
   4.559 -	}
   4.560 +			}
   4.561  
   4.562  	@Override
   4.563  	protected void append(GeneralDBSqlGeoGeometryType expr, GeneralDBSqlExprBuilder filter)
   4.564 -	throws UnsupportedRdbmsOperatorException
   4.565 -	{
   4.566 +			throws UnsupportedRdbmsOperatorException
   4.567 +			{
   4.568  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_GeometryType);
   4.569 -	}
   4.570 +			}
   4.571  
   4.572  	@Override
   4.573  	protected void append(GeneralDBSqlGeoAsText expr, GeneralDBSqlExprBuilder filter)
   4.574 -	throws UnsupportedRdbmsOperatorException
   4.575 -	{
   4.576 +			throws UnsupportedRdbmsOperatorException
   4.577 +			{
   4.578  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_AsText);
   4.579 -	}
   4.580 +			}
   4.581  
   4.582  	//	@Override
   4.583  	//	protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter)
   4.584 @@ -686,8 +686,9 @@
   4.585  	 */
   4.586  	@Override
   4.587  	protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter)
   4.588 -	throws UnsupportedRdbmsOperatorException
   4.589 -	{
   4.590 +			throws UnsupportedRdbmsOperatorException
   4.591 +			{
   4.592 +		boolean sridNeeded = true;
   4.593  		filter.openBracket();
   4.594  
   4.595  		boolean check1 = expr.getArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
   4.596 @@ -717,16 +718,22 @@
   4.597  				String sridExpr;
   4.598  				while(true)
   4.599  				{
   4.600 -					GeneralDBSqlExpr child;
   4.601 +					GeneralDBSqlExpr child = null;
   4.602  
   4.603  					if(tmp instanceof BinaryGeneralDBOperator)
   4.604  					{
   4.605  						child = ((BinaryGeneralDBOperator) tmp).getLeftArg();
   4.606  					}
   4.607 -					else //(tmp instanceof UnaryGeneralDBOperator)
   4.608 +					else if(tmp instanceof UnaryGeneralDBOperator)
   4.609  					{
   4.610  						child = ((UnaryGeneralDBOperator) tmp).getArg();
   4.611  					}
   4.612 +					else if(tmp instanceof GeneralDBStringValue)
   4.613 +					{
   4.614 +						//Constant!!
   4.615 +						sridNeeded  = false;
   4.616 +						break;
   4.617 +					}
   4.618  
   4.619  					tmp = child;
   4.620  					if(tmp instanceof GeneralDBLabelColumn)
   4.621 @@ -740,10 +747,18 @@
   4.622  						return;
   4.623  						//break;
   4.624  					}
   4.625 +					else if(tmp instanceof GeneralDBStringValue)
   4.626 +					{
   4.627 +						//Constant!!
   4.628 +						sridNeeded  = false;
   4.629 +						break;
   4.630 +					}
   4.631  
   4.632  				}
   4.633  			}
   4.634  
   4.635 +			if(sridNeeded)
   4.636 +			{
   4.637  			filter.appendFunction("ST_SRID");
   4.638  			filter.openBracket();
   4.639  			if(expr.getArg() instanceof GeneralDBStringValue)
   4.640 @@ -769,24 +784,30 @@
   4.641  			}
   4.642  
   4.643  			filter.closeBracket();
   4.644 +			}
   4.645 +			else
   4.646 +			{
   4.647 +				//4326 by default - Software House additions
   4.648 +				filter.append("4326");
   4.649 +			}
   4.650  		}
   4.651  
   4.652  		filter.closeBracket();
   4.653 -	}
   4.654 +			}
   4.655  
   4.656  	@Override
   4.657  	protected void append(GeneralDBSqlGeoIsSimple expr, GeneralDBSqlExprBuilder filter)
   4.658 -	throws UnsupportedRdbmsOperatorException
   4.659 -	{
   4.660 +			throws UnsupportedRdbmsOperatorException
   4.661 +			{
   4.662  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_IsSimple);
   4.663 -	}
   4.664 +			}
   4.665  
   4.666  	@Override
   4.667  	protected void append(GeneralDBSqlGeoIsEmpty expr, GeneralDBSqlExprBuilder filter)
   4.668 -	throws UnsupportedRdbmsOperatorException
   4.669 -	{
   4.670 +			throws UnsupportedRdbmsOperatorException
   4.671 +			{
   4.672  		appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_IsEmpty);
   4.673 -	}
   4.674 +			}
   4.675  
   4.676  
   4.677  	/**
   4.678 @@ -987,8 +1008,8 @@
   4.679  	//	
   4.680  	//Used in all the generaldb stsparql boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 
   4.681  	protected void appendGeneralDBSpatialFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func)
   4.682 -	throws UnsupportedRdbmsOperatorException
   4.683 -	{
   4.684 +			throws UnsupportedRdbmsOperatorException
   4.685 +			{
   4.686  		filter.openBracket();
   4.687  
   4.688  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
   4.689 @@ -1030,7 +1051,7 @@
   4.690  						String alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
   4.691  						alias=alias+".srid";
   4.692  						sridExpr = alias;
   4.693 -//						((GeneralDBSqlSpatialConstructBinary)expr).setSrid(alias);
   4.694 +						//						((GeneralDBSqlSpatialConstructBinary)expr).setSrid(alias);
   4.695  						break;
   4.696  					}
   4.697  
   4.698 @@ -1139,12 +1160,14 @@
   4.699  		}
   4.700  		//}
   4.701  		filter.closeBracket();
   4.702 -	}
   4.703 +			}
   4.704  
   4.705  	//Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1) 
   4.706  	protected void appendGeneralDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func)
   4.707 -	throws UnsupportedRdbmsOperatorException
   4.708 -	{
   4.709 +			throws UnsupportedRdbmsOperatorException
   4.710 +			{
   4.711 +		//In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))")
   4.712 +		boolean sridNeeded = true;
   4.713  		filter.openBracket();
   4.714  
   4.715  		boolean check1 = expr.getArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
   4.716 @@ -1170,20 +1193,27 @@
   4.717  			//XXX Incorporating SRID
   4.718  			String sridExpr = null;
   4.719  			GeneralDBSqlExpr tmp = expr;
   4.720 +
   4.721 +
   4.722  			if(tmp instanceof GeneralDBSqlSpatialConstructUnary && tmp.getParentNode() == null)
   4.723  			{
   4.724  				while(true)
   4.725  				{
   4.726 -					GeneralDBSqlExpr child;
   4.727 +					GeneralDBSqlExpr child = null;
   4.728  
   4.729  					if(tmp instanceof BinaryGeneralDBOperator)
   4.730  					{
   4.731  						child = ((BinaryGeneralDBOperator) tmp).getLeftArg();
   4.732  					}
   4.733 -					else //(tmp instanceof UnaryGeneralDBOperator)
   4.734 +					else if(tmp instanceof UnaryGeneralDBOperator)
   4.735  					{
   4.736  						child = ((UnaryGeneralDBOperator) tmp).getArg();
   4.737  					}
   4.738 +					else if(tmp instanceof GeneralDBStringValue)
   4.739 +					{
   4.740 +						sridNeeded  = false;
   4.741 +						break;
   4.742 +					}
   4.743  
   4.744  					tmp = child;
   4.745  					if(tmp instanceof GeneralDBLabelColumn)
   4.746 @@ -1191,14 +1221,22 @@
   4.747  						//Reached the innermost left var -> need to capture its SRID
   4.748  						String alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
   4.749  						alias=alias+".srid";
   4.750 -//						((GeneralDBSqlSpatialConstructUnary)expr).setSrid(alias);
   4.751 +						//((GeneralDBSqlSpatialConstructUnary)expr).setSrid(alias);
   4.752  						sridExpr = alias;
   4.753  						break;
   4.754  					}
   4.755 +					else if (tmp instanceof GeneralDBStringValue) //Constant!!
   4.756 +					{
   4.757 +						sridNeeded  = false;
   4.758 +						break;
   4.759 +					}
   4.760  
   4.761  				}
   4.762 -				filter.appendFunction("ST_Transform");
   4.763 -				filter.openBracket();
   4.764 +				if(sridNeeded)
   4.765 +				{
   4.766 +					filter.appendFunction("ST_Transform");
   4.767 +					filter.openBracket();
   4.768 +				}
   4.769  			}
   4.770  			/////
   4.771  
   4.772 @@ -1240,25 +1278,29 @@
   4.773  
   4.774  			filter.closeBracket();
   4.775  			//SRID Support
   4.776 -			if(expr instanceof GeneralDBSqlSpatialConstructUnary && expr.getParentNode() == null)
   4.777 +			if(sridNeeded)
   4.778  			{
   4.779 -				filter.appendComma();
   4.780 -//				filter.append(((GeneralDBSqlSpatialConstructUnary)expr).getSrid());
   4.781 -				filter.append(sridExpr);
   4.782 -				filter.closeBracket();
   4.783 +				if(expr instanceof GeneralDBSqlSpatialConstructUnary && expr.getParentNode() == null)
   4.784 +				{
   4.785 +					filter.appendComma();
   4.786 +					//				filter.append(((GeneralDBSqlSpatialConstructUnary)expr).getSrid());
   4.787 +					filter.append(sridExpr);
   4.788 +					filter.closeBracket();
   4.789 +				}
   4.790  			}
   4.791  			///
   4.792  		}
   4.793  
   4.794  		filter.closeBracket();
   4.795 -	}
   4.796 +
   4.797 +			}
   4.798  
   4.799  
   4.800  
   4.801  	//Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 
   4.802  	protected void appendGeneralDBSpatialFunctionTriple(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func)
   4.803 -	throws UnsupportedRdbmsOperatorException
   4.804 -	{
   4.805 +			throws UnsupportedRdbmsOperatorException
   4.806 +			{
   4.807  		filter.openBracket();
   4.808  
   4.809  		boolean check1a = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
   4.810 @@ -1390,14 +1432,14 @@
   4.811  		}
   4.812  
   4.813  		filter.closeBracket();
   4.814 -	}
   4.815 +			}
   4.816  
   4.817  
   4.818  	//GeoSPARQL
   4.819  	//XXX
   4.820  	protected void appendRelate(BinaryGeneralDBOperator expr, PostGISSqlExprBuilder filter, char[] intersectionPattern)
   4.821 -	throws UnsupportedRdbmsOperatorException
   4.822 -	{
   4.823 +			throws UnsupportedRdbmsOperatorException
   4.824 +			{
   4.825  		filter.openBracket();
   4.826  
   4.827  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.GeneralDBSqlNull");
   4.828 @@ -1507,12 +1549,12 @@
   4.829  		}
   4.830  
   4.831  		filter.closeBracket();
   4.832 -	}
   4.833 +			}
   4.834  
   4.835  
   4.836  	protected void appendgeoSPARQLSpatialRelation(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func)
   4.837 -	throws UnsupportedRdbmsOperatorException
   4.838 -	{
   4.839 +			throws UnsupportedRdbmsOperatorException
   4.840 +			{
   4.841  		filter.openBracket();
   4.842  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.GeneralDBSqlNull");
   4.843  		if(check1)
   4.844 @@ -1851,15 +1893,15 @@
   4.845  			//			filter.closeBracket();
   4.846  		}
   4.847  		filter.closeBracket();
   4.848 -	}
   4.849 +			}
   4.850  
   4.851  	@Override
   4.852  	//GeoSPARQL
   4.853  	//XXX
   4.854  
   4.855  	protected void appendRelate(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, char[] intersectionPattern)
   4.856 -	throws UnsupportedRdbmsOperatorException
   4.857 -	{
   4.858 +			throws UnsupportedRdbmsOperatorException
   4.859 +			{
   4.860  		filter.openBracket();
   4.861  
   4.862  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.GeneralDBSqlNull");
   4.863 @@ -1963,5 +2005,5 @@
   4.864  		}
   4.865  
   4.866  		filter.closeBracket();
   4.867 -	}
   4.868 +			}
   4.869  }