jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [4/4] jena git commit: JENA-973 : Implement different tests for syntax and algebra equality.
Date Wed, 24 Jun 2015 20:40:43 GMT
JENA-973 : Implement different tests for syntax and algebra equality.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/a51455e2
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/a51455e2
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/a51455e2

Branch: refs/heads/master
Commit: a51455e2b0f416d100dd6444e1df88ad97fda257
Parents: 4c4d21d
Author: Andy Seaborne <andy@apache.org>
Authored: Wed Jun 24 21:40:28 2015 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Wed Jun 24 21:40:28 2015 +0100

----------------------------------------------------------------------
 .../org/apache/jena/sparql/expr/E_Exists.java   | 42 ++++++-----
 .../apache/jena/sparql/expr/E_NotExists.java    | 14 ++--
 .../java/org/apache/jena/sparql/expr/Expr.java  | 33 +++++++++
 .../apache/jena/sparql/expr/ExprAggregator.java |  5 +-
 .../apache/jena/sparql/expr/ExprFunction.java   | 16 ++---
 .../apache/jena/sparql/expr/ExprFunctionOp.java |  1 +
 .../org/apache/jena/sparql/expr/ExprList.java   | 14 +++-
 .../org/apache/jena/sparql/expr/ExprNode.java   | 75 +++++++++++---------
 .../org/apache/jena/sparql/expr/ExprVar.java    |  5 +-
 .../org/apache/jena/sparql/expr/NodeValue.java  |  7 +-
 .../jena/sparql/expr/aggregate/AggAvg.java      |  6 +-
 .../sparql/expr/aggregate/AggAvgDistinct.java   |  6 +-
 .../jena/sparql/expr/aggregate/AggCount.java    |  4 +-
 .../sparql/expr/aggregate/AggCountDistinct.java |  4 +-
 .../jena/sparql/expr/aggregate/AggCountVar.java |  6 +-
 .../expr/aggregate/AggCountVarDistinct.java     |  6 +-
 .../jena/sparql/expr/aggregate/AggCustom.java   | 18 ++---
 .../sparql/expr/aggregate/AggGroupConcat.java   |  7 +-
 .../expr/aggregate/AggGroupConcatDistinct.java  |  7 +-
 .../jena/sparql/expr/aggregate/AggMax.java      |  8 +--
 .../sparql/expr/aggregate/AggMaxDistinct.java   |  9 +--
 .../jena/sparql/expr/aggregate/AggMin.java      |  8 +--
 .../sparql/expr/aggregate/AggMinDistinct.java   |  8 +--
 .../jena/sparql/expr/aggregate/AggNull.java     |  4 +-
 .../jena/sparql/expr/aggregate/AggSample.java   |  8 +--
 .../expr/aggregate/AggSampleDistinct.java       |  8 +--
 .../jena/sparql/expr/aggregate/AggSum.java      |  6 +-
 .../sparql/expr/aggregate/AggSumDistinct.java   |  8 +--
 .../jena/sparql/expr/aggregate/Aggregator.java  |  3 +
 .../sparql/expr/aggregate/AggregatorBase.java   |  8 ++-
 .../jena/sparql/syntax/ElementFilter.java       |  2 +-
 31 files changed, 204 insertions(+), 152 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Exists.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Exists.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Exists.java
index c33839e..75e13f9 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Exists.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Exists.java
@@ -33,61 +33,59 @@ public class E_Exists extends ExprFunctionOp
 {
     private static final String symbol = Tags.tagExists ;
 
-    public E_Exists(Op op)
-    {
+    public E_Exists(Op op) {
         this(null, op) ;
     }
-    
-    public E_Exists(Element elt)
-    {
+
+    public E_Exists(Element elt) {
         this(elt, Algebra.compile(elt)) ;
     }
-    
-    public E_Exists(Element el, Op op)
-    {
+
+    public E_Exists(Element el, Op op) {
         super(symbol, el, op) ;
     }
 
     @Override
-    public Expr copySubstitute(Binding binding)
-    {
+    public Expr copySubstitute(Binding binding) {
         Op op2 = Substitute.substitute(getGraphPattern(), binding) ;
         return new E_Exists(getElement(), op2) ;
     }
 
     @Override
-    public Expr applyNodeTransform(NodeTransform nodeTransform)
-    {
+    public Expr applyNodeTransform(NodeTransform nodeTransform) {
         Op op2 = NodeTransformLib.transform(nodeTransform, getGraphPattern()) ;
         return new E_Exists(getElement(), op2) ;
     }
 
-    
     @Override
-    protected NodeValue eval(Binding binding, QueryIterator qIter, FunctionEnv env)
-    {
+    protected NodeValue eval(Binding binding, QueryIterator qIter, FunctionEnv env) {
         boolean b = qIter.hasNext() ;
         return NodeValue.booleanReturn(b) ;
     }
 
     @Override
-    public int hashCode()
-    {
+    public int hashCode() {
         return symbol.hashCode() ^ getGraphPattern().hashCode() ;
     }
-    
+
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Expr other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
-
         if ( ! ( other instanceof E_Exists ) )
             return false ;
         
         E_Exists ex = (E_Exists)other ;
-        return this.getGraphPattern().equals(ex.getGraphPattern()) ;
+        if ( bySyntax )
+            return this.getElement().equals(ex.getElement()) ;
+        else
+            return this.getGraphPattern().equals(ex.getGraphPattern()) ;
     }
     
     @Override
     public ExprFunctionOp copy(ExprList args, Op x) { return new E_Exists(x) ; }
+    
+    @Override
+    public ExprFunctionOp copy(ExprList args, Element elPattern) { return new E_Exists(elPattern) ; }
+
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_NotExists.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_NotExists.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_NotExists.java
index e236970..158a839 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_NotExists.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_NotExists.java
@@ -77,18 +77,22 @@ public class E_NotExists extends ExprFunctionOp
     }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Expr other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
-
         if ( ! ( other instanceof E_NotExists ) )
             return false ;
         
         E_NotExists ex = (E_NotExists)other ;
-        return this.getGraphPattern().equals(ex.getGraphPattern()) ;
+        if ( bySyntax )
+            return this.getElement().equals(ex.getElement()) ;
+        else
+            return this.getGraphPattern().equals(ex.getGraphPattern()) ;
     }
     
     @Override
     public ExprFunctionOp copy(ExprList args, Op x) { return new E_NotExists(x) ; }
-
+    
+    @Override
+    public ExprFunctionOp copy(ExprList args, Element elPattern) { return new E_NotExists(elPattern) ; }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/Expr.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/Expr.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/Expr.java
index 3358575..a1cde07 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/Expr.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/Expr.java
@@ -20,6 +20,7 @@ package org.apache.jena.sparql.expr;
 
 import java.util.Collection ;
 import java.util.Set ;
+
 import javax.xml.datatype.DatatypeConstants ;
 
 import org.apache.jena.sparql.core.Var ;
@@ -89,4 +90,36 @@ public interface Expr
     public ExprFunction getFunction() ;
     
     public void visit(ExprVisitor visitor) ;
+    
+    /**
+     * <code>Expr</code> are used in both syntax and algebra. There is no syntax
+     * to algebra translation step because the parser uses operator precedence
+     * to build the right evaluation structure directly.
+     * <p>
+     * The exceptions to this are the <code>NOT EXISTS</code> and
+     * <code>EXISTS</code> expressions which involve a query pattern. As a
+     * result there are different ways in syntax to produce the same algebra
+     * form.
+     * <p>
+     * Two <code>Expr</code> are considered equal if they are equal as algebra
+     * expressions. <code>hashCode</code> and <code>equals</code> must implement
+     * that.
+     * <p>
+     * There is also <code>equalsBySyntax</code>. Because two different syntax
+     * forms can yield the same algebra, but two different algebra forms
+     * must be different syntax, <code>equalsBySyntax</code> implies <code>equals</code>
+     * (by alegbra).
+     * <p>
+     * Hence, different <code>hashCode</code> => not <code>equalsBySyntax<code>.
+     */ 
+    @Override
+    public int hashCode() ;
+
+    @Override
+    public boolean equals(Object other) ;
+
+    public boolean equalsBySyntax(Expr other) ;
+    
+    /** General equality operation - consider this to be 'protected' */
+    public boolean equals(Expr other, boolean bySyntax) ;
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprAggregator.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprAggregator.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprAggregator.java
index ed79caf..7800220 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprAggregator.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprAggregator.java
@@ -19,6 +19,7 @@
 package org.apache.jena.sparql.expr;
 
 import java.util.Objects;
+
 import org.apache.jena.atlas.lib.Lib ;
 import org.apache.jena.atlas.logging.Log ;
 import org.apache.jena.graph.Node ;
@@ -72,8 +73,8 @@ public class ExprAggregator extends ExprNode
     }
     
     @Override
-    public boolean equals(Object other) 
-    {
+    public boolean equals(Expr other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof ExprAggregator ) )
             return false ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunction.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunction.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunction.java
index f568d89..442618a 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunction.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunction.java
@@ -20,7 +20,6 @@ package org.apache.jena.sparql.expr;
 
 import java.util.ArrayList ;
 import java.util.List ;
-import java.util.Objects;
 
 import org.apache.jena.sparql.serializer.SerializationContext ;
 
@@ -36,8 +35,7 @@ public abstract class ExprFunction extends ExprNode
     protected String opSign ;
     private List<Expr> argList = null ;
     
-    protected ExprFunction(String fName)
-    {
+    protected ExprFunction(String fName) {
         funcSymbol = new FunctionLabel(fName) ;
         opSign = null ;
     }
@@ -52,8 +50,7 @@ public abstract class ExprFunction extends ExprNode
     public abstract int numArgs() ;
 
     // ExprFunctionN overrides this.
-    public List<Expr> getArgs()
-    {
+    public List<Expr> getArgs() {
         if ( argList != null )
             return argList ; 
         argList = new ArrayList<>() ;
@@ -68,8 +65,7 @@ public abstract class ExprFunction extends ExprNode
     public ExprFunction getFunction()  { return this ; }
     
     @Override
-    public int hashCode()
-    {
+    public int hashCode() {
         return funcSymbol.hashCode() ^ numArgs() ;
     }
     
@@ -78,8 +74,8 @@ public abstract class ExprFunction extends ExprNode
     // + The arguments are the same (including arity).
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Expr other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
 
         if ( ! other.getClass().equals(this.getClass()) )
@@ -98,7 +94,7 @@ public abstract class ExprFunction extends ExprNode
         {
             Expr a1 = this.getArg(i) ;
             Expr a2 = ex.getArg(i) ;
-            if ( ! Objects.equals(a1, a2) )
+            if ( ! a1.equals(a2, bySyntax) )
                 return false ;
         }
         return true ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunctionOp.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunctionOp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunctionOp.java
index dd9e60a..3e8dee8 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunctionOp.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunctionOp.java
@@ -92,6 +92,7 @@ public abstract class ExprFunctionOp extends ExprFunction
     protected abstract NodeValue eval(Binding binding, QueryIterator iter, FunctionEnv env) ;
     
     public abstract ExprFunctionOp copy(ExprList args, Op x) ;
+    public abstract ExprFunctionOp copy(ExprList args, Element elPattern) ;
     @Override
     public void visit(ExprVisitor visitor) { visitor.visit(this) ; }
     public Expr apply(ExprTransform transform, ExprList args, Op x) { return transform.transform(this, args, x) ; }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprList.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprList.java
index 9e56851..59fcb3a 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprList.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprList.java
@@ -111,12 +111,24 @@ public class ExprList implements Iterable<Expr>
     @Override
     public int hashCode() { return expressions.hashCode() ; }
 
+    public boolean equals(ExprList other, boolean bySyntax) {
+        if ( this == other ) return true ;
+        for ( int i = 0 ; i < expressions.size() ; i++ ) {
+            Expr e1 = expressions.get(i) ;
+            Expr e2 = other.expressions.get(i) ;
+            if ( ! e1.equals(e2, bySyntax) ) 
+                return false ;
+        }
+        return true ;
+    }
+    
     @Override
     public boolean equals(Object other) {
         if ( this == other ) return true ;
         if ( ! ( other instanceof ExprList ) ) return false ;
         ExprList exprs = (ExprList)other ;
-        return expressions.equals(exprs.expressions) ;
+        //return expressions.equals(exprs.expressions) ;
+        return equals((ExprList)other, false) ;
     }
 
     public static ExprList splitConjunction(ExprList exprList1) {

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNode.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNode.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNode.java
index 9b8c45f..58aa19f 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNode.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNode.java
@@ -20,6 +20,7 @@ package org.apache.jena.sparql.expr;
 
 import java.util.Collection ;
 import java.util.Set ;
+
 import org.apache.jena.sparql.algebra.Op ;
 import org.apache.jena.sparql.core.Var ;
 import org.apache.jena.sparql.engine.binding.Binding ;
@@ -36,21 +37,19 @@ import org.apache.jena.sparql.util.ExprUtils ;
 public abstract class ExprNode implements Expr
 {
     @Override
-    public boolean isSatisfied(Binding binding, FunctionEnv funcEnv)
-    {
+    public boolean isSatisfied(Binding binding, FunctionEnv funcEnv) {
         try {
             NodeValue v = eval(binding, funcEnv) ;
             boolean b = XSDFuncOp.booleanEffectiveValue(v) ;
             return b ;
         }
-        catch (ExprEvalException ex)
-        { 
+        catch (ExprEvalException ex) { 
             return false ;
         }
     }
 
-    public boolean isExpr() { return true ; }
-    public final Expr getExpr()   { return this ; }
+    public boolean isExpr()     { return true ; }
+    public final Expr getExpr() { return this ; }
     
     // --- interface Constraint
     
@@ -58,63 +57,69 @@ public abstract class ExprNode implements Expr
     public abstract NodeValue eval(Binding binding, FunctionEnv env) ; 
     
     @Override
-    public Set<Var> getVarsMentioned() { return ExprVars.getVarsMentioned(this) ; }
+    public Set<Var> getVarsMentioned()                      { return ExprVars.getVarsMentioned(this) ; }
     @Override
-    public void varsMentioned(Collection<Var> acc) { ExprVars.varsMentioned(acc, this) ; }
+    public void varsMentioned(Collection<Var> acc)          { ExprVars.varsMentioned(acc, this) ; }
 
-    public Set<String> getVarNamesMentioned() { return ExprVars.getVarNamesMentioned(this) ; }
-    public void varNamesMentioned(Collection<String> acc) { ExprVars.varNamesMentioned(acc, this) ; }
+    public Set<String> getVarNamesMentioned()               { return ExprVars.getVarNamesMentioned(this) ; }
+    public void varNamesMentioned(Collection<String> acc)   { ExprVars.varNamesMentioned(acc, this) ; }
 
     @Override
-    public abstract int     hashCode() ;
+    public abstract int hashCode() ;
+    @Override
+    public final boolean equals(Object other) {
+        if ( other == null ) return false ;
+        if ( this == other ) return true ;
+        if ( ! ( other instanceof Expr ) ) return false ;
+        return equals((Expr)other, false) ;
+    }
+    
+    @Override
+    public final boolean equalsBySyntax(Expr other) {
+        if ( other == null ) return false ;
+        if ( this == other ) return true ;
+        return equals(other, true) ;
+    }
+    
     @Override
-    public abstract boolean equals(Object other) ;
+    public abstract boolean equals(Expr other, boolean bySyntax) ;
     
-    protected static NodeValue eval(Binding binding, FunctionEnv funcEnv, Expr expr)
-    {   
+    protected static NodeValue eval(Binding binding, FunctionEnv funcEnv, Expr expr) {   
         if ( expr == null ) return null ;
         return expr.eval(binding, funcEnv) ;
     }
     
     @Override
-    final public Expr deepCopy()                     
-    { return copySubstitute(null) ; }
+    final public Expr deepCopy()        { return copySubstitute(null) ; }
     
     @Override
     public abstract Expr copySubstitute(Binding binding) ;
     
     @Override
     public abstract Expr applyNodeTransform(NodeTransform transform) ;
-
         
     // ---- Default implementations
     @Override
-    public boolean isVariable()        { return false ; }
+    public boolean isVariable()         { return false ; }
     @Override
-    public String getVarName()         { return null ; } //throw new ExprException("Expr.getVarName called on non-variable") ; }
+    public String getVarName()          { return null ; } //throw new ExprException("Expr.getVarName called on non-variable") ; }
     @Override
-    public ExprVar getExprVar()        { return null ; } //throw new ExprException("Expr.getVar called on non-variable") ; }
+    public ExprVar getExprVar()         { return null ; } //throw new ExprException("Expr.getVar called on non-variable") ; }
     @Override
-    public Var asVar()                 { return null ; } //throw new ExprException("Expr.getVar called on non-variable") ; }
+    public Var asVar()                  { return null ; } //throw new ExprException("Expr.getVar called on non-variable") ; }
     
     @Override
-    public boolean isConstant()        { return false ; }
+    public boolean isConstant()         { return false ; }
     @Override
-    public NodeValue getConstant()     { return null ; } // throw new ExprException("Expr.getConstant called on non-constant") ; }
+    public NodeValue getConstant()      { return null ; } // throw new ExprException("Expr.getConstant called on non-constant") ; }
     
     @Override
-    public boolean isFunction()        { return false ; }
+    public boolean isFunction()         { return false ; }
     @Override
-    public ExprFunction getFunction()  { return null ; }
-    
-    public boolean isGraphPattern()    { return false ; }
-    public Op getGraphPattern()        { return null ; }
-    
-    // ---- 
-    
+    public ExprFunction getFunction()   { return null ; }
+
+    public boolean isGraphPattern()     { return false ; }
+    public Op getGraphPattern()         { return null ; }
     @Override
-    public String toString()
-    {
-        return ExprUtils.fmtSPARQL(this) ; 
-    }
+    public String toString()            { return ExprUtils.fmtSPARQL(this) ; } 
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprVar.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprVar.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprVar.java
index df07897..d2bcef8 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprVar.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprVar.java
@@ -101,10 +101,9 @@ public class ExprVar extends ExprNode
     public int hashCode() { return varNode.hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Expr other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
-
         if ( ! ( other instanceof ExprVar ) )
             return false ;
         ExprVar nvar = (ExprVar)other ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java
index 8cff836..0394bfd 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java
@@ -51,6 +51,7 @@ import java.util.Calendar ;
 import java.util.Iterator ;
 import java.util.Properties ;
 import java.util.ServiceLoader ;
+
 import javax.xml.datatype.DatatypeConfigurationException ;
 import javax.xml.datatype.DatatypeFactory ;
 import javax.xml.datatype.Duration ;
@@ -1228,10 +1229,10 @@ public abstract class NodeValue extends ExprNode
     }
     
     @Override
-    public boolean equals(Object other)
-    {
-        // This is the equality condition Jena uses - lang tags are different by case. 
+    public boolean equals(Expr other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
+        // This is the equality condition Jena uses - lang tags are different by case. 
 
         if ( ! ( other instanceof NodeValue ) )
             return false ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvg.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvg.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvg.java
index 6c52321..57c32c7 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvg.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvg.java
@@ -51,12 +51,12 @@ public class AggAvg extends AggregatorBase
     public int hashCode()   { return HC_AggAvg ^ getExprList().hashCode() ; }
 
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof AggAvg ) ) return false ;
         AggAvg a = (AggAvg)other ;
-        return exprList.equals(a.exprList) ;
+        return exprList.equals(a.exprList, bySyntax) ;
     }
     
     // ---- Accumulator

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvgDistinct.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvgDistinct.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvgDistinct.java
index 66afe6a..126f516 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvgDistinct.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggAvgDistinct.java
@@ -51,12 +51,12 @@ public class AggAvgDistinct extends AggregatorBase
     }
 
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof AggAvgDistinct ) ) return false ;
         AggAvgDistinct a = (AggAvgDistinct)other ;
-        return exprList.equals(a.exprList) ;
+        return exprList.equals(a.exprList, bySyntax) ;
     }
 
     

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCount.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCount.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCount.java
index 8bb87f4..4e59ac0 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCount.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCount.java
@@ -63,8 +63,8 @@ public class AggCount extends AggregatorBase
     public int hashCode()   { return HC_AggCount ; }
 
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof AggCount ) ) return false ;
         return true ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountDistinct.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountDistinct.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountDistinct.java
index 419f967..c145966 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountDistinct.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountDistinct.java
@@ -63,8 +63,8 @@ public class AggCountDistinct extends AggregatorBase
     public int hashCode()   { return HC_AggCountDistinct ; }
 
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof AggCountDistinct ) ) return false ;
         return true ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVar.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVar.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVar.java
index 8a69a71..50b2eff 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVar.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVar.java
@@ -43,13 +43,13 @@ public class AggCountVar extends AggregatorBase
     public int hashCode()   { return HC_AggCountVar ^ exprList.hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof AggCountVar ) )
             return false ;
         AggCountVar agg = (AggCountVar)other ;
-        return agg.getExpr().equals(getExpr()) ;
+        return agg.getExpr().equals(getExpr(), bySyntax) ;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVarDistinct.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVarDistinct.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVarDistinct.java
index 8f7b735..57df9be 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVarDistinct.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCountVarDistinct.java
@@ -46,13 +46,13 @@ public class AggCountVarDistinct extends AggregatorBase
     public int hashCode()   { return HC_AggCountVar ^ exprList.hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof AggCountVarDistinct ) )
             return false ;
         AggCountVarDistinct agg = (AggCountVarDistinct)other ;
-        return agg.getExpr().equals(getExpr()) ;
+        return agg.getExpr().equals(getExpr(), bySyntax) ;
     }
 
     // ---- Accumulator

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCustom.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCustom.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCustom.java
index db3c0f9..c8ff032 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCustom.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggCustom.java
@@ -127,24 +127,24 @@ public class AggCustom extends AggregatorBase
     }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ; 
         if ( this == other ) return true ;
         
         if ( ! AggregateRegistry.isRegistered(iri) ) {
             E_Function f1 = asFunction() ;
-            if ( other instanceof AggCustom )
-                other = ((AggCustom)other).asFunction() ;
-            return f1.equals(other) ;
+            if ( ! ( other instanceof AggCustom ) )
+                return false ;
+            E_Function f2 = ((AggCustom)other).asFunction() ;
+            return f1.equals(f2, bySyntax) ;
         }
         
         if ( ! ( other instanceof AggCustom ) )
             return false ;
         AggCustom agg = (AggCustom)other ;
-        return 
-        		Objects.equals(this.iri, agg.iri) &&
-            this.isDistinct == agg.isDistinct &&
-            	Objects.equals(this.getExprList(), agg.getExprList()) ;
+        return Objects.equals(this.iri, agg.iri) &&
+               this.isDistinct == agg.isDistinct &&
+               this.getExprList().equals(agg.getExprList(), bySyntax) ;
     } 
 
     public static Accumulator createAccNull() { return new  AccCustom() ; }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcat.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcat.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcat.java
index 700b18c..3371bfe 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcat.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcat.java
@@ -124,13 +124,14 @@ public class AggGroupConcat extends AggregatorBase
     public int hashCode()   { return HC_AggCountVar ^ exprList.hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof AggGroupConcat ) )
             return false ;
         AggGroupConcat agg = (AggGroupConcat)other ;
-        return Objects.equals(agg.getSeparator(),getSeparator()) && agg.getExpr().equals(getExpr()) ;
+        return Objects.equals(agg.getSeparator(), getSeparator()) &&
+               agg.getExpr().equals(getExpr(), bySyntax) ;
     }
 
     // ---- Accumulator

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcatDistinct.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcatDistinct.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcatDistinct.java
index ad3b422..3e20fcd 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcatDistinct.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggGroupConcatDistinct.java
@@ -75,13 +75,14 @@ public class AggGroupConcatDistinct extends AggregatorBase
     public int hashCode()   { return HC_AggCountVar ^ getExpr().hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ;
         if ( ! ( other instanceof AggGroupConcatDistinct ) )
             return false ;
         AggGroupConcatDistinct agg = (AggGroupConcatDistinct)other ;
-        return Objects.equals(agg.getSeparator(),getSeparator()) && agg.getExpr().equals(getExpr()) ;
+        return Objects.equals(agg.getSeparator(),getSeparator()) && 
+                agg.getExpr().equals(getExpr(), bySyntax) ;
     }
     
     // ---- Accumulator

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMax.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMax.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMax.java
index 539a1ab..ae6d7f3 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMax.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMax.java
@@ -18,8 +18,6 @@
 
 package org.apache.jena.sparql.expr.aggregate;
 
-import java.util.Objects;
-
 import org.apache.jena.sparql.expr.Expr ;
 import org.apache.jena.sparql.expr.ExprList ;
 
@@ -34,12 +32,12 @@ public class AggMax extends AggMaxBase
     public int hashCode()   { return HC_AggMax ^ getExpr().hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ; 
         if ( ! ( other instanceof AggMax ) )
             return false ;
         AggMax agg = (AggMax)other ;
-        return Objects.equals(exprList, agg.exprList) ;
+        return exprList.equals(agg.exprList, bySyntax) ;
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMaxDistinct.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMaxDistinct.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMaxDistinct.java
index c994c2c..d81a91a 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMaxDistinct.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMaxDistinct.java
@@ -18,8 +18,6 @@
 
 package org.apache.jena.sparql.expr.aggregate;
 
-import java.util.Objects;
-
 import org.apache.jena.sparql.expr.Expr ;
 import org.apache.jena.sparql.expr.ExprList ;
 
@@ -34,13 +32,12 @@ public class AggMaxDistinct extends AggMaxBase
     public int hashCode()   { return HC_AggMaxDistinct ^ getExpr().hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ; 
         if ( ! ( other instanceof AggMaxDistinct ) )
             return false ;
         AggMaxDistinct agg = (AggMaxDistinct)other ;
-        return Objects.equals(exprList, agg.exprList) ;
+        return exprList.equals(agg.exprList, bySyntax) ;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMin.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMin.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMin.java
index 79e634a..2eca2d8 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMin.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMin.java
@@ -18,8 +18,6 @@
 
 package org.apache.jena.sparql.expr.aggregate;
 
-import java.util.Objects;
-
 import org.apache.jena.sparql.expr.Expr ;
 import org.apache.jena.sparql.expr.ExprList ;
 
@@ -34,12 +32,12 @@ public class AggMin extends AggMinBase
     public int hashCode()   { return HC_AggMin ^ getExpr().hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ; 
         if ( ! ( other instanceof AggMin ) )
             return false ;
         AggMin agg = (AggMin)other ;
-        return Objects.equals(exprList, agg.exprList) ;
+        return exprList.equals(exprList, bySyntax) ;
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMinDistinct.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMinDistinct.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMinDistinct.java
index be774d7..cabb023 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMinDistinct.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggMinDistinct.java
@@ -32,10 +32,10 @@ public class AggMinDistinct extends AggMinBase
     @Override
     public int hashCode()   { return HC_AggMinDistinct ^ getExpr().hashCode() ; }
     
-   @Override
-    public boolean equals(Object other)
-    {
-       if ( this == other ) return true ; 
+    @Override
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
+        if ( this == other ) return true ; 
         if ( ! ( other instanceof AggMinDistinct ) )
             return false ;
         AggMinDistinct agg = (AggMinDistinct)other ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggNull.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggNull.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggNull.java
index df9f959..436660a 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggNull.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggNull.java
@@ -45,8 +45,8 @@ public class AggNull extends AggregatorBase
     @Override
     public int hashCode()   { return HC_AggNull ; }
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ; 
         return ( other instanceof AggNull ) ;
     } 

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSample.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSample.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSample.java
index c153af0..8dff9fe 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSample.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSample.java
@@ -18,8 +18,6 @@
 
 package org.apache.jena.sparql.expr.aggregate;
 
-import java.util.Objects;
-
 import org.apache.jena.graph.Node ;
 import org.apache.jena.sparql.engine.binding.Binding ;
 import org.apache.jena.sparql.expr.Expr ;
@@ -47,13 +45,13 @@ public class AggSample extends AggregatorBase
     @Override
     public int hashCode()   { return HC_AggSample ^ getExpr().hashCode() ; }
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ; 
         if ( ! ( other instanceof AggSample ) )
             return false ;
         AggSample agg = (AggSample)other ;
-        return Objects.equals(this.exprList, agg.exprList) ;
+        return this.exprList.equals(agg.exprList, bySyntax) ;
     } 
 
     // ---- Accumulator

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSampleDistinct.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSampleDistinct.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSampleDistinct.java
index 91d9a93..b830ff8 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSampleDistinct.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSampleDistinct.java
@@ -41,13 +41,13 @@ public class AggSampleDistinct extends AggregatorBase
     @Override
     public int hashCode()   { return HC_AggSample ^ getExpr().hashCode() ; }
     @Override
-    public boolean equals(Object other)
-    {
-        if ( this == other ) return true ; 
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
+        if ( this == other ) return true ;
         if ( ! ( other instanceof AggSampleDistinct ) )
             return false ;
         AggSampleDistinct agg = (AggSampleDistinct)other ;
-        return agg.getExpr().equals(getExpr()) ;
+        return this.exprList.equals(agg.exprList, bySyntax) ;
     } 
 
     @Override

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSum.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSum.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSum.java
index 50b501e..deb3e61 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSum.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSum.java
@@ -49,13 +49,13 @@ public class AggSum  extends AggregatorBase
     public int hashCode()   { return HC_AggSum ^ getExpr().hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ; 
         if ( ! ( other instanceof AggSum ) )
             return false ;
         AggSum agg = (AggSum)other ;
-        return agg.getExpr().equals(getExpr()) ;
+        return getExpr().equals(agg.getExpr(), bySyntax) ;
     } 
 
     // ---- Accumulator

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSumDistinct.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSumDistinct.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSumDistinct.java
index 335cf34..ca28de3 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSumDistinct.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggSumDistinct.java
@@ -46,15 +46,15 @@ public class AggSumDistinct  extends AggregatorBase
     public int hashCode()   { return HC_AggSumDistinct ^ getExpr().hashCode() ; }
     
     @Override
-    public boolean equals(Object other)
-    {
+    public boolean equals(Aggregator other, boolean bySyntax) {
+        if ( other == null ) return false ;
         if ( this == other ) return true ; 
         if ( ! ( other instanceof AggSumDistinct ) )
             return false ;
         AggSumDistinct agg = (AggSumDistinct)other ;
-        return agg.getExpr().equals(getExpr()) ;
+        return getExpr().equals(agg.getExpr(), bySyntax) ;
     } 
- 
+
     @Override
     public Node getValueEmpty()     { return NodeValue.toNode(noValuesToSum) ; } 
 

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/Aggregator.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/Aggregator.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/Aggregator.java
index a3d6a6f..0449913 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/Aggregator.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/Aggregator.java
@@ -53,6 +53,9 @@ public interface Aggregator
     @Override
     public boolean equals(Object other) ;
 
+    /** Consider this 'protected' */
+    public boolean equals(Aggregator other, boolean bySyntax) ;
+
     /** Format as an (extended) SPARQL expression */
     public String asSparqlExpr(SerializationContext sCxt) ;
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java
index 23c5ccd..d1cf07c 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java
@@ -21,6 +21,7 @@ package org.apache.jena.sparql.expr.aggregate;
 import java.util.HashMap ;
 import java.util.Locale ;
 import java.util.Map ;
+
 import org.apache.jena.atlas.io.IndentedLineBuffer ;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.sparql.ARQInternalErrorException ;
@@ -145,7 +146,12 @@ public abstract class AggregatorBase implements Aggregator
     public abstract int hashCode() ;
 
     @Override
-    public abstract boolean equals(Object other) ;
+    public final boolean equals(Object other) {
+        if ( other == null ) return false ;
+        if ( this == other ) return true ;
+        if ( ! ( other instanceof Aggregator ) ) return false ;
+        return equals((Aggregator)other, false) ;
+    }
     
     protected static final int HC_AggAvg                    =  0x170 ;
     protected static final int HC_AggAvgDistinct            =  0x171 ;

http://git-wip-us.apache.org/repos/asf/jena/blob/a51455e2/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementFilter.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementFilter.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementFilter.java
index f70690f..c4d7922 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementFilter.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementFilter.java
@@ -45,7 +45,7 @@ public class ElementFilter extends Element
         if ( ! ( el2 instanceof ElementFilter ) )
             return false ;
         ElementFilter f2 = (ElementFilter)el2 ;
-        if ( ! this.getExpr().equals(f2.getExpr()) )
+        if ( ! this.getExpr().equalsBySyntax(f2.getExpr()) )
             return false ;
         return true ;
     }


Mime
View raw message