Enum Class OperationType
- All Implemented Interfaces:
Serializable
,Comparable<OperationType>
,Constable
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)
.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThe 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
Modifier and TypeFieldDescriptionprivate final int
The number of operands (inputs) required to execute this operation. -
Constructor Summary
ModifierConstructorDescriptionprivate
OperationType
(int operands) Constructs a new operation type with the given number of operands. -
Method Summary
Modifier and TypeMethodDescriptionint
getArity()
Gets the arity of this operator, that is, the number of arguments or operands it takes.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.boolean
isBinary()
Check if this a binary operation, meaning it takes exactly two operands and has exactly two child nodes in the query AST.boolean
isUnary()
Check if this a unary operation, meaning it takes exactly one operand and has exactly one child node in the query AST.static OperationType
Returns the enum constant of this class with the specified name.static OperationType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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 vertexm
denoted as(v, m)
, and the right input graph contains the path from vertexm
to vertexu
denoted as(m, u)
. Then one of the paths in the output result graph will be(v, u)
, the path from vertexv
to vertexu
. -
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
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 vertex2
with labela
and we select all edges with labela
, then the output contains the path(1, 2)
. Similarly, if we select all edges with labela
in inverse direction, then the output contains the path(2, 1)
. -
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
, and3
, then the output graph will contain(1, 1)
,(2, 2)
, and(3, 3)
. -
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
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 operandsThe 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
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
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 nameNullPointerException
- 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.
-