Class ExprVar

  • All Implemented Interfaces:
    Expr

    public class ExprVar
    extends ExprNode
    An expression that is a variable in an expression.
    • Constructor Detail

      • ExprVar

        public ExprVar​(java.lang.String name)
      • ExprVar

        public ExprVar​(Node n)
      • ExprVar

        public ExprVar​(Var v)
    • Method Detail

      • copy

        public Expr copy​(Var v)
      • format

        public void format​(Query query,
                           org.apache.jena.atlas.io.IndentedWriter out)
      • hashCode

        public int hashCode()
        Description copied from interface: Expr
        Expr 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.

        The exceptions to this are the NOT EXISTS and EXISTS expressions which involve a query pattern. As a result there are different ways in syntax to produce the same algebra form.

        Two Expr are considered equal if they are equal as algebra expressions. hashCode and equals must implement that.

        There is also equalsBySyntax. Because two different syntax forms can yield the same algebra, but two different algebra forms must be different syntax, equalsBySyntax implies equals (by alegbra).

        Hence, different hashCode => not equalsBySyntax.

        Specified by:
        hashCode in interface Expr
        Specified by:
        hashCode in class ExprNode
      • equals

        public boolean equals​(Expr other,
                              boolean bySyntax)
        Description copied from interface: Expr
        General equality operation - consider this to be 'protected'
        Specified by:
        equals in interface Expr
        Specified by:
        equals in class ExprNode
      • isVariable

        public boolean isVariable()
        Description copied from interface: Expr
        Answer whether this is a variable.
        Specified by:
        isVariable in interface Expr
        Overrides:
        isVariable in class ExprNode
      • getVarName

        public java.lang.String getVarName()
        Description copied from interface: Expr
        Variable name (returns null if not a variable)
        Specified by:
        getVarName in interface Expr
        Overrides:
        getVarName in class ExprNode
        Returns:
        Returns the name.
      • asVar

        public Var asVar()
        Description copied from interface: Expr
        Convert to a Var variable.
        Specified by:
        asVar in interface Expr
        Overrides:
        asVar in class ExprNode
      • getAsNode

        public Node getAsNode()
      • toPrefixString

        public java.lang.String toPrefixString()
      • asSparqlExpr

        public java.lang.String asSparqlExpr()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class ExprNode