Enum Class OperationType

java.lang.Object
java.lang.Enum<OperationType>
dev.roanh.gmark.ast.OperationType
All Implemented Interfaces:
Serializable, Comparable<OperationType>, Constable

public enum OperationType extends Enum<OperationType>
Enumeration of database operations. These are the individual operations that query languages are constructed with that can be executed directly by a database without having to further decompose the query. Every node in the AST of a query is associated with exactly one operation.

There are three types of operations based on the number of operands required:

  • Atom: These operations are leaf nodes in the query AST and thus take no input from other AST nodes, meaning they selected data directly from the database graph.
  • Unary: These are operations that only take a single input, thus the AST nodes for these operations have exactly one child node in the query AST that produces their input.
  • Binary: These are operations that take exactly two inputs, thus the AST nodes for these operations have exactly two child nodes in the query AST that produce their input.

It is worth noting that the result of each operation is a set of paths that are represented by their source and target vertices in the format (source, target).

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The concatenation or join operation is a binary operation that joins its two input graphs at shared vertices such that paths from the left input graph are extended with paths in the right input graph.
    The disjunction operation is a binary operation that computes the disjunction for its two input graphs such that paths are present in the output graph when that are present in either the left input graph or the right input graph.
    The edge, predicate, or label operation is an atom that executes directly on the database graph to select all the edges with a specific edge label.
    The identity operation is an atom that executes directly on the database graph to select all the vertices in the graph.
    The intersection or conjunction operation is a binary operation that intersects its two input graphs such that paths from the left input graph are only included in the output if they are also present in the right input graph.
    The Kleene or transitive closure operation is a unary operation that computes the transitive closure of its input graph.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The number of operands (inputs) required to execute this operation.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    OperationType(int operands)
    Constructs a new operation type with the given number of operands.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the arity of this operator, that is, the number of arguments or operands it takes.
    boolean
    Checks if this operation is an atom or leaf node of the query AST, meaning it cannot be decomposed any further and has no AST child nodes.
    boolean
    Check if this a binary operation, meaning it takes exactly two operands and has exactly two child nodes in the query AST.
    boolean
    Check if this a unary operation, meaning it takes exactly one operand and has exactly one child node in the query AST.
    Returns the enum constant of this class with the specified name.
    static OperationType[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • CONCATENATION

      public static final OperationType CONCATENATION
      The concatenation or join operation is a binary operation that joins its two input graphs at shared vertices such that paths from the left input graph are extended with paths in the right input graph.

      For example, if the left input graph contains the path from vertex v to vertex m denoted as (v, m), and the right input graph contains the path from vertex m to vertex u denoted as (m, u). Then one of the paths in the output result graph will be (v, u), the path from vertex v to vertex u.

    • INTERSECTION

      public static final OperationType INTERSECTION
      The intersection or conjunction operation is a binary operation that intersects its two input graphs such that paths from the left input graph are only included in the output if they are also present in the right input graph.

      For example, if the left input graph contains the paths (a, b) and (c, d) and the right input graph contains the paths (b, c) and (a, b), then the only path in the output is (a, b).

    • EDGE

      public static final OperationType EDGE
      The edge, predicate, or label operation is an atom that executes directly on the database graph to select all the edges with a specific edge label. Optionally edges can be selected in inverse direction, meaning the source and target vertices in the output paths are reversed.

      For example, if the database graph contains the path from vertex 1 to vertex 2 with label a and we select all edges with label a, then the output contains the path (1, 2). Similarly, if we select all edges with label a in inverse direction, then the output contains the path (2, 1).

    • IDENTITY

      public static final OperationType IDENTITY
      The identity operation is an atom that executes directly on the database graph to select all the vertices in the graph. Alternatively, one can think of this operation as selecting all length 0 paths from the database.

      For example, if the database graphs contains the nodes 1, 2, and 3, then the output graph will contain (1, 1), (2, 2), and (3, 3).

    • KLEENE

      public static final OperationType KLEENE
      The Kleene or transitive closure operation is a unary operation that computes the transitive closure of its input graph. Note that the transitive closure of a relation R is the smallest binary relation of set the set of all distinct source and target vertices in R that both contains R and is transitive.

      For example, if the input graph contains the paths (1, 2) and (2, 3), then the output graph contains (1, 2), (2, 3) and (1, 3)

    • DISJUNCTION

      public static final OperationType DISJUNCTION
      The disjunction operation is a binary operation that computes the disjunction for its two input graphs such that paths are present in the output graph when that are present in either the left input graph or the right input graph.

      For example, if the left input graph contains the path (a, b) and and the right input graph contains the path (b, c), then the output contains both (a, b) and (b, c).

  • Field Details

    • operands

      private final int operands
      The number of operands (inputs) required to execute this operation.
  • Constructor Details

    • OperationType

      private OperationType(int operands)
      Constructs a new operation type with the given number of operands.
      Parameters:
      operands - The number of operands required for this operation.
  • Method Details

    • values

      public static OperationType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static OperationType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isAtom

      public boolean isAtom()
      Checks if this operation is an atom or leaf node of the query AST, meaning it cannot be decomposed any further and has no AST child nodes. This in turn implies that the number of operands for the operation is 0 and that the operation executes directly on the database graph.
      Returns:
      True if this operation is atomic.
      See Also:
    • isUnary

      public boolean isUnary()
      Check if this a unary operation, meaning it takes exactly one operand and has exactly one child node in the query AST.
      Returns:
      True if this operation is unary.
      See Also:
    • isBinary

      public boolean isBinary()
      Check if this a binary operation, meaning it takes exactly two operands and has exactly two child nodes in the query AST.
      Returns:
      True if this operation is binary.
      See Also:
    • getArity

      public int getArity()
      Gets the arity of this operator, that is, the number of arguments or operands it takes.
      Returns:
      The arity of this operator.