Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module is experimental. It may have breaking changes in future.
This module has Gremlin traversals defined in GTraversal
generalized on the
walk type. It may save you from calling liftWalk
manually.
Since: 2.0.3.0
Synopsis
- newtype GTraversal c s e = GTraversal {
- unGTraversal :: Greskell (GraphTraversal c s e)
- data GraphTraversal c s e
- class ToGTraversal g where
- toGTraversal :: WalkType c => g c s e -> GTraversal c s e
- liftWalk :: (WalkType from, WalkType to, Lift from to) => g from s e -> g to s e
- unsafeCastStart :: WalkType c => g c s1 e -> g c s2 e
- unsafeCastEnd :: WalkType c => g c s e1 -> g c s e2
- data Walk c s e
- data GraphTraversalSource
- class WalkType t
- data Filter
- data Transform
- data SideEffect
- class Lift from to
- class Split c p
- source :: Text -> Greskell GraphTraversalSource
- sV :: (Vertex v, WalkType c, Lift Transform c) => [Greskell (ElementID v)] -> Greskell GraphTraversalSource -> GTraversal c () v
- sV' :: (WalkType c, Lift Transform c) => [Greskell (ElementID AVertex)] -> Greskell GraphTraversalSource -> GTraversal c () AVertex
- sE :: (Edge e, WalkType c, Lift Transform c) => [Greskell (ElementID e)] -> Greskell GraphTraversalSource -> GTraversal c () e
- sE' :: (WalkType c, Lift Transform c) => [Greskell (ElementID AEdge)] -> Greskell GraphTraversalSource -> GTraversal c () AEdge
- sAddV :: (Vertex v, WalkType c, Lift SideEffect c) => Greskell Text -> Greskell GraphTraversalSource -> GTraversal c () v
- sAddV' :: (WalkType c, Lift SideEffect c) => Greskell Text -> Greskell GraphTraversalSource -> GTraversal c () AVertex
- (&.) :: GTraversal c a b -> Walk c b d -> GTraversal c a d
- ($.) :: Walk c b d -> GTraversal c a b -> GTraversal c a d
- (<$.>) :: Functor f => Walk c b d -> f (GTraversal c a b) -> f (GTraversal c a d)
- (<*.>) :: Applicative f => f (Walk c b d) -> f (GTraversal c a b) -> f (GTraversal c a d)
- gIterate :: WalkType c => GTraversal c s e -> GTraversal c s ()
- unsafeGTraversal :: Text -> GTraversal c s e
- unsafeWalk :: WalkType c => Text -> [Text] -> Walk c s e
- modulateWith :: WalkType c => Walk c s e -> [Walk c e e] -> Walk c s e
- gIdentity :: WalkType c => Walk c s s
- gFilter :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => g c s e -> Walk p s s
- gCyclicPath :: WalkType c => Walk c a a
- gSimplePath :: WalkType c => Walk c a a
- gIs :: WalkType c => Greskell v -> Walk c v v
- gIsP :: WalkType c => Greskell (P v) -> Walk c v v
- gHas1 :: (WalkType c, Element s) => Key s v -> Walk c s s
- gHas2 :: (WalkType c, Element s) => Key s v -> Greskell v -> Walk c s s
- gHas2P :: (WalkType c, Element s) => Key s v -> Greskell (P v) -> Walk c s s
- gHasLabel :: (Element s, WalkType c) => Greskell Text -> Walk c s s
- gHasLabelP :: (Element s, WalkType c) => Greskell (P Text) -> Walk c s s
- gHasId :: (Element s, WalkType c) => Greskell (ElementID s) -> Walk c s s
- gHasIdP :: (Element s, WalkType c) => Greskell (P (ElementID s)) -> Walk c s s
- gHasKey :: (Element (p v), Property p, WalkType c) => Greskell Text -> Walk c (p v) (p v)
- gHasKeyP :: (Element (p v), Property p, WalkType c) => Greskell (P Text) -> Walk c (p v) (p v)
- gHasValue :: (Element (p v), Property p, WalkType c) => Greskell v -> Walk c (p v) (p v)
- gHasValueP :: (Element (p v), Property p, WalkType c) => Greskell (P v) -> Walk c (p v) (p v)
- gAnd :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => [g c s e] -> Walk p s s
- gOr :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => [g c s e] -> Walk p s s
- gNot :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => g c s e -> Walk p s s
- gWhereP1 :: WalkType c => Greskell (LabeledP a) -> Maybe (ByProjection a b) -> Walk c a a
- gWhereP2 :: WalkType c => AsLabel a -> Greskell (LabeledP a) -> Maybe (ByProjection a b) -> Walk c x x
- gOrder :: (WalkType c, Lift Transform c) => [ByComparator s] -> Walk c s s
- gRange :: (WalkType c, Lift Transform c) => Greskell Int -> Greskell Int -> Walk c s s
- gLimit :: (WalkType c, Lift Transform c) => Greskell Int -> Walk c s s
- gTail :: (WalkType c, Lift Transform c) => Greskell Int -> Walk c s s
- gSkip :: (WalkType c, Lift Transform c) => Greskell Int -> Walk c s s
- gRepeat :: (ToGTraversal g, WalkType c) => Maybe RepeatLabel -> Maybe (RepeatPos, RepeatUntil c s) -> Maybe (RepeatPos, RepeatEmit c s) -> g c s s -> Walk c s s
- gTimes :: Greskell Int -> Maybe (RepeatPos, RepeatUntil c s)
- gUntilHead :: (ToGTraversal g, WalkType c, WalkType cc, Split cc c) => g cc s e -> Maybe (RepeatPos, RepeatUntil c s)
- gUntilTail :: (ToGTraversal g, WalkType c, WalkType cc, Split cc c) => g cc s e -> Maybe (RepeatPos, RepeatUntil c s)
- gEmitHead :: Maybe (RepeatPos, RepeatEmit c s)
- gEmitTail :: Maybe (RepeatPos, RepeatEmit c s)
- gEmitHeadT :: (ToGTraversal g, WalkType c, WalkType cc, Split cc c) => g cc s e -> Maybe (RepeatPos, RepeatEmit c s)
- gEmitTailT :: (ToGTraversal g, WalkType c, WalkType cc, Split cc c) => g cc s e -> Maybe (RepeatPos, RepeatEmit c s)
- gLoops :: (WalkType c, Lift Transform c) => Maybe RepeatLabel -> Walk c s Int
- data RepeatUntil c s where
- RepeatTimes :: Greskell Int -> RepeatUntil c s
- RepeatUntilT :: (WalkType cc, WalkType c, Split cc c) => GTraversal cc s e -> RepeatUntil c s
- data RepeatEmit c s where
- RepeatEmit :: RepeatEmit c s
- RepeatEmitT :: (WalkType cc, WalkType c, Split cc c) => GTraversal cc s e -> RepeatEmit c s
- data RepeatPos
- newtype RepeatLabel = RepeatLabel {}
- gLocal :: (ToGTraversal g, WalkType c) => g c s e -> Walk c s e
- gUnion :: (ToGTraversal g, WalkType c) => [g c s e] -> Walk c s e
- gCoalesce :: (ToGTraversal g, Split cc c, Lift Transform c, WalkType c, WalkType cc) => [g cc s e] -> Walk c s e
- gChoose3 :: (ToGTraversal g, Split cc c, WalkType cc, WalkType c) => g cc s ep -> g c s e -> g c s e -> Walk c s e
- gBarrier :: WalkType c => Maybe (Greskell Int) -> Walk c s s
- gDedup :: (WalkType c, Lift Transform c) => Maybe (ByProjection s e) -> Walk c s s
- gDedupN :: (WalkType c, Lift Transform c) => AsLabel a -> [AsLabel a] -> Maybe (ByProjection a e) -> Walk c s s
- gFlatMap :: (Lift Transform c, Split cc c, ToGTraversal g, WalkType c, WalkType cc) => g cc s e -> Walk c s e
- gV :: (Vertex v, WalkType c, Lift Transform c) => [Greskell (ElementID v)] -> Walk c s v
- gV' :: (WalkType c, Lift Transform c) => [Greskell (ElementID AVertex)] -> Walk c s AVertex
- gConstant :: (WalkType c, Lift Transform c) => Greskell a -> Walk c s a
- gProject :: (WalkType c, Lift Transform c) => LabeledByProjection s -> [LabeledByProjection s] -> Walk c s (PMap Single GValue)
- gAs :: (WalkType c, Lift Transform c) => AsLabel a -> Walk c a a
- gValues :: (Element s, WalkType c, Lift Transform c) => [Key s e] -> Walk c s e
- gProperties :: (Element s, Property p, ElementProperty s ~ p, WalkType c, Lift Transform c) => [Key s v] -> Walk c s (p v)
- gId :: (Element s, WalkType c, Lift Transform c) => Walk c s (ElementID s)
- gLabel :: (Element s, WalkType c, Lift Transform c) => Walk c s Text
- gValueMap :: (Element s, WalkType c, Lift Transform c) => Keys s -> Walk c s (PMap (ElementPropertyContainer s) GValue)
- gElementMap :: (Element s, WalkType c, Lift Transform c) => Keys s -> Walk c s (PMap Single GValue)
- gSelect1 :: (WalkType c, Lift Transform c) => AsLabel a -> Walk c s a
- gSelectN :: (WalkType c, Lift Transform c) => AsLabel a -> AsLabel b -> [AsLabel c] -> Walk c s (SelectedMap GValue)
- gSelectBy1 :: (WalkType c, Lift Transform c) => AsLabel a -> ByProjection a b -> Walk c s b
- gSelectByN :: (WalkType c, Lift Transform c) => AsLabel a -> AsLabel a -> [AsLabel a] -> ByProjection a b -> Walk c s (SelectedMap b)
- gUnfold :: (AsIterator a, WalkType c, Lift Transform c) => Walk c a (IteratorItem a)
- gPath :: (WalkType c, Lift Transform c) => Walk c s (Path GValue)
- gPathBy :: (WalkType c, Lift Transform c) => ByProjection a b -> [ByProjection a b] -> Walk c s (Path b)
- gFold :: (WalkType c, Lift Transform c) => Walk c a [a]
- gCount :: (WalkType c, Lift Transform c) => Walk c a Int
- gOut :: (Vertex v1, Vertex v2, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v1 v2
- gOut' :: (Vertex v, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v AVertex
- gOutE :: (Vertex v, Edge e, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v e
- gOutE' :: (Vertex v, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v AEdge
- gOutV :: (Edge e, Vertex v, WalkType c, Lift Transform c) => Walk c e v
- gOutV' :: (Edge e, WalkType c, Lift Transform c) => Walk c e AVertex
- gIn :: (Vertex v1, Vertex v2, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v1 v2
- gIn' :: (Vertex v, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v AVertex
- gInE :: (Vertex v, Edge e, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v e
- gInE' :: (Vertex v, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v AEdge
- gInV :: (Edge e, Vertex v, WalkType c, Lift Transform c) => Walk c e v
- gInV' :: (Edge e, WalkType c, Lift Transform c) => Walk c e AVertex
- gMatch :: (WalkType c, Lift Transform c) => Logic MatchPattern -> Walk c a MatchResult
- data MatchPattern where
- MatchPattern :: AsLabel a -> Walk Transform a b -> MatchPattern
- mPattern :: (WalkType c, Lift c Transform) => AsLabel a -> Walk c a b -> Logic MatchPattern
- data MatchResult
- gSideEffect :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => g c s e -> Walk p s s
- gAddV :: (Vertex v, WalkType c, Lift SideEffect c) => Greskell Text -> Walk c a v
- gAddV' :: (WalkType c, Lift SideEffect c) => Greskell Text -> Walk c a AVertex
- gAddE :: (Vertex vs, Vertex ve, Edge e, WalkType c, Lift SideEffect c) => Greskell Text -> AddAnchor vs ve -> Walk c vs e
- gAddE' :: (WalkType c, Lift SideEffect c) => Greskell Text -> AddAnchor AVertex AVertex -> Walk c AVertex AEdge
- data AddAnchor s e
- gFrom :: (ToGTraversal g, WalkType c, Lift c Transform) => g c s e -> AddAnchor s e
- gTo :: (ToGTraversal g, WalkType c, Lift c Transform) => g c s e -> AddAnchor s e
- gDrop :: (Element e, WalkType c, Lift SideEffect c) => Walk c e e
- gDropP :: (Property p, WalkType c, Lift SideEffect c) => Walk c (p a) (p a)
- gProperty :: (Element e, WalkType c, Lift SideEffect c) => Key e v -> Greskell v -> Walk c e e
- gPropertyV :: (Vertex e, vp ~ ElementProperty e, Property vp, Element (vp v), WalkType c, Lift SideEffect c) => Maybe (Greskell Cardinality) -> Key e v -> Greskell v -> [KeyValue (vp v)] -> Walk c e e
- data ByProjection s e where
- ByProjection :: (ProjectionLike p, ToGreskell p) => p -> ByProjection (ProjectionLikeStart p) (ProjectionLikeEnd p)
- class ProjectionLike p where
- type ProjectionLikeStart p
- type ProjectionLikeEnd p
- data ByComparator s where
- ByComparatorProj :: ByProjection s e -> ByComparator s
- ByComparatorComp :: Comparator comp => Greskell comp -> ByComparator (CompareArg comp)
- ByComparatorProjComp :: Comparator comp => ByProjection s (CompareArg comp) -> Greskell comp -> ByComparator s
- data LabeledByProjection s where
- LabeledByProjection :: AsLabel a -> ByProjection s a -> LabeledByProjection s
- gBy :: (ProjectionLike p, ToGreskell p) => p -> ByProjection (ProjectionLikeStart p) (ProjectionLikeEnd p)
- gBy1 :: (ProjectionLike p, ToGreskell p) => p -> ByComparator (ProjectionLikeStart p)
- gBy2 :: (ProjectionLike p, ToGreskell p, Comparator comp, ProjectionLikeEnd p ~ CompareArg comp) => p -> Greskell comp -> ByComparator (ProjectionLikeStart p)
- gByL :: (ProjectionLike p, ToGreskell p) => AsLabel (ProjectionLikeEnd p) -> p -> LabeledByProjection (ProjectionLikeStart p)
Types
GraphTraversal and others
newtype GTraversal c s e Source #
GraphTraversal
class object of TinkerPop. It takes data s
from upstream and emits data e
to downstream. Type c
is called
"walk type", a marker to describe the effect of the traversal.
GTraversal
is NOT a Category
. Because a GraphTraversal
object
keeps some context data, the starting (left-most) GraphTraversal
object controls most of the behavior of entire composition of
traversals and steps. This violates Category
law.
GTraversal | |
|
Instances
data GraphTraversal c s e Source #
Phantom type for GraphTraversal
class. In greskell, we usually
use GTraversal
instead of Greskell
GraphTraversal
.
Instances
class ToGTraversal g where Source #
Types that can convert to GTraversal
.
toGTraversal :: WalkType c => g c s e -> GTraversal c s e Source #
liftWalk :: (WalkType from, WalkType to, Lift from to) => g from s e -> g to s e Source #
Lift WalkType
from
to to
. Use this for type matching.
unsafeCastStart :: WalkType c => g c s1 e -> g c s2 e Source #
Unsafely cast the start type s1
into s2
.
It is recommended that s2
is coercible to s1
in terms of
FromGraphSON
. That is, if s2
can parse a GValue
, s1
should also be able to parse that GValue
.
Since: 1.0.0.0
unsafeCastEnd :: WalkType c => g c s e1 -> g c s e2 Source #
Unsafely cast the end type e1
into e2
. See
unsafeCastStart
.
Since: 1.0.0.0
Instances
ToGTraversal GTraversal Source # | |
Defined in Data.Greskell.GTraversal toGTraversal :: WalkType c => GTraversal c s e -> GTraversal c s e Source # liftWalk :: (WalkType from, WalkType to, Lift from to) => GTraversal from s e -> GTraversal to s e Source # unsafeCastStart :: WalkType c => GTraversal c s1 e -> GTraversal c s2 e Source # unsafeCastEnd :: WalkType c => GTraversal c s e1 -> GTraversal c s e2 Source # | |
ToGTraversal Walk Source # | To convert a |
Defined in Data.Greskell.GTraversal |
A chain of one or more Gremlin steps. Like GTraversal
, type s
is the input, type e
is the output, and type c
is a marker to
describe the step.
Walk
represents a chain of method calls such as
.has(x).outE()
. Because this is not a Gremlin (Groovy)
expression, we use bare Walk
, not Greskell
Walk
.
Walk
is a Category
. You can use functions from
Control.Category to compose Walk
s. This is equivalent to making
a chain of method calls in Gremlin.
Walk
is not an Eq
, because it's difficult to define true
equality between Gremlin method calls. If we define it naively, it
might have conflict with Category
law.
Instances
data GraphTraversalSource Source #
GraphTraversalSource
class object of TinkerPop. It is a factory
object of GraphTraversal
s.
Instances
Show GraphTraversalSource Source # | |
Defined in Data.Greskell.GTraversal showsPrec :: Int -> GraphTraversalSource -> ShowS # show :: GraphTraversalSource -> String # showList :: [GraphTraversalSource] -> ShowS # |
Walk types
Class of phantom type markers to describe the effect of the walk/traversals.
Instances
WalkType Filter Source # | |
Defined in Data.Greskell.GTraversal | |
WalkType SideEffect Source # | |
Defined in Data.Greskell.GTraversal showWalkType :: Proxy SideEffect -> String Source # | |
WalkType Transform Source # | |
Defined in Data.Greskell.GTraversal |
WalkType for filtering steps.
A filtering step is a step that does filtering only. It takes input and emits some of them without any modification, reordering, traversal actions, or side-effects. Filtering decision must be solely based on each element.
(gSideEffect w == gIdentity) AND (gFilter w == w)
If Walk
s w1
and w2
are Filter
type, then
gAnd [w1, w2] == w1 >>> w2 == w2 >>> w1
Instances
WalkType for steps without any side-effects. This includes transformations, reordring, injections and graph traversal actions.
A Walk
w
is Transform
type iff:
gSideEffect w == gIdentity
Instances
data SideEffect Source #
WalkType for steps that may have side-effects.
A side-effect here means manipulation of the "sideEffect" in Gremlin context (i.e. the stash of data kept in a Traversal object), as well as interaction with the world outside the Traversal object.
For example, the following steps (in Gremlin) all have side-effects.
.addE('label') .aggregate('x') .sideEffect(System.out.&println) .map { some_variable += 1 }
Instances
WalkType SideEffect Source # | |
Defined in Data.Greskell.GTraversal showWalkType :: Proxy SideEffect -> String Source # | |
Lift SideEffect SideEffect Source # | |
Defined in Data.Greskell.GTraversal showLift :: Proxy SideEffect -> Proxy SideEffect -> String Source # | |
Lift Transform SideEffect Source # | |
Defined in Data.Greskell.GTraversal | |
Split SideEffect SideEffect Source # |
|
Defined in Data.Greskell.GTraversal showSplit :: Proxy SideEffect -> Proxy SideEffect -> String Source # |
Relation of WalkType
s where one includes the other. from
can
be lifted to to
, because to
is more powerful than from
.
Instances
WalkType c => Lift Filter c Source # | |
Lift SideEffect SideEffect Source # | |
Defined in Data.Greskell.GTraversal showLift :: Proxy SideEffect -> Proxy SideEffect -> String Source # | |
Lift Transform SideEffect Source # | |
Defined in Data.Greskell.GTraversal | |
Lift Transform Transform Source # | |
Relation of WalkType
s where the child walk c
is split from
the parent walk p
.
When splitting, transformation effect done in the child walk is rolled back (canceled) in the parent walk.
Instances
WalkType p => Split Filter p Source # | |
Split SideEffect SideEffect Source # |
|
Defined in Data.Greskell.GTraversal showSplit :: Proxy SideEffect -> Proxy SideEffect -> String Source # | |
WalkType p => Split Transform p Source # |
|
GraphTraversalSource
:: Text | variable name of |
-> Greskell GraphTraversalSource |
Create GraphTraversalSource
from a varible name in Gremlin
sV :: (Vertex v, WalkType c, Lift Transform c) => [Greskell (ElementID v)] -> Greskell GraphTraversalSource -> GTraversal c () v Source #
sV' :: (WalkType c, Lift Transform c) => [Greskell (ElementID AVertex)] -> Greskell GraphTraversalSource -> GTraversal c () AVertex Source #
sE :: (Edge e, WalkType c, Lift Transform c) => [Greskell (ElementID e)] -> Greskell GraphTraversalSource -> GTraversal c () e Source #
sE' :: (WalkType c, Lift Transform c) => [Greskell (ElementID AEdge)] -> Greskell GraphTraversalSource -> GTraversal c () AEdge Source #
sAddV :: (Vertex v, WalkType c, Lift SideEffect c) => Greskell Text -> Greskell GraphTraversalSource -> GTraversal c () v Source #
sAddV' :: (WalkType c, Lift SideEffect c) => Greskell Text -> Greskell GraphTraversalSource -> GTraversal c () AVertex Source #
GTraversal
(&.) :: GTraversal c a b -> Walk c b d -> GTraversal c a d infixl 1 Source #
Apply the Walk
to the GTraversal
. In Gremlin, this means
calling a chain of methods on the Traversal object.
($.) :: Walk c b d -> GTraversal c a b -> GTraversal c a d infixr 0 Source #
Same as &.
with arguments flipped.
(<$.>) :: Functor f => Walk c b d -> f (GTraversal c a b) -> f (GTraversal c a d) infixr 0 Source #
(<*.>) :: Applicative f => f (Walk c b d) -> f (GTraversal c a b) -> f (GTraversal c a d) infixr 0 Source #
gIterate :: WalkType c => GTraversal c s e -> GTraversal c s () Source #
.iterate
method on GraphTraversal
.
gIterate
is not a Walk
because it's usually used to terminate
the method chain of Gremlin steps. The returned GTraversal
outputs nothing, thus its end type is ()
.
Since: 1.1.0.0
unsafeGTraversal :: Text -> GTraversal c s e Source #
Unsafely create GTraversal
from the given raw Gremlin script.
Walk/Steps
Unsafely create a Walk
that represents a single method call on
a GraphTraversal
.
Filter steps
gFilter :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => g c s e -> Walk p s s Source #
.filter
step that takes a traversal.
gCyclicPath :: WalkType c => Walk c a a Source #
.cyclicPath
step.
Since: 1.0.1.0
gSimplePath :: WalkType c => Walk c a a Source #
.simplePath
step.
Since: 1.0.1.0
Is step
Has steps
.has
step with one argument.
gHas2 :: (WalkType c, Element s) => Key s v -> Greskell v -> Walk c s s Source #
.has
step with two arguments.
:: (WalkType c, Element s) | |
=> Key s v | property key |
-> Greskell (P v) | predicate on the property value |
-> Walk c s s |
.has
step with two arguments and P
type.
.hasLabel
step with P
type. Supported since TinkerPop 3.2.7.
gHasIdP :: (Element s, WalkType c) => Greskell (P (ElementID s)) -> Walk c s s Source #
.hasId
step with P
type. Supported since TinkerPop 3.2.7.
gHasKey :: (Element (p v), Property p, WalkType c) => Greskell Text -> Walk c (p v) (p v) Source #
.hasKey
step. The input type should be a VertexProperty.
:: (Element (p v), Property p, WalkType c) | |
=> Greskell (P Text) | predicate on the VertexProperty's key. |
-> Walk c (p v) (p v) |
.hasKey
step with P
type. Supported since TinkerPop 3.2.7.
gHasValue :: (Element (p v), Property p, WalkType c) => Greskell v -> Walk c (p v) (p v) Source #
.hasValue
step. The input type should be a VertexProperty.
:: (Element (p v), Property p, WalkType c) | |
=> Greskell (P v) | predicate on the VertexProperty's value |
-> Walk c (p v) (p v) |
.hasValue
step with P
type. Supported since TinkerPop 3.2.7.
Logic steps
gAnd :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => [g c s e] -> Walk p s s Source #
.and
step.
gOr :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => [g c s e] -> Walk p s s Source #
.or
step.
gNot :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => g c s e -> Walk p s s Source #
.not
step.
Where step
:: WalkType c | |
=> Greskell (LabeledP a) | the |
-> Maybe (ByProjection a b) | optional |
-> Walk c a a |
.where
step with P
argument only.
If the ByProjection
argument is Nothing
, comparison is
performed on the type a
. You have to ensure that the comparator
included in the LabeledP
argument can handle the type
a
. Usually this means the type a
should implement Java's
Comparable
interface (this is true for most Java classes).
If the ByProjection
argument is given, comparison is performed on
the projected values of type b
. So, the type b
should implement
Java's Comparable
interface.
Since: 1.2.0.0
:: WalkType c | |
=> AsLabel a | the starting label of |
-> Greskell (LabeledP a) | the |
-> Maybe (ByProjection a b) | optional |
-> Walk c x x |
.where
step with the starting label and P
arguments. See also
gWhereP1
.
Since: 1.2.0.0
Sorting steps
Paging steps
Repeat step
:: (ToGTraversal g, WalkType c) | |
=> Maybe RepeatLabel | Label for the loop. |
-> Maybe (RepeatPos, RepeatUntil c s) |
|
-> Maybe (RepeatPos, RepeatEmit c s) |
|
-> g c s s | Repeated traversal |
-> Walk c s s |
.repeat
step.
Since: 1.0.1.0
:: Greskell Int | Repeat count. If it's less than or equal to 0, the repeated traversal is never executed. |
-> Maybe (RepeatPos, RepeatUntil c s) |
.times
modulator before the .repeat
step. It always returns
Just
.
Since: 1.0.1.0
gUntilHead :: (ToGTraversal g, WalkType c, WalkType cc, Split cc c) => g cc s e -> Maybe (RepeatPos, RepeatUntil c s) Source #
.until
modulator before the .repeat
step. It always returns
Just
.
Since: 1.0.1.0
gUntilTail :: (ToGTraversal g, WalkType c, WalkType cc, Split cc c) => g cc s e -> Maybe (RepeatPos, RepeatUntil c s) Source #
.until
modulator after the .repeat
step. It always returns
Just
.
Since: 1.0.1.0
gEmitHead :: Maybe (RepeatPos, RepeatEmit c s) Source #
.emit
modulator without argument before the .repeat
step. It
always returns Just
.
Since: 1.0.1.0
gEmitTail :: Maybe (RepeatPos, RepeatEmit c s) Source #
.emit
modulator without argument after the .repeat
step. It
always returns Just
.
Since: 1.0.1.0
gEmitHeadT :: (ToGTraversal g, WalkType c, WalkType cc, Split cc c) => g cc s e -> Maybe (RepeatPos, RepeatEmit c s) Source #
.emit
modulator with a sub-traversal argument before the
.repeat
step. It always returns Just
.
Since: 1.0.1.0
gEmitTailT :: (ToGTraversal g, WalkType c, WalkType cc, Split cc c) => g cc s e -> Maybe (RepeatPos, RepeatEmit c s) Source #
.emit
modulator with a sub-traversal argument after the
.repeat
step. It always returns Just
.
Since: 1.0.1.0
data RepeatUntil c s where Source #
.until
or .times
modulator step.
Type c
is the WalkType
of the parent .repeat
step. Type s
is the start (and end) type of the .repeat
step.
Since: 1.0.1.0
RepeatTimes :: Greskell Int -> RepeatUntil c s |
|
RepeatUntilT :: (WalkType cc, WalkType c, Split cc c) => GTraversal cc s e -> RepeatUntil c s |
|
Instances
Show (RepeatUntil c s) Source # | |
Defined in Data.Greskell.GTraversal showsPrec :: Int -> RepeatUntil c s -> ShowS # show :: RepeatUntil c s -> String # showList :: [RepeatUntil c s] -> ShowS # |
data RepeatEmit c s where Source #
.emit
modulator step.
Type c
is the WalkType
of the parent .repeat
step. Type s
is the start (and end) type of the .repeat
step.
Since: 1.0.1.0
RepeatEmit :: RepeatEmit c s |
|
RepeatEmitT :: (WalkType cc, WalkType c, Split cc c) => GTraversal cc s e -> RepeatEmit c s |
|
Instances
Show (RepeatEmit c s) Source # | |
Defined in Data.Greskell.GTraversal showsPrec :: Int -> RepeatEmit c s -> ShowS # show :: RepeatEmit c s -> String # showList :: [RepeatEmit c s] -> ShowS # |
Position of a step modulator relative to .repeat
step.
Since: 1.0.1.0
RepeatHead | Modulator before the |
RepeatTail | Modulator after the |
Instances
Bounded RepeatPos Source # | |
Enum RepeatPos Source # | |
Defined in Data.Greskell.GTraversal succ :: RepeatPos -> RepeatPos # pred :: RepeatPos -> RepeatPos # fromEnum :: RepeatPos -> Int # enumFrom :: RepeatPos -> [RepeatPos] # enumFromThen :: RepeatPos -> RepeatPos -> [RepeatPos] # enumFromTo :: RepeatPos -> RepeatPos -> [RepeatPos] # enumFromThenTo :: RepeatPos -> RepeatPos -> RepeatPos -> [RepeatPos] # | |
Show RepeatPos Source # | |
Eq RepeatPos Source # | |
Ord RepeatPos Source # | |
Defined in Data.Greskell.GTraversal |
newtype RepeatLabel Source #
A label that points to a loop created by .repeat
step. It can
be used by .loops
step to specify the loop.
Since: 1.0.1.0
Instances
Branching steps
gUnion :: (ToGTraversal g, WalkType c) => [g c s e] -> Walk c s e Source #
.union
step.
Since: 1.0.1.0
gCoalesce :: (ToGTraversal g, Split cc c, Lift Transform c, WalkType c, WalkType cc) => [g cc s e] -> Walk c s e Source #
:: (ToGTraversal g, Split cc c, WalkType cc, WalkType c) | |
=> g cc s ep | the predicate traversal. |
-> g c s e | The traversal executed if the predicate traversal outputs something. |
-> g c s e | The traversal executed if the predicate traversal outputs nothing. |
-> Walk c s e |
.choose
step with if-then-else style.
Since: 1.0.1.0
Barrier steps
.barrier
step.
Since: 1.0.1.0
gDedupN :: (WalkType c, Lift Transform c) => AsLabel a -> [AsLabel a] -> Maybe (ByProjection a e) -> Walk c s s Source #
Transformation steps
gFlatMap :: (Lift Transform c, Split cc c, ToGTraversal g, WalkType c, WalkType cc) => g cc s e -> Walk c s e Source #
gV' :: (WalkType c, Lift Transform c) => [Greskell (ElementID AVertex)] -> Walk c s AVertex Source #
gProject :: (WalkType c, Lift Transform c) => LabeledByProjection s -> [LabeledByProjection s] -> Walk c s (PMap Single GValue) Source #
As step
Accessor steps
gProperties :: (Element s, Property p, ElementProperty s ~ p, WalkType c, Lift Transform c) => [Key s v] -> Walk c s (p v) Source #
gValueMap :: (Element s, WalkType c, Lift Transform c) => Keys s -> Walk c s (PMap (ElementPropertyContainer s) GValue) Source #
gElementMap :: (Element s, WalkType c, Lift Transform c) => Keys s -> Walk c s (PMap Single GValue) Source #
gSelectN :: (WalkType c, Lift Transform c) => AsLabel a -> AsLabel b -> [AsLabel c] -> Walk c s (SelectedMap GValue) Source #
gSelectBy1 :: (WalkType c, Lift Transform c) => AsLabel a -> ByProjection a b -> Walk c s b Source #
gSelectByN :: (WalkType c, Lift Transform c) => AsLabel a -> AsLabel a -> [AsLabel a] -> ByProjection a b -> Walk c s (SelectedMap b) Source #
gUnfold :: (AsIterator a, WalkType c, Lift Transform c) => Walk c a (IteratorItem a) Source #
gPathBy :: (WalkType c, Lift Transform c) => ByProjection a b -> [ByProjection a b] -> Walk c s (Path b) Source #
Summarizing steps
Graph traversal steps
gOut :: (Vertex v1, Vertex v2, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v1 v2 Source #
gIn :: (Vertex v1, Vertex v2, WalkType c, Lift Transform c) => [Greskell Text] -> Walk c v1 v2 Source #
Match step
gMatch :: (WalkType c, Lift Transform c) => Logic MatchPattern -> Walk c a MatchResult Source #
data MatchPattern where Source #
A pattern for .match
step.
Since: 1.2.0.0
MatchPattern :: AsLabel a -> Walk Transform a b -> MatchPattern | A pattern with the starting |
mPattern :: (WalkType c, Lift c Transform) => AsLabel a -> Walk c a b -> Logic MatchPattern Source #
A convenient function to make a MatchPattern
wrapped by
Leaf
.
Since: 1.2.0.0
data MatchResult Source #
Result of .match
step.
Since: 1.2.0.0
Side-effect steps
gSideEffect :: (ToGTraversal g, WalkType c, WalkType p, Split c p) => g c s e -> Walk p s s Source #
.sideEffect
step that takes a traversal.
Graph manipulation steps
gAddE :: (Vertex vs, Vertex ve, Edge e, WalkType c, Lift SideEffect c) => Greskell Text -> AddAnchor vs ve -> Walk c vs e Source #
gAddE' :: (WalkType c, Lift SideEffect c) => Greskell Text -> AddAnchor AVertex AVertex -> Walk c AVertex AEdge Source #
gProperty :: (Element e, WalkType c, Lift SideEffect c) => Key e v -> Greskell v -> Walk c e e Source #
gPropertyV :: (Vertex e, vp ~ ElementProperty e, Property vp, Element (vp v), WalkType c, Lift SideEffect c) => Maybe (Greskell Cardinality) -> Key e v -> Greskell v -> [KeyValue (vp v)] -> Walk c e e Source #
.by
steps
data ByProjection s e where Source #
Projection from type s
to type e
used in .by
step. You can
also use gBy
to construct ByProjection
.
ByProjection :: (ProjectionLike p, ToGreskell p) => p -> ByProjection (ProjectionLikeStart p) (ProjectionLikeEnd p) |
Instances
IsString (ByProjection s e) Source # | Projection by literal property key. |
Defined in Data.Greskell.GTraversal fromString :: String -> ByProjection s e # | |
ProjectionLike (ByProjection s e) Source # | |
Defined in Data.Greskell.GTraversal type ProjectionLikeStart (ByProjection s e) Source # type ProjectionLikeEnd (ByProjection s e) Source # | |
type ProjectionLikeEnd (ByProjection s e) Source # | |
Defined in Data.Greskell.GTraversal | |
type ProjectionLikeStart (ByProjection s e) Source # | |
Defined in Data.Greskell.GTraversal |
class ProjectionLike p Source #
Data types that mean a projection from one type to another.
type ProjectionLikeStart p Source #
The start type of the projection.
type ProjectionLikeEnd p Source #
The end type of the projection.
Instances
data ByComparator s where Source #
Comparison of type s
used in .by
step. You can also use
gBy1
and gBy2
to construct ByComparator
.
ByComparatorProj :: ByProjection s e -> ByComparator s | Type |
ByComparatorComp :: Comparator comp => Greskell comp -> ByComparator (CompareArg comp) | Type |
ByComparatorProjComp :: Comparator comp => ByProjection s (CompareArg comp) -> Greskell comp -> ByComparator s | Type |
Instances
IsString (ByComparator s) Source # |
|
Defined in Data.Greskell.GTraversal fromString :: String -> ByComparator s # |
data LabeledByProjection s where Source #
A ByProjection
associated with an AsLabel
. You can construct
it by gByL
.
Since: 1.0.0.0
LabeledByProjection :: AsLabel a -> ByProjection s a -> LabeledByProjection s |
gBy :: (ProjectionLike p, ToGreskell p) => p -> ByProjection (ProjectionLikeStart p) (ProjectionLikeEnd p) Source #
.by
step with 1 argument, used for projection.
gBy1 :: (ProjectionLike p, ToGreskell p) => p -> ByComparator (ProjectionLikeStart p) Source #
.by
step with 1 argument, used for comparison.
gBy2 :: (ProjectionLike p, ToGreskell p, Comparator comp, ProjectionLikeEnd p ~ CompareArg comp) => p -> Greskell comp -> ByComparator (ProjectionLikeStart p) Source #
.by
step with 2 arguments, used for comparison.
gByL :: (ProjectionLike p, ToGreskell p) => AsLabel (ProjectionLikeEnd p) -> p -> LabeledByProjection (ProjectionLikeStart p) Source #
.by
step associated with an AsLabel
.
Since: 1.0.0.0