Strabon

changeset 1298:83c25ed69f94

#46 Now strdf:intersection works as aggregate even without a group by
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Wed Nov 27 22:17:05 2013 +0200 (2013-11-27)
parents bff210fdab24
children 0998e91f6fa5
files generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/AggregateOptimizer.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/AggregateOptimizer.java	Wed Nov 27 22:09:09 2013 +0200
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/AggregateOptimizer.java	Wed Nov 27 22:17:05 2013 +0200
     1.3 @@ -20,6 +20,7 @@
     1.4  import org.openrdf.query.algebra.evaluation.function.Function;
     1.5  import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
     1.6  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.aggregate.ExtentFunc;
     1.7 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.IntersectionFunc;
     1.8  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.UnionFunc;
     1.9  import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase;
    1.10  /**
    1.11 @@ -64,15 +65,17 @@
    1.12  		if(expr instanceof FunctionCall)
    1.13  		{
    1.14  			Function function = FunctionRegistry.getInstance().get(((FunctionCall) expr).getURI());
    1.15 -			if((!(function instanceof UnionFunc) || !(((FunctionCall) expr).getArgs().size()==1))&&!(function instanceof ExtentFunc))
    1.16 +			if((!(function instanceof UnionFunc) || !(((FunctionCall) expr).getArgs().size()==1))
    1.17 +					&& (!(function instanceof IntersectionFunc) || !(((FunctionCall) expr).getArgs().size()==1))
    1.18 +					&&!(function instanceof ExtentFunc))
    1.19  			{
    1.20  				//Recursively check arguments
    1.21 -				boolean unionPresent = false;
    1.22 +				boolean aggregatePresent = false;
    1.23  				for(int i = 0 ; i< ((FunctionCall) expr).getArgs().size(); i++)
    1.24  				{
    1.25 -					unionPresent = unionPresent || aggregateInQuery(((FunctionCall) expr).getArgs().get(i));
    1.26 +					aggregatePresent = aggregatePresent || aggregateInQuery(((FunctionCall) expr).getArgs().get(i));
    1.27  				}
    1.28 -				return unionPresent;
    1.29 +				return aggregatePresent;
    1.30  			}
    1.31  			else
    1.32  				return true;