module Graql.Query
( MatchQuery
, match
, select
, limit
, distinct
) where
import Graql.Util
import Graql.Pattern
import Graql.Property
data MatchQuery = Match [Pattern]
| Select MatchQuery [Var]
| Limit MatchQuery Integer
| Distinct MatchQuery
match :: IsPattern a => [a] -> MatchQuery
match = Match . map toPattern
select :: [Var] -> MatchQuery -> MatchQuery
select = flip Select
limit :: Integer -> MatchQuery -> MatchQuery
limit = flip Limit
distinct :: MatchQuery -> MatchQuery
distinct = Distinct
instance Show MatchQuery where
show (Match patts ) = "match " ++ spaces patts
show (Select mq vars) = show mq ++ " select " ++ commas vars ++ ";"
show (Limit mq lim ) = show mq ++ " limit " ++ show lim ++ ";"
show (Distinct mq ) = show mq ++ " distinct;"