&$      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#FBinder monad to make binding between Gremlin variables and JSON values Toshio Ito <debug.ito@gmail.com>NoneK6$#This type is only for internal use.7Binding between Gremlin variable names and JSON values.1A Monad that manages binding variables to values.;let binder = (,) <$> newBind (10 :: Int) <*> newBind "hoge"4let ((var_int, var_str), binding) = runBinder bindertoGremlin var_int"__v0"toGremlin var_str"__v1"/sortBy (comparing fst) $ HashMap.toList binding-[("__v0",Number 10.0),("__v1",String "hoge")]7Create a new Gremlin variable bound to the given value. The value v/ is kept in the monadic context. The returned %' is a Gremlin variable pointing to the vR. The Gremlin variable is guaranteed to be unique in the current monadic context.Execute the given  monad to obtain .&'This function is only for internal use.OUnsafely create a placeholder variable of arbitrary type with the given index.''This function is only for internal use.2Create placeholder variable string from the index. bound valuevariable()9Haskell counterpart of Gremlin graph structure data types Toshio Ito <debug.ito@gmail.com>None 345;=FKTS6A  , that can keep more than one values per key. ; returns the first property associated with the given key. 2 prepends the given property to the property list.* returns the union of the two given property maps. If the two property maps share some same keys, those property lists are concatenated.A  ! that has a single value per key. 1 replaces the old property by the given property.* returns the union of the two given property maps. If the two property maps share some same keys, the value from the left map wins.+Generic implementation of  . t is the type of cardinality, p is the type of , class and v$ is the type of the property value. 8Common basic operations supported by maps of properties. 1Look up a property associated with the given key. 5Look up all properties associated with the given key. Put a property into the map. 4Remove all properties associated with the given key.!Return all properties in the map.XGeneral vertex property type you can use for VertexProperty, based on aeson data types.ID of this vertex property.&Label and key of this vertex property.Value of this vertex property.)(meta)properties of this vertex property.-General simple property type you can use for , class.#This typeclass is for internal use.3JSON parser with a property key given from outside."General edge type you can use for /# class, based on aeson data types.ID of this edge.Label of this edge.(Label of this edge's destination vertex.#Label of this edge's source vertex. %ID of this edge's destination vertex.! ID of this edge's source vertex."Properties of this edge.#$General vertex type you can use for 1# class, based on aeson data types.%ID of this vertex&Label of this vertex'Properties of this vertex.(A property key accessing value b in an Element a'. In Gremlin, it's just a String type.+(org.apache.tinkerpop.gremlin.structure.T enum.+ is a token to get data b from an Element a.,/org.apache.tinkerpop.gremlin.structure.Property! interface in a TinkerPop graph.-Get key of this property..Get value of this property./+org.apache.tinkerpop.gremlin.structure.Edge! interface in a TinkerPop graph.0ID type of the 1 this edge connects.1-org.apache.tinkerpop.gremlin.structure.Vertex! interface in a TinkerPop graph.2.org.apache.tinkerpop.gremlin.structure.Element! interface in a TinkerPop graph.3ID type of the 2B. This depends on graph database implementation and its settings.4Property type of the 2. It should be of , class. If you don't care, use  if type e is an 1 and use  if type e is an / or VertexProperty.5T.id token.6T.key token.7T.label token.8T.value token.9 Create a ( from a literal string.:Lookup a property value from a   by key.;(Lookup a list of property values from a   by key.<Lookup a property , by the given key, and parse it.=(Lookup a list of property values from a  # by the given key, and parse them.>Like =, but this function -0s when there is no property with the given key.? Create a   from list of ,s.AUnwrap ( constructor.BGremlin String literal as a (.C Unsafely convert the value type b.JParse Property of GraphSON 1.0.9  !"#$%&'()*+,-./0123456789:;<=>?92341/0,-.+5678()*9#$%&' !" :;<=>? ./+0  1 !"#$%&'()*,-./0234%Gremlin (Groovy/Java) utility classes Toshio Ito <debug.ito@gmail.com>NoneFTkC4org.apache.tinkerpop.gremlin.process.traversal.Order enum.Type for anonymous class of  Comparator interface.java.util.Comparator interface. compares two data of type  c..compare method..reverse method..thenComparing method.0org.apache.tinkerpop.gremlin.process.traversal.P class.P a keeps data of type a# and compares it with data of type a" given as the Predicate argument.Type for anonymous class of  Predicate interface.java.util.function.Predicate interface.A  p is a function that takes  p and returns 2..and method..or method..test method..nagate method.P.not static method."toGremlin $ pNot $ pEq $ number 10"P.not(P.eq(10.0))"P.eq static method.toGremlin $ pEq $ string "hoge""P.eq(\"hoge\")"P.neq static method.P.lt static method.P.lte static method.P.gt static method.P.gte static method.P.inside static method.+toGremlin $ pInside (number 10) (number 20)"P.inside(10.0,20.0)" P.outside static method. P.between static method.P.within static method.AtoGremlin $ pWithin (["foo", "bar", "hoge"] :: [Greskell String])$"P.within(\"foo\",\"bar\",\"hoge\")" P.without static method.decr order.toGremlin oDecr "Order.decr"incr order.shuffle order.Order a compares the type a.""Gremlin traversal/step types. Toshio Ito <debug.ito@gmail.com>None &';<=>?FT bComparison of type s used in .by step. You can also use  and  to construct .Type s is projected to type e2, and compared by the natural comparator of type e.Type s is compared by the  comp.Type s is projected to type CompareArg comp, and compared by the  comp.Projection from type s to type e used in .by step. You can also use  to construct .;Data types that mean a projection from one type to another.!The start type of the projection.The end type of the projection.GraphTraversalSource7 class object of TinkerPop. It is a factory object of s. Relation of s where the child walk c is split from the parent walk p.kWhen splitting, transformation effect done in the child walk is rolled back (canceled) in the parent walk. Relation of  s where one includes the other. from can be lifted to to , because to is more powerful than from..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.EFor example, the following steps (in Gremlin) all have side-effects. [.addE('label') .aggregate('x') .sideEffect(System.out.&println) .map { some_variable += 1 }WalkType for steps without any side-effects. This includes transformations, reordring, injections and graph traversal actions.A  w is  type iff: gSideEffect w == gIdentityObviously, every  type  s are also  type.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.A  w is  type iff: 1(gSideEffect w == gIdentity) AND (gFilter w == w)If s w1 and w2 are  type, then 'gAnd [w1, w2] == w1 >>> w2 == w2 >>> w1MClass of phantom type markers to describe the effect of the walk/traversals.+A chain of one or more Gremlin steps. Like , type s is the input, type e is the output, and type c# is a marker to describe the step.- represents a chain of method calls such as .has(x).outE()B. Because this is not a Gremlin (Groovy) expression, we use bare , not % . is a 3. You can use functions from Control.Category to compose Ds. This is equivalent to making a chain of method calls in Gremlin. is not an 4, because it's difficult to define true equality between Gremlin method calls. If we define it naively, it might have conflict with 3 law.Types that can convert to .Lift  from to to. Use this for type matching.Phantom type for GraphTraversal% class. In greskell, we usually use  instead of % .GraphTraversal* class object of TinkerPop. It takes data s from upstream and emits data e to downstream. Type cJ is called "walk type", a marker to describe the effect of the traversal. is NOT a 3 . Because a GraphTraversal; object keeps some context data, the starting (left-most) GraphTraversale object controls most of the behavior of entire composition of traversals and steps. This violates 3 law.Create  from a varible name in GremlintoGremlin $ source "g""g".V() method on .Monomorphic version of .AtoGremlin (source "g" & sV' (map (value . Aeson.Number) [1,2,3]))"g.V(1.0,2.0,3.0)".E() method on .Monomorphic version of .=toGremlin (source "g" & sE' (map (value . Aeson.Number) [1])) "g.E(1.0)"Unsafely create # from the given raw Gremlin script.,toGremlin $ unsafeGTraversal "g.V().count()""g.V().count()" Apply the  to the M. In Gremlin, this means calling a chain of methods on the Traversal object.2toGremlin (source "g" & sV' [] &. gValues ["age"])"g.V().values(\"age\")"Same as  with arguments flipped.2toGremlin (gValues ["age"] $. sV' [] $ source "g")"g.V().values(\"age\")"Unsafely create a , that represents a single method call on a GraphTraversal.KtoGremlin (source "g" & sV' [] &. unsafeWalk "valueMap" ["'foo'", "'bar'"])"g.V().valueMap('foo','bar')"Optionally modulate the main  with some modulating s.~toGremlin (source "g" & sV' [] &. modulateWith (unsafeWalk "path" []) [unsafeWalk "by" ["'name'"], unsafeWalk "by" ["'age'"]])#"g.V().path().by('name').by('age')" .identity step.Monomorphic version of ..filter step that takes a traversal.<toGremlin (source "g" & sV' [] &. gFilter (gOut' ["knows"]))!"g.V().filter(__.out(\"knows\"))".has step with one argument..toGremlin (source "g" & sV' [] &. gHas1 "age")"g.V().has(\"age\")"Monomorphic version of ..has step with two arguments.CtoGremlin (source "g" & sV' [] &. gHas2 "age" (31 :: Greskell Int))"g.V().has(\"age\",31)"Monomorphic verson of ..has step with two arguments and  type.RtoGremlin (source "g" & sV' [] &. gHas2P "age" (pBetween (30 :: Greskell Int) 40))%"g.V().has(\"age\",P.between(30,40))"Monomorphic version of . .hasLabel step.5toGremlin (source "g" & sV' [] &. gHasLabel "person")"g.V().hasLabel(\"person\")"Monomorphic version of . .hasLabel step with ' type. Supported since TinkerPop 3.2.7.<toGremlin (source "g" & sV' [] &. gHasLabelP (pEq "person"))""g.V().hasLabel(P.eq(\"person\"))"Monomorphic version of ..hasId step.BtoGremlin (source "g" & sV' [] &. gHasId (value $ Aeson.Number 7))"g.V().hasId(7.0)"Monomorphic version of ..hasId step with ' type. Supported since TinkerPop 3.2.7.LtoGremlin (source "g" & sV' [] &. gHasIdP (pLte $ value $ Aeson.Number 100))"g.V().hasId(P.lte(100.0))"Monomorphic version of ..hasKey1 step. The input type should be a VertexProperty.BtoGremlin (source "g" & sV' [] &. gProperties [] &. gHasKey "age")$"g.V().properties().hasKey(\"age\")"Monomorphic version of ..hasKey step with ' type. Supported since TinkerPop 3.2.7.Monomorphic version of . .hasValue1 step. The input type should be a VertexProperty.XtoGremlin (source "g" & sV' [] &. gProperties ["age"] &. gHasValue (32 :: Greskell Int))("g.V().properties(\"age\").hasValue(32)"Monomorphic version of . .hasValue step with ' type. Supported since TinkerPop 3.2.7.gtoGremlin (source "g" & sV' [] &. gProperties ["age"] &. gHasValueP (pBetween (30 :: Greskell Int) 40))6"g.V().properties(\"age\").hasValue(P.between(30,40))"Monomorphic version of ..and step.FtoGremlin (source "g" & sV' [] &. gAnd [gOut' ["knows"], gHas1 "age"])."g.V().and(__.out(\"knows\"),__.has(\"age\"))".or step.EtoGremlin (source "g" & sV' [] &. gOr [gOut' ["knows"], gHas1 "age"])-"g.V().or(__.out(\"knows\"),__.has(\"age\"))".not step.9toGremlin (source "g" & sV' [] &. gNot (gOut' ["knows"]))"g.V().not(__.out(\"knows\"))".range step. This step is not a |, because the filtering decision by this step is based on position of each element, not the element itself. This violates  law./toGremlin (source "g" & sV' [] &. gRange 0 100)"g.V().range(0,100)".by+ step with 1 argument, used for projection..by, step with 1 argumernt, used for comparison..by, step with 2 arguments, used for comparison..order step.(let key_age = ("age" :: Key AVertex Int)8toGremlin (source "g" & sV' [] &. gOrder [gBy1 key_age])"g.V().order().by(\"age\")"HtoGremlin (source "g" & sV' [] &. gOrder [gBy2 key_age oDecr, gBy1 tId])/"g.V().order().by(\"age\",Order.decr).by(T.id)"ctoGremlin (source "g" & sV' [] &. gOrder [gBy2 (gOut' ["knows"] >>> gCount) oIncr, gBy2 tId oIncr])L"g.V().order().by(__.out(\"knows\").count(),Order.incr).by(T.id,Order.incr)".flatMap step..flatMap step is a ! step even if the child walk is  type. This is because .flatMap1 step always modifies the path of the Traverser.StoGremlin (source "g" & sV' [] &. gFlatMap (gOut' ["knows"] >>> gOut' ["created"]))3"g.V().flatMap(__.out(\"knows\").out(\"created\"))".values step.:toGremlin (source "g" & sV' [] &. gValues ["name", "age"]) "g.V().values(\"name\",\"age\")" .properties step.6toGremlin (source "g" & sV' [] &. gProperties ["age"])"g.V().properties(\"age\")".fold step..count step..out stepMonomorphic version of .:toGremlin (source "g" & sV' ["person"] &. gOut' ["knows"]) "g.V(\"person\").out(\"knows\")".outE stepMonomorphic version of .in stepMonomorphic version of ..inE step.Monomorphic version of . .sideEffect step that takes a traversal.Monomorphic version of . The result walk is always  type.dtoGremlin (source "g" & sV' [] & liftWalk &. gHas2 "name" "marko" &. gSideEffect' (gAddV' "toshio"))?"g.V().has(\"name\",\"marko\").sideEffect(__.addV(\"toshio\"))".addV step with a label.Monomorphic version of ..drop step on 2.KtoGremlin (source "g" & sV' [] &. gHas2 "name" "marko" & liftWalk &. gDrop)&"g.V().has(\"name\",\"marko\").drop()".drop step on ,.NtoGremlin (source "g" & sE' [] &. gProperties ["weight"] & liftWalk &. gDropP)%"g.E().properties(\"weight\").drop()"(Unsafely convert input and output types.Unsafely convert output type.Unwrap  data constructor.(Unsafely convert input and output types.Unsafely convert output type.(Unsafely convert input and output types.Unsafely convert output type Based on 3 and 5. 6 is 7. Based on 3. * is 8.9 is .The  is first converted to , and it's converted to %. To convert a  to ), it calls its static method version on __ class.. in the child walk remains in the parent walk.= effect in the child walk is rolled back in the parent walk.#Projection by literal property key. by literal property key.variable name of  vertex IDsedge IDs: method nameargsstep method name (e.g. "outE")step method arguments the main the modulating s property key property keypredicate on the property valuepredicate on Element label.&predicate on the VertexProperty's key.'predicate on the VertexProperty's value; method nameminmax following .by steps. property keys edge labels edge labels edge labels edge labels edge labelsVV<=>100Haskell binding for Gremlin graph query language Toshio Ito <debug.ito@gmail.com>None?@ABCDEFGHIJK%LMNOPQRSTUVWX  !"#$%&'()*+,-./0123456789:;<=>?Y      !"#$%&&'()**+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-.(/0 +1234(56278()9(/:(5;(5<(/;=>"#?"#@"#A"#B"#C"#D"#E"#F"#G"#H"#I"#J"#K"#L"#M"#N"OP"OQ"OR"OS"OT"OT"OU"OV"OW"OXY'greskell-0.1.1.0-7ieVQpea4huBC0oPp5iDJlData.Greskell.BinderData.Greskell.GraphData.Greskell.GremlinData.Greskell.GTraversal Data.GreskellBindingBindernewBind runBinder$fFunctorBinder$fApplicativeBinder $fMonadBinderPropertyMapListPropertyMapSingle PropertyMap lookupOne lookupList putPropertyremoveProperty allPropertiesAVertexPropertyavpIdavpLabelavpValue avpProperties APropertyapKeyapValueFromJSONWithKeyAEdgeaeIdaeLabel aeInVLabel aeOutVLabelaeInVaeOutV aePropertiesAVertexavIdavLabel avPropertiesKeyunKeyTProperty propertyKey propertyValueEdge EdgeVertexIDVertexElement ElementIDElementPropertytIdtKeytLabeltValuekeylookupOneValuelookupListValues parseOneValueparseListValuesparseNonEmptyValuesfromProperties$fGraphSONTypedT$fToGreskellKey $fIsStringKey $fFunctorKey$fTraversableAProperty$fFoldableAProperty$fFunctorAProperty$fGraphSONTypedAProperty$fPropertyAProperty$fFromJSONWithKeyAProperty$fFromJSONAProperty$fTraversablePropertyMapGeneric$fFoldablePropertyMapGeneric$fFunctorPropertyMapGeneric$fMonoidPropertyMapGeneric$fSemigroupPropertyMapGeneric$fFromJSONPropertyMapSingle$fPropertyMapPropertyMapSingle$fTraversableAVertexProperty$fFoldableAVertexProperty$fFunctorAVertexProperty$fPropertyAVertexProperty$fElementAVertexProperty$fGraphSONTypedAVertexProperty $fFromJSONWithKeyAVertexProperty$fFromJSONAVertexProperty$fFromJSONAEdge$fGraphSONTypedAEdge $fEdgeAEdge$fElementAEdge$fFromJSONPropertyMapList$fPropertyMapPropertyMapList$fFromJSONAVertex$fGraphSONTypedAVertex$fVertexAVertex$fElementAVertex $fShowKey$fEqKey$fShowAProperty $fEqAProperty$fOrdAProperty$fShowPropertyMapGeneric$fEqPropertyMapGeneric$fShowPropertyMapSingle$fEqPropertyMapSingle$fSemigroupPropertyMapSingle$fMonoidPropertyMapSingle$fFunctorPropertyMapSingle$fFoldablePropertyMapSingle$fTraversablePropertyMapSingle$fShowAVertexProperty$fEqAVertexProperty $fShowAEdge $fEqAEdge$fShowPropertyMapList$fEqPropertyMapList$fSemigroupPropertyMapList$fMonoidPropertyMapList$fFunctorPropertyMapList$fFoldablePropertyMapList$fTraversablePropertyMapList $fShowAVertex $fEqAVertexOrder ComparatorA unComparatorA Comparator CompareArgcCompare cReversedcThenComparingP PredicateA unPredicateA Predicate PredicateArgpAndpOrpTestpNegatepNotpEqpNeqpLtpLtepGtpGtepInsidepOutsidepBetweenpWithinpWithoutoDecroIncroShuffle$fPredicatePredicateA$fGraphSONTypedP $fPredicateP$fComparatorComparatorA$fGraphSONTypedOrder$fComparatorOrder ByComparatorByComparatorProjByComparatorCompByComparatorProjComp ByProjectionProjectionLikeProjectionLikeStartProjectionLikeEndGraphTraversalSourceSplitLift SideEffect TransformFilterWalkTypeWalk ToGTraversal toGTraversalliftWalkGraphTraversal GTraversal unGTraversalsourcesVsV'sEsE'unsafeGTraversal&.$. unsafeWalk modulateWith gIdentity gIdentity'gFiltergHas1gHas1'gHas2gHas2'gHas2PgHas2P' gHasLabel gHasLabel' gHasLabelP gHasLabelP'gHasIdgHasId'gHasIdPgHasIdP'gHasKeygHasKey'gHasKeyP gHasKeyP' gHasValue gHasValue' gHasValueP gHasValueP'gAndgOrgNotgRangegBygBy1gBy2gOrdergFlatMapgValues gPropertiesgFoldgCountgOutgOut'gOutEgOutE'gIngIn'gInEgInE' gSideEffect gSideEffect'gAddVgAddV'gDropgDropP$fBifunctorGraphTraversal$fFunctorGraphTraversal$fToGreskellGTraversal$fBifunctorGTraversal$fFunctorGTraversal$fBifunctorWalk $fFunctorWalk $fMonoidWalk$fSemigroupWalk$fCategoryTYPEWalk$fWalkTypeFilter$fWalkTypeTransform$fWalkTypeSideEffect$fLiftSideEffectSideEffect$fLiftTransformSideEffect$fLiftTransformTransform $fLiftFilterc$fToGreskellWalk$fToGTraversalWalk$fToGTraversalGTraversal$fSplitSideEffectSideEffect$fSplitTransformp$fSplitFilterp$fProjectionLikeGreskell$fProjectionLikeGreskell0$fProjectionLikeKey$fProjectionLikeGreskell1$fProjectionLikeGTraversal$fProjectionLikeWalk$fProjectionLikeGreskell2$fProjectionLikeGTraversal0$fProjectionLikeWalk0$fIsStringByProjection$fProjectionLikeByProjection$fIsStringByComparator$fShowGraphTraversal$fShowGTraversal $fShowWalk$fShowGraphTraversalSourcePlaceHolderIndex+greskell-core-0.1.1.0-rprbs9YgwI4ZHqA7asFvRData.Greskell.GreskellGreskellunsafePlaceHoldertoPlaceHolderVariableunBinderbaseData.Semigroup<>PropertyMapGeneric$aeson-1.2.4.0-1zctWaeLSQREbMpEicx0A8Data.Aeson.Types.InternalValueGHC.BasefailparseJSONWithKeyghc-prim GHC.TypesBoolControl.CategoryCategory GHC.ClassesEq Semigroupmemptyid>>>methodCallText multiLogicunsafeMethodCall unsafeFunCall toGremlinLazy toGremlinvaluenumbersinglelistfalsetruestringunsafeGreskellLazyunsafeGreskell ToGreskellGreskellReturn toGreskellData.Greskell.GraphSONparseTypedGraphSONtypedGraphSON' typedGraphSONnonTypedGraphSONGraphSONgsonType gsonValue GraphSONTyped gsonTypeFor