Class Expression

java.lang.Object
org.rumbledb.expressions.Node
org.rumbledb.expressions.Expression
Direct Known Subclasses:
AdditiveExpression, AndExpression, AppendExpression, ArrayConstructorExpression, ArrayLookupExpression, ArrayUnboxingExpression, AttributeNodeContentExpression, AttributeNodeExpression, BlockExpression, BooleanLiteralExpression, CastableExpression, CastExpression, CommaExpression, CommentNodeConstructorExpression, ComparisonExpression, ComputedAttributeConstructorExpression, ComputedElementConstructorExpression, ComputedNamespaceConstructorExpression, ComputedPIConstructorExpression, ConditionalExpression, ContextItemExpression, CreateCollectionExpression, DecimalLiteralExpression, DeleteExpression, DeleteIndexFromCollectionExpression, DeleteSearchFromCollectionExpression, DirectCommentConstructorExpression, DirElemConstructorExpression, DirPIConstructorExpression, DocumentNodeConstructorExpression, DoubleLiteralExpression, DynamicFunctionCallExpression, EditCollectionExpression, FilterExpression, FlworExpression, FunctionCallExpression, InlineFunctionExpression, InsertExpression, InsertIndexIntoCollectionExpression, InsertSearchIntoCollectionExpression, InstanceOfExpression, IntegerLiteralExpression, IsStaticallyExpression, MapConstructorExpression, MultiplicativeExpression, NamedFunctionReferenceExpression, NodeComparisonExpression, NodeSetExpression, NotExpression, NullLiteralExpression, ObjectConstructorExpression, ObjectLookupExpression, OrExpression, PathRootExpression, PostfixLookupExpression, RangeExpression, RenameExpression, ReplaceExpression, SimpleMapExpression, SlashExpr, StatementsAndExpr, StatementsAndOptionalExpr, StepExpr, StringConcatExpression, StringConstructorExpression, StringLiteralExpression, SwitchExpression, TextNodeConstructorExpression, TextNodeExpression, TransformExpression, TreatExpression, TruncateCollectionExpression, TryCatchExpression, TypeSwitchExpression, UnaryExpression, UnaryLookupExpression, ValidateExpression, ValidateTypeExpression, VariableReferenceExpression

public abstract class Expression extends Node
An expression is the first-class citizen in JSONiq syntax. Any expression returns a sequence of items. Expressions form a tree, but this tree may contain other nodes, such as clauses and function declarations. An expression is associated with a static context containing information such as the in-scope variables. An expression has a classification, largely denoting it as UPDATING or SIMPLE.
  • Field Details

    • staticContext

      protected StaticContext staticContext
      Static context attached to this expression
    • staticSequenceType

      protected SequenceType staticSequenceType
      Statically inferred sequence type.
    • expressionClassification

      protected ExpressionClassification expressionClassification
      Expression Classification of the expression.
    • isSequential

      protected boolean isSequential
  • Constructor Details

  • Method Details

    • getStaticContextForRuntime

      public RuntimeStaticContext getStaticContextForRuntime(RumbleConfiguration conf, VisitorConfig visitorConfig)
    • alwaysReturnsAtMostOneItem

      public boolean alwaysReturnsAtMostOneItem()
      Tells whether this expression is guaranteed to return zero or one item but not more.
      Returns:
      true if yes, false otherwise.
    • isUpdating

      public boolean isUpdating()
      Tells whether this node is an updating expression or not.
      Returns:
      true if yes, false otherwise.
    • isUnset

      public boolean isUnset()
      Tells whether this node has an unset expression classification.
      Returns:
      true if yes, false otherwise.
    • setSequential

      public void setSequential(boolean isSequential)
      Sets the sequential property of the expression. An expression can only be one of the following:
      • non-updating sequential,
      • non-updating non-sequential,
      • updating non-sequential.
      Parameters:
      isSequential - a boolean value defining if the expression is sequential or not.
      Throws:
      InvalidExpressionClassification - if the expression is both updating and sequential.
    • setIsInSequentialBlock

      public void setIsInSequentialBlock(boolean isInSequentialBlock)
      Overrides:
      setIsInSequentialBlock in class Node
    • isUpdatingNonSequential

      public boolean isUpdatingNonSequential()
      Returns true if this node is updating and non-sequential.
      Returns:
      true if updating and non-sequential, false otherwise.
    • print

      public void print(StringBuilder buffer, int indent)
      Description copied from class: Node
      Prints the node tree to a string buffer.
      Overrides:
      print in class Node
      Parameters:
      buffer - a string buffer to write to
      indent - the current level of indentation