hydra-pg-0.17.2: src/main/haskell/Hydra/Pg/Query.hs
-- Note: this is an automatically generated file. Do not edit.
-- | A common model for pattern-matching queries over property graphs
module Hydra.Pg.Query where
import qualified Hydra.Core as Core
import qualified Hydra.Pg.Model as Model
import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)
import qualified Data.Scientific as Sci
-- | An aggregation query over a property graph
data AggregationQuery =
AggregationQueryCount
deriving (Eq, Ord, Read, Show)
_AggregationQuery = Core.Name "hydra.pg.query.AggregationQuery"
_AggregationQuery_count = Core.Name "count"
-- | A non-empty sequence of queries applied in order
newtype ApplicationQuery =
ApplicationQuery {
unApplicationQuery :: [Query]}
deriving (Eq, Ord, Read, Show)
_ApplicationQuery = Core.Name "hydra.pg.query.ApplicationQuery"
-- | An associative expression: a binary operator applied to a non-empty list of operands
data AssociativeExpression =
AssociativeExpression {
associativeExpressionOperator :: BinaryOperator,
associativeExpressionOperands :: [Expression]}
deriving (Eq, Ord, Read, Show)
_AssociativeExpression = Core.Name "hydra.pg.query.AssociativeExpression"
_AssociativeExpression_operator = Core.Name "operator"
_AssociativeExpression_operands = Core.Name "operands"
-- | A binary boolean operator: and, or, or xor
data BinaryBooleanOperator =
BinaryBooleanOperatorAnd |
BinaryBooleanOperatorOr |
BinaryBooleanOperatorXor
deriving (Eq, Ord, Read, Show)
_BinaryBooleanOperator = Core.Name "hydra.pg.query.BinaryBooleanOperator"
_BinaryBooleanOperator_and = Core.Name "and"
_BinaryBooleanOperator_or = Core.Name "or"
_BinaryBooleanOperator_xor = Core.Name "xor"
-- | A binary expression: a left operand, an operator, and a right operand
data BinaryExpression =
BinaryExpression {
binaryExpressionLeft :: Expression,
binaryExpressionOperator :: BinaryOperator,
binaryExpressionRight :: Expression}
deriving (Eq, Ord, Read, Show)
_BinaryExpression = Core.Name "hydra.pg.query.BinaryExpression"
_BinaryExpression_left = Core.Name "left"
_BinaryExpression_operator = Core.Name "operator"
_BinaryExpression_right = Core.Name "right"
-- | A binary operator: boolean, comparison, or exponentiation
data BinaryOperator =
BinaryOperatorBoolean BinaryBooleanOperator |
BinaryOperatorComparison ComparisonOperator |
BinaryOperatorPower
deriving (Eq, Ord, Read, Show)
_BinaryOperator = Core.Name "hydra.pg.query.BinaryOperator"
_BinaryOperator_boolean = Core.Name "boolean"
_BinaryOperator_comparison = Core.Name "comparison"
_BinaryOperator_power = Core.Name "power"
-- | A variable bound to the result of a query
data Binding =
Binding {
bindingKey :: Variable,
bindingValue :: Query}
deriving (Eq, Ord, Read, Show)
_Binding = Core.Name "hydra.pg.query.Binding"
_Binding_key = Core.Name "key"
_Binding_value = Core.Name "value"
-- | A comparison operator: equal, not-equal, or an ordering relation
data ComparisonOperator =
ComparisonOperatorEq |
ComparisonOperatorNeq |
ComparisonOperatorLt |
ComparisonOperatorLte |
ComparisonOperatorGt |
ComparisonOperatorGte
deriving (Eq, Ord, Read, Show)
_ComparisonOperator = Core.Name "hydra.pg.query.ComparisonOperator"
_ComparisonOperator_eq = Core.Name "eq"
_ComparisonOperator_neq = Core.Name "neq"
_ComparisonOperator_lt = Core.Name "lt"
_ComparisonOperator_lte = Core.Name "lte"
_ComparisonOperator_gt = Core.Name "gt"
_ComparisonOperator_gte = Core.Name "gte"
-- | A pattern matching an edge, its direction, optional label, properties, and adjacent vertex
data EdgeProjectionPattern =
EdgeProjectionPattern {
edgeProjectionPatternDirection :: Model.Direction,
edgeProjectionPatternLabel :: (Maybe Model.EdgeLabel),
edgeProjectionPatternProperties :: [PropertyPattern],
edgeProjectionPatternVertex :: (Maybe VertexPattern)}
deriving (Eq, Ord, Read, Show)
_EdgeProjectionPattern = Core.Name "hydra.pg.query.EdgeProjectionPattern"
_EdgeProjectionPattern_direction = Core.Name "direction"
_EdgeProjectionPattern_label = Core.Name "label"
_EdgeProjectionPattern_properties = Core.Name "properties"
_EdgeProjectionPattern_vertex = Core.Name "vertex"
-- | An expression in a property graph query
data Expression =
ExpressionAssociative AssociativeExpression |
ExpressionBinary BinaryExpression |
ExpressionProperty PropertyProjection |
ExpressionUnary UnaryExpression |
ExpressionVariable Variable |
ExpressionVertex VertexPattern
deriving (Eq, Ord, Read, Show)
_Expression = Core.Name "hydra.pg.query.Expression"
_Expression_associative = Core.Name "associative"
_Expression_binary = Core.Name "binary"
_Expression_property = Core.Name "property"
_Expression_unary = Core.Name "unary"
_Expression_variable = Core.Name "variable"
_Expression_vertex = Core.Name "vertex"
-- | A let query: variable bindings evaluated in an environment query
data LetQuery =
LetQuery {
letQueryBindings :: [Binding],
letQueryEnvironment :: Query}
deriving (Eq, Ord, Read, Show)
_LetQuery = Core.Name "hydra.pg.query.LetQuery"
_LetQuery_bindings = Core.Name "bindings"
_LetQuery_environment = Core.Name "environment"
-- | A pattern-matching query, with optional matching semantics and a filter condition
data MatchQuery =
MatchQuery {
matchQueryOptional :: Bool,
matchQueryPattern :: [Projection],
matchQueryWhere :: (Maybe Expression)}
deriving (Eq, Ord, Read, Show)
_MatchQuery = Core.Name "hydra.pg.query.MatchQuery"
_MatchQuery_optional = Core.Name "optional"
_MatchQuery_pattern = Core.Name "pattern"
_MatchQuery_where = Core.Name "where"
-- | A projected expression, optionally bound to a variable
data Projection =
Projection {
projectionValue :: Expression,
projectionAs :: (Maybe Variable)}
deriving (Eq, Ord, Read, Show)
_Projection = Core.Name "hydra.pg.query.Projection"
_Projection_value = Core.Name "value"
_Projection_as = Core.Name "as"
-- | A set of projections, optionally including all fields
data Projections =
Projections {
projectionsAll :: Bool,
projectionsExplicit :: [Projection]}
deriving (Eq, Ord, Read, Show)
_Projections = Core.Name "hydra.pg.query.Projections"
_Projections_all = Core.Name "all"
_Projections_explicit = Core.Name "explicit"
-- | A pattern matching a property by key against a value pattern
data PropertyPattern =
PropertyPattern {
propertyPatternKey :: Model.PropertyKey,
propertyPatternValue :: PropertyValuePattern}
deriving (Eq, Ord, Read, Show)
_PropertyPattern = Core.Name "hydra.pg.query.PropertyPattern"
_PropertyPattern_key = Core.Name "key"
_PropertyPattern_value = Core.Name "value"
-- | A projection of a property, by key, from a base expression
data PropertyProjection =
PropertyProjection {
propertyProjectionBase :: Expression,
propertyProjectionKey :: Model.PropertyKey}
deriving (Eq, Ord, Read, Show)
_PropertyProjection = Core.Name "hydra.pg.query.PropertyProjection"
_PropertyProjection_base = Core.Name "base"
_PropertyProjection_key = Core.Name "key"
-- | A property value
newtype PropertyValue =
PropertyValue {
unPropertyValue :: String}
deriving (Eq, Ord, Read, Show)
_PropertyValue = Core.Name "hydra.pg.query.PropertyValue"
-- | A pattern matching a property value: a variable binding or a literal value
data PropertyValuePattern =
PropertyValuePatternVariable Model.PropertyKey |
PropertyValuePatternValue String
deriving (Eq, Ord, Read, Show)
_PropertyValuePattern = Core.Name "hydra.pg.query.PropertyValuePattern"
_PropertyValuePattern_variable = Core.Name "variable"
_PropertyValuePattern_value = Core.Name "value"
-- | A property graph query
data Query =
QueryApplication ApplicationQuery |
QueryAggregate AggregationQuery |
QueryLetQuery LetQuery |
QueryMatch MatchQuery |
QuerySelect SelectQuery |
QueryValue String
deriving (Eq, Ord, Read, Show)
_Query = Core.Name "hydra.pg.query.Query"
_Query_application = Core.Name "application"
_Query_aggregate = Core.Name "aggregate"
_Query_LetQuery = Core.Name "LetQuery"
_Query_match = Core.Name "match"
_Query_select = Core.Name "select"
_Query_value = Core.Name "value"
-- | A select query, with optional distinctness and a set of projections
data SelectQuery =
SelectQuery {
selectQueryDistinct :: Bool,
selectQueryProjection :: Projections}
deriving (Eq, Ord, Read, Show)
_SelectQuery = Core.Name "hydra.pg.query.SelectQuery"
_SelectQuery_distinct = Core.Name "distinct"
_SelectQuery_projection = Core.Name "projection"
-- | A unary expression: an operator applied to a single operand
data UnaryExpression =
UnaryExpression {
unaryExpressionOperator :: UnaryOperator,
unaryExpressionOperand :: Expression}
deriving (Eq, Ord, Read, Show)
_UnaryExpression = Core.Name "hydra.pg.query.UnaryExpression"
_UnaryExpression_operator = Core.Name "operator"
_UnaryExpression_operand = Core.Name "operand"
-- | A unary operator: negation
data UnaryOperator =
UnaryOperatorNegate
deriving (Eq, Ord, Read, Show)
_UnaryOperator = Core.Name "hydra.pg.query.UnaryOperator"
_UnaryOperator_negate = Core.Name "negate"
-- | A query variable name
newtype Variable =
Variable {
unVariable :: String}
deriving (Eq, Ord, Read, Show)
_Variable = Core.Name "hydra.pg.query.Variable"
-- | A pattern matching a vertex, its optional binding variable and label, properties, and adjacent edges
data VertexPattern =
VertexPattern {
vertexPatternVariable :: (Maybe Variable),
vertexPatternLabel :: (Maybe Model.VertexLabel),
vertexPatternProperties :: [PropertyPattern],
vertexPatternEdges :: [EdgeProjectionPattern]}
deriving (Eq, Ord, Read, Show)
_VertexPattern = Core.Name "hydra.pg.query.VertexPattern"
_VertexPattern_variable = Core.Name "variable"
_VertexPattern_label = Core.Name "label"
_VertexPattern_properties = Core.Name "properties"
_VertexPattern_edges = Core.Name "edges"