diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/translator/GolangTranslator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/translator/GolangTranslator.java index b1ba52d3e70..87722027d9c 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/translator/GolangTranslator.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/translator/GolangTranslator.java @@ -27,6 +27,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Pick; import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions; import org.apache.tinkerpop.gremlin.process.traversal.Script; +import org.apache.tinkerpop.gremlin.process.traversal.Text; import org.apache.tinkerpop.gremlin.process.traversal.TextP; import org.apache.tinkerpop.gremlin.process.traversal.Translator; import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy; @@ -36,6 +37,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.apache.tinkerpop.gremlin.structure.util.StringFactory; +import org.apache.tinkerpop.gremlin.util.NumberHelper; import org.apache.tinkerpop.gremlin.util.function.Lambda; import java.sql.Timestamp; @@ -48,6 +50,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +import java.util.function.BiPredicate; /** * Translates Gremlin {@link Bytecode} into a Golang string representation. @@ -158,7 +161,15 @@ protected String getSyntax(final Lambda o) { @Override protected String getSyntax(final Number o) { - return o.toString(); + if (o instanceof Float || o instanceof Double) { + if (NumberHelper.isNaN(o)) + return "math.NaN()"; + else if (NumberHelper.isPositiveInfinity(o)) + return "math.Inf(1)"; + else if (NumberHelper.isNegativeInfinity(o)) + return "math.Inf(-11)"; + } + return o.toString(); } @Override @@ -293,8 +304,19 @@ protected Script produceScript(final String traversalSource, final Bytecode o) { @Override protected Script produceScript(final P p) { + if (p instanceof TextP) { - script.append(GO_PACKAGE_NAME + "TextP.").append(resolveSymbol(p.getBiPredicate().toString())).append("("); + // special case the RegexPredicate since it isn't an enum. toString() for the final default will + // typically cover implementations (generally worked for Text prior to 3.6.0) + final BiPredicate tp = p.getBiPredicate(); + if (tp instanceof Text.RegexPredicate) { + final String regexToken = ((Text.RegexPredicate) p.getBiPredicate()).isNegate() ? "NotRegex" : "Regex"; + script.append(GO_PACKAGE_NAME + "TextP.").append(regexToken).append("("); + } else if (tp instanceof Text) { + script.append(GO_PACKAGE_NAME + "TextP.").append(resolveSymbol(p.getBiPredicate().toString())).append("("); + } else { + script.append(GO_PACKAGE_NAME + "TextP.").append(resolveSymbol(p.getBiPredicate().toString())).append("("); + } convertToScript(p.getValue()); } else if (p instanceof ConnectiveP) { // ConnectiveP gets some special handling because it's reduced to and(P, P, P) and we want it diff --git a/gremlin-go/build/generate.groovy b/gremlin-go/build/generate.groovy index 714a04a0455..2bb7b300f4e 100644 --- a/gremlin-go/build/generate.groovy +++ b/gremlin-go/build/generate.groovy @@ -92,6 +92,7 @@ radishGremlinFile.withWriter('UTF-8') { Writer writer -> '\n' + 'import (\n' + '\t \"errors\"\n' + + '\t \"math\"\n' + '\t \"github.com/apache/tinkerpop/gremlin-go/driver\"\n' + ')\n' ) @@ -129,27 +130,11 @@ radishGremlinFile.withWriter('UTF-8') { Writer writer -> writer.write("func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return ") try { writer.write(translator.translate(t.bytecode).script. - replace("xx1", "p[\"xx1\"]"). - replace("xx2", "p[\"xx2\"]"). - replace("xx3", "p[\"xx3\"]"). - replace("v1", "p[\"v1\"]"). - replace("v2", "p[\"v2\"]"). - replace("v3", "p[\"v3\"]"). - replace("v4", "p[\"v4\"]"). - replace("v5", "p[\"v5\"]"). - replace("v6", "p[\"v6\"]"). - replace("vid1", "p[\"vid1\"]"). - replace("vid2", "p[\"vid2\"]"). - replace("vid3", "p[\"vid3\"]"). - replace("vid4", "p[\"vid4\"]"). - replace("vid5", "p[\"vid5\"]"). - replace("vid6", "p[\"vid6\"]"). - replace("e7", "p[\"e7\"]"). - replace("e10", "p[\"e10\"]"). - replace("e11", "p[\"e11\"]"). - replace("eid7", "p[\"eid7\"]"). - replace("eid10", "p[\"eid10\"]"). - replace("eid11", "p[\"eid11\"]"). + replaceAll("xx([0-9]+)", "p[\"xx\$1\"]"). + replaceAll("v([0-9]+)", "p[\"v\$1\"]"). + replaceAll("vid([0-9]+)", "p[\"vid\$1\"]"). + replaceAll("e([0-9]+)", "p[\"e\$1\"]"). + replaceAll("eid([0-9]+)", "p[\"eid\$1\"]"). replace("l1", "p[\"l1\"]"). replace("l2", "p[\"l2\"]"). replace("pred1", "p[\"pred1\"]"). diff --git a/gremlin-go/cucumber/featureSteps_test.go b/gremlin-go/cucumber/featureSteps_test.go index 82ed18f8c3e..b1aacc240aa 100644 --- a/gremlin-go/cucumber/featureSteps_test.go +++ b/gremlin-go/cucumber/featureSteps_test.go @@ -26,6 +26,7 @@ import ( "fmt" "github.com/apache/tinkerpop/gremlin-go/driver" "github.com/cucumber/godog" + "math" "reflect" "regexp" "strconv" @@ -41,30 +42,47 @@ var parsers map[*regexp.Regexp]func(string, string) interface{} func init() { parsers = map[*regexp.Regexp]func(string, string) interface{}{ - regexp.MustCompile(`^d\[(.*)]\.[lfdm]$`): toNumeric, - regexp.MustCompile(`^d\[(.*)]\.[i]$`): toInt32, - regexp.MustCompile(`^v\[(.+)]$`): toVertex, - regexp.MustCompile(`^v\[(.+)]\.id$`): toVertexId, - regexp.MustCompile(`^e\[(.+)]$`): toEdge, - regexp.MustCompile(`^v\[(.+)]\.sid$`): toVertexIdString, - regexp.MustCompile(`^e\[(.+)]\.id$`): toEdgeId, - regexp.MustCompile(`^e\[(.+)]\.sid$`): toEdgeIdString, - regexp.MustCompile(`^p\[(.+)]$`): toPath, - regexp.MustCompile(`^l\[(.*)]$`): toList, - regexp.MustCompile(`^s\[(.*)]$`): toSet, - regexp.MustCompile(`^m\[(.+)]$`): toMap, - regexp.MustCompile(`^c\[(.+)]$`): toLambda, - regexp.MustCompile(`^t\[(.+)]$`): toT, - regexp.MustCompile(`^D\[(.+)]$`): toDirection, + regexp.MustCompile(`^d\[(.*)]\.[bslfdmn]$`): toNumeric, + regexp.MustCompile(`^d\[(.*)]\.[i]$`): toInt32, + regexp.MustCompile(`^vp\[(.+)]$`): toVertexProperty, + regexp.MustCompile(`^v\[(.+)]$`): toVertex, + regexp.MustCompile(`^v\[(.+)]\.id$`): toVertexId, + regexp.MustCompile(`^e\[(.+)]$`): toEdge, + regexp.MustCompile(`^v\[(.+)]\.sid$`): toVertexIdString, + regexp.MustCompile(`^e\[(.+)]\.id$`): toEdgeId, + regexp.MustCompile(`^e\[(.+)]\.sid$`): toEdgeIdString, + regexp.MustCompile(`^p\[(.+)]$`): toPath, + regexp.MustCompile(`^l\[(.*)]$`): toList, + regexp.MustCompile(`^s\[(.*)]$`): toSet, + regexp.MustCompile(`^m\[(.+)]$`): toMap, + regexp.MustCompile(`^c\[(.+)]$`): toLambda, + regexp.MustCompile(`^t\[(.+)]$`): toT, + regexp.MustCompile(`^D\[(.+)]$`): toDirection, } } func parseValue(value string, graphName string) interface{} { + var extractedValue string + var parser func(string, string) interface{} if regexp.MustCompile(`^null$`).MatchString(value) { return nil } - var extractedValue string - var parser func(string, string) interface{} + if regexp.MustCompile(`^true$`).MatchString(value) { + return true + } + if regexp.MustCompile(`^false$`).MatchString(value) { + return false + } + if regexp.MustCompile(`^d\[NaN]$`).MatchString(value) { + return math.NaN() + } + if regexp.MustCompile(`^d\[Infinity]$`).MatchString(value) { + return math.Inf(1) + } + if regexp.MustCompile(`^d\[-Infinity]$`).MatchString(value) { + return math.Inf(-1) + } + for key, element := range parsers { var match = key.FindAllStringSubmatch(value, -1) if len(match) > 0 { @@ -105,9 +123,24 @@ func toInt32(stringVal, graphName string) interface{} { return int32(val) } +// Parse vertex property. +func toVertexProperty(name, graphName string) interface{} { + if vp, ok := tg.getDataGraphFromMap(graphName).vertexProperties[name]; ok { + return vp + } else { + return fmt.Errorf("VertexProperty with key %s not found", name) + } +} + // Parse vertex. func toVertex(name, graphName string) interface{} { - return tg.getDataGraphFromMap(graphName).vertices[name] + if v, ok := tg.getDataGraphFromMap(graphName).vertices[name]; ok { + return v + } else { + return &gremlingo.Vertex{ + Element: gremlingo.Element{Id: name, Label: "vertex"}, + } + } } // Parse vertex id. @@ -128,7 +161,11 @@ func toVertexIdString(name, graphName string) interface{} { // Parse edge. func toEdge(name, graphName string) interface{} { - return tg.getDataGraphFromMap(graphName).edges[name] + if e, ok := tg.getDataGraphFromMap(graphName).edges[name]; ok { + return e + } else { + return fmt.Errorf("edge with key %s not found", name) + } } // Parse edge id. @@ -240,12 +277,34 @@ func toLambda(name, graphName string) interface{} { func toT(name, graphName string) interface{} { // Return as is, since T values are just strings. - return name + if name == "label" { + return gremlingo.Label + } else if name == "id" { + return gremlingo.Id + } else if name == "key" { + return gremlingo.Key + } else if name == "value" { + return gremlingo.Value + } else { + return name + } } func toDirection(name, graphName string) interface{} { // Return as is, since Direction values are just strings. - return name + if name == "IN" { + return gremlingo.In + } else if name == "OUT" { + return gremlingo.Out + } else if name == "BOTH" { + return gremlingo.Both + } else if name == "from" { + return gremlingo.From + } else if name == "to" { + return gremlingo.To + } else { + return name + } } func (tg *tinkerPopGraph) anUnsupportedTest() error { @@ -259,7 +318,8 @@ func (tg *tinkerPopGraph) iteratedNext() error { } result, err := tg.traversal.Next() if err != nil { - return err + tg.error[true] = err.Error() + return nil } var nextResults []interface{} switch result.GetType().Kind() { @@ -288,7 +348,8 @@ func (tg *tinkerPopGraph) iteratedToList() error { } results, err := tg.traversal.ToList() if err != nil { - return err + tg.error[true] = err.Error() + return nil } var listResults []interface{} for _, res := range results { @@ -313,6 +374,18 @@ func (tg *tinkerPopGraph) chooseGraph(graphName string) error { return err } } + + // TODO: Uncoment code here to use WithComputer once this is implemented. + // In this version strategies are not implemented (and therefore WithComputer also isn't implmented). + for _, tag := range tg.scenario.Tags { + if tag.Name == "@GraphComputerOnly" { + return godog.ErrPending + // tg.g.WithComputer() + } else if tag.Name == "@AllowNullPropertyValues" { + // The GLV suite does not test against a graph that has null property values enabled, skipping via Pending Error + return godog.ErrPending + } + } return nil } @@ -361,7 +434,7 @@ func (tg *tinkerPopGraph) theGraphShouldReturnForCountOf(expectedCount int, trav return err } if len(results) != expectedCount { - return errors.New("graph did not return the correct count") + return errors.New(fmt.Sprintf("graph returned count of %d when %d was expected", len(results), expectedCount)) } return nil } @@ -544,6 +617,11 @@ func compareListEqualsWithoutOrder(expected []interface{}, actual []interface{}) // 2. Create a new slice with the index removed when we fix the item we want to delete. // To do an orderless copy, a copy of the expected result is created. Results are removed as they are found. This stops // the following from returning equal [1 2 2 2] and [1 1 1 2] + + // Shortcut. + if fmt.Sprint(expected) == fmt.Sprint(actual) { + return true + } expectedCopy := make([]interface{}, len(expected)) copy(expectedCopy, expected) for _, a := range actual { @@ -694,6 +772,41 @@ func (tg *tinkerPopGraph) usingTheParameterOfP(paramName, pVal, stringVal string return nil } +func (tg *tinkerPopGraph) theTraversalWillRaiseAnError() error { + if _, ok := tg.error[true]; ok { + return nil + } + return fmt.Errorf("expected the traversal to raise an error") +} + +func (tg *tinkerPopGraph) theTraversalWillRaiseAnErrorWithMessageContainingTextOf(comparison, expectedMessage string) error { + if _, ok := tg.error[true]; !ok { + return fmt.Errorf("expected the traversal to raise an error") + } + switch comparison { + case "containing": + if strings.Contains(tg.error[true], expectedMessage) { + return nil + } else { + return fmt.Errorf("traversal error message must contain %s", expectedMessage) + } + case "starting": + if strings.Contains(tg.error[true], expectedMessage) { + return nil + } else { + return fmt.Errorf("traversal error message must contain %s", expectedMessage) + } + case "ending": + if strings.Contains(tg.error[true], expectedMessage) { + return nil + } else { + return fmt.Errorf("traversal error message must contain %s", expectedMessage) + } + default: + return fmt.Errorf("unknow comparison %s - must be: containing, ending or starting", comparison) + } +} + var tg = &tinkerPopGraph{ NewTinkerPopWorld(), } @@ -732,4 +845,6 @@ func InitializeScenario(ctx *godog.ScenarioContext) { ctx.Step(`^the traversal of$`, tg.theTraversalOf) ctx.Step(`^using the parameter (.+) defined as "(.+)"$`, tg.usingTheParameterDefined) ctx.Step(`^using the parameter (.+) of P\.(.+)\("(.+)"\)$`, tg.usingTheParameterOfP) + ctx.Step(`^the traversal will raise an error$`, tg.theTraversalWillRaiseAnError) + ctx.Step(`^the traversal will raise an error with message (\w+) text of "(.+)"$`, tg.theTraversalWillRaiseAnErrorWithMessageContainingTextOf) } diff --git a/gremlin-go/cucumber/gremlin.go b/gremlin-go/cucumber/gremlin.go index b10d430d8c6..fba380833b0 100644 --- a/gremlin-go/cucumber/gremlin.go +++ b/gremlin-go/cucumber/gremlin.go @@ -26,6 +26,7 @@ package gremlingo import ( "errors" + "math" "github.com/apache/tinkerpop/gremlin-go/driver" ) @@ -186,10 +187,10 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[ "g_V_hasXname_not_containingXarkXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.NotContaining("ark"))}}, "g_V_hasXname_not_startingWithXmarXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.NotStartingWith("mar"))}}, "g_V_hasXname_not_endingWithXasXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.NotEndingWith("as"))}}, - "g_V_hasXname_regexXrMarXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.Regex(^mar)("^mar"))}}, - "g_V_hasXname_notRegexXrMarXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.Regex(^mar)("^mar"))}}, - "g_V_hasXname_regexXTinkerXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("software").Property("name", "Apache TinkerPop\u00A9")}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.Regex(Tinker)("Tinker")).Values("name")}}, - "g_V_hasXname_regexXTinkerUnicodeXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("software").Property("name", "Apache TinkerPop\u00A9")}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.Regex(Tinker.*©)("Tinker.*\u00A9")).Values("name")}}, + "g_V_hasXname_regexXrMarXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.Regex("^mar"))}}, + "g_V_hasXname_notRegexXrMarXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.NotRegex("^mar"))}}, + "g_V_hasXname_regexXTinkerXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("software").Property("name", "Apache TinkerPop\u00A9")}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.Regex("Tinker")).Values("name")}}, + "g_V_hasXname_regexXTinkerUnicodeXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("software").Property("name", "Apache TinkerPop\u00A9")}, func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", gremlingo.TextP.Regex("Tinker.*\u00A9")).Values("name")}}, "g_V_hasXp_neqXvXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("p", gremlingo.P.Neq("v"))}}, "g_V_hasXage_gtX18X_andXltX30XXorXgtx35XXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("age", gremlingo.P.Gt(18).And(gremlingo.P.Lt(30)).Or(gremlingo.P.Gt(35)))}}, "g_V_hasXage_gtX18X_andXltX30XXorXltx35XXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("age", gremlingo.P.Gt(18).And(gremlingo.P.Lt(30)).And(gremlingo.P.Lt(35)))}}, @@ -885,24 +886,24 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[ "InjectXnullX_lteXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(nil).Is(gremlingo.P.Lte(nil))}}, "InjectXnullX_gtXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(nil).Is(gremlingo.P.Gt(nil))}}, "InjectXnullX_gteXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(nil).Is(gremlingo.P.Gte(nil))}}, - "InjectXNaNX_eqXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Eq(NaN))}}, - "InjectXNaNX_neqXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Neq(NaN))}}, - "InjectXNaNX_ltXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Lt(NaN))}}, - "InjectXNaNX_lteXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Lte(NaN))}}, - "InjectXNaNX_gtXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Gt(NaN))}}, - "InjectXNaNX_gteXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Gte(NaN))}}, - "InjectX1dX_eqXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(NaN))}}, - "InjectX1dX_neqXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(NaN))}}, - "InjectX1dX_ltXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(NaN))}}, - "InjectX1dX_lteXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lte(NaN))}}, - "InjectX1dX_gtXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Gt(NaN))}}, - "InjectX1dX_gteXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Gte(NaN))}}, - "InjectXNaNX_eqXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(NaN).Is(gremlingo.P.Eq(nil))}}, - "InjectXNaNX_neqXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(NaN).Is(gremlingo.P.Neq(nil))}}, - "InjectXNaNX_ltXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(NaN).Is(gremlingo.P.Lt(nil))}}, - "InjectXNaNX_lteXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(NaN).Is(gremlingo.P.Lte(nil))}}, - "InjectXNaNX_gtXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(NaN).Is(gremlingo.P.Gt(nil))}}, - "InjectXNaNX_gteXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(NaN).Is(gremlingo.P.Gte(nil))}}, + "InjectXNaNX_eqXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Eq(math.NaN()))}}, + "InjectXNaNX_neqXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Neq(math.NaN()))}}, + "InjectXNaNX_ltXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Lt(math.NaN()))}}, + "InjectXNaNX_lteXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Lte(math.NaN()))}}, + "InjectXNaNX_gtXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Gt(math.NaN()))}}, + "InjectXNaNX_gteXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Gte(math.NaN()))}}, + "InjectX1dX_eqXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(math.NaN()))}}, + "InjectX1dX_neqXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(math.NaN()))}}, + "InjectX1dX_ltXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(math.NaN()))}}, + "InjectX1dX_lteXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lte(math.NaN()))}}, + "InjectX1dX_gtXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Gt(math.NaN()))}}, + "InjectX1dX_gteXNaNX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Gte(math.NaN()))}}, + "InjectXNaNX_eqXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.NaN()).Is(gremlingo.P.Eq(nil))}}, + "InjectXNaNX_neqXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.NaN()).Is(gremlingo.P.Neq(nil))}}, + "InjectXNaNX_ltXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.NaN()).Is(gremlingo.P.Lt(nil))}}, + "InjectXNaNX_lteXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.NaN()).Is(gremlingo.P.Lte(nil))}}, + "InjectXNaNX_gtXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.NaN()).Is(gremlingo.P.Gt(nil))}}, + "InjectXNaNX_gteXnullX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.NaN()).Is(gremlingo.P.Gte(nil))}}, "InjectXfooX_eqX1dX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("foo").Is(gremlingo.P.Eq(1.0))}}, "InjectXfooX_neqX1dX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("foo").Is(gremlingo.P.Neq(1.0))}}, "InjectXfooX_ltX1dX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject("foo").Is(gremlingo.P.Lt(1.0))}}, @@ -919,54 +920,54 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[ "InjectX1dX_isXtrue_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(1).And(gremlingo.P.Gt(0)))}}, "InjectX1dX_andXtrue_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Eq(1)), gremlingo.T__.Is(gremlingo.P.Lt(0)))}}, "InjectX1dX_isXtrue_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(1).And(gremlingo.P.Lt(0)))}}, - "InjectX1dX_andXtrue_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Eq(1)), gremlingo.T__.Is(gremlingo.P.Lt(NaN)))}}, - "InjectX1dX_isXtrue_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(1).And(gremlingo.P.Lt(NaN)))}}, + "InjectX1dX_andXtrue_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Eq(1)), gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())))}}, + "InjectX1dX_isXtrue_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(1).And(gremlingo.P.Lt(math.NaN())))}}, "InjectX1dX_andXfalse_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Neq(1)), gremlingo.T__.Is(gremlingo.P.Gt(0)))}}, "InjectX1dX_isXfalse_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(1).And(gremlingo.P.Gt(0)))}}, "InjectX1dX_andXfalse_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Neq(1)), gremlingo.T__.Is(gremlingo.P.Lt(0)))}}, "InjectX1dX_isXfalse_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(1).And(gremlingo.P.Lt(0)))}}, - "InjectX1dX_andXfalse_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Neq(1)), gremlingo.T__.Is(gremlingo.P.Lt(NaN)))}}, - "InjectX1dX_isXfalse_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(1).And(gremlingo.P.Lt(NaN)))}}, - "InjectX1dX_andXerror_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Lt(NaN)), gremlingo.T__.Is(gremlingo.P.Gt(0)))}}, - "InjectX1dX_isXerror_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(NaN).And(gremlingo.P.Gt(0)))}}, - "InjectX1dX_andXerror_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Lt(NaN)), gremlingo.T__.Is(gremlingo.P.Gt(2)))}}, - "InjectX1dX_isXerror_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(NaN).And(gremlingo.P.Gt(2)))}}, - "InjectX1dX_andXerror_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Lt(NaN)), gremlingo.T__.Is(gremlingo.P.Gt(NaN)))}}, - "InjectX1dX_isXerror_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(NaN).And(gremlingo.P.Gt(NaN)))}}, + "InjectX1dX_andXfalse_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Neq(1)), gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())))}}, + "InjectX1dX_isXfalse_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(1).And(gremlingo.P.Lt(math.NaN())))}}, + "InjectX1dX_andXerror_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())), gremlingo.T__.Is(gremlingo.P.Gt(0)))}}, + "InjectX1dX_isXerror_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(math.NaN()).And(gremlingo.P.Gt(0)))}}, + "InjectX1dX_andXerror_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())), gremlingo.T__.Is(gremlingo.P.Gt(2)))}}, + "InjectX1dX_isXerror_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(math.NaN()).And(gremlingo.P.Gt(2)))}}, + "InjectX1dX_andXerror_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).And(gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())), gremlingo.T__.Is(gremlingo.P.Gt(math.NaN())))}}, + "InjectX1dX_isXerror_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(math.NaN()).And(gremlingo.P.Gt(math.NaN())))}}, "InjectX1dX_orXtrue_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Eq(1)), gremlingo.T__.Is(gremlingo.P.Gt(0)))}}, "InjectX1dX_isXtrue_or_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(1).Or(gremlingo.P.Gt(0)))}}, "InjectX1dX_orXtrue_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Eq(1)), gremlingo.T__.Is(gremlingo.P.Lt(0)))}}, "InjectX1dX_isXtrue_or_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(1).Or(gremlingo.P.Lt(0)))}}, - "InjectX1dX_orXtrue_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Eq(1)), gremlingo.T__.Is(gremlingo.P.Lt(NaN)))}}, - "InjectX1dX_isXtrue_or_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(1).Or(gremlingo.P.Lt(NaN)))}}, + "InjectX1dX_orXtrue_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Eq(1)), gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())))}}, + "InjectX1dX_isXtrue_or_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Eq(1).Or(gremlingo.P.Lt(math.NaN())))}}, "InjectX1dX_orXfalse_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Neq(1)), gremlingo.T__.Is(gremlingo.P.Gt(0)))}}, "InjectX1dX_isXfalse_or_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(1).Or(gremlingo.P.Gt(0)))}}, "InjectX1dX_orXfalse_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Neq(1)), gremlingo.T__.Is(gremlingo.P.Lt(0)))}}, "InjectX1dX_isXfalse_or_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(1).Or(gremlingo.P.Lt(0)))}}, - "InjectX1dX_orXfalse_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Neq(1)), gremlingo.T__.Is(gremlingo.P.Lt(NaN)))}}, - "InjectX1dX_isXfalse_or_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(1).Or(gremlingo.P.Lt(NaN)))}}, - "InjectX1dX_orXerror_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Lt(NaN)), gremlingo.T__.Is(gremlingo.P.Gt(0)))}}, - "InjectX1dX_isXerror_or_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(NaN).Or(gremlingo.P.Gt(0)))}}, - "InjectX1dX_orXerror_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Lt(NaN)), gremlingo.T__.Is(gremlingo.P.Gt(2)))}}, - "InjectX1dX_isXerror_or_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(NaN).Or(gremlingo.P.Gt(2)))}}, - "InjectX1dX_orXerror_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Lt(NaN)), gremlingo.T__.Is(gremlingo.P.Gt(NaN)))}}, - "InjectX1dX_isXerror_or_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(NaN).Or(gremlingo.P.Gt(NaN)))}}, + "InjectX1dX_orXfalse_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Neq(1)), gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())))}}, + "InjectX1dX_isXfalse_or_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Neq(1).Or(gremlingo.P.Lt(math.NaN())))}}, + "InjectX1dX_orXerror_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())), gremlingo.T__.Is(gremlingo.P.Gt(0)))}}, + "InjectX1dX_isXerror_or_trueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(math.NaN()).Or(gremlingo.P.Gt(0)))}}, + "InjectX1dX_orXerror_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())), gremlingo.T__.Is(gremlingo.P.Gt(2)))}}, + "InjectX1dX_isXerror_or_falseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(math.NaN()).Or(gremlingo.P.Gt(2)))}}, + "InjectX1dX_orXerror_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Or(gremlingo.T__.Is(gremlingo.P.Lt(math.NaN())), gremlingo.T__.Is(gremlingo.P.Gt(math.NaN())))}}, + "InjectX1dX_isXerror_or_errorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Is(gremlingo.P.Lt(math.NaN()).Or(gremlingo.P.Gt(math.NaN())))}}, "InjectX1dX_notXtrueX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Not(gremlingo.T__.Is(gremlingo.P.Gt(0)))}}, "InjectX1dX_notXfalseX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Not(gremlingo.T__.Is(gremlingo.P.Lt(0)))}}, - "InjectX1dX_notXerrorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Not(gremlingo.T__.Is(gremlingo.P.Gt(NaN)))}}, - "InjectX1dX_notXisXeqXNaNXXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Not(gremlingo.T__.Is(gremlingo.P.Eq(NaN)))}}, - "InjectXInfX_eqXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(Infinity).Is(gremlingo.P.Eq(Infinity))}}, - "InjectXInfArgX_eqXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Eq(Infinity))}}, - "InjectXInfX_neqXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(Infinity).Is(gremlingo.P.Neq(Infinity))}}, - "InjectXInfArgX_neqXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Neq(Infinity))}}, - "InjectXNegInfX_eqXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(-Infinity).Is(gremlingo.P.Eq(-Infinity))}}, - "InjectXNegInfArgX_eqXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Eq(-Infinity))}}, - "InjectXNegInfX_neqXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(-Infinity).Is(gremlingo.P.Neq(-Infinity))}}, - "InjectXNegInfArgX_neqXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Neq(-Infinity))}}, - "InjectXInfX_gtXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(Infinity).Is(gremlingo.P.Gt(-Infinity))}}, - "InjectXInfX_ltXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(Infinity).Is(gremlingo.P.Lt(-Infinity))}}, - "InjectXNegInfX_ltXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(-Infinity).Is(gremlingo.P.Lt(Infinity))}}, - "InjectXNegInfX_gtXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(-Infinity).Is(gremlingo.P.Gt(Infinity))}}, + "InjectX1dX_notXerrorX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Not(gremlingo.T__.Is(gremlingo.P.Gt(math.NaN())))}}, + "InjectX1dX_notXisXeqXNaNXXX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(1.0).Not(gremlingo.T__.Is(gremlingo.P.Eq(math.NaN())))}}, + "InjectXInfX_eqXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.Inf(1)).Is(gremlingo.P.Eq(math.Inf(1)))}}, + "InjectXInfArgX_eqXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Eq(math.Inf(1)))}}, + "InjectXInfX_neqXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.Inf(1)).Is(gremlingo.P.Neq(math.Inf(1)))}}, + "InjectXInfArgX_neqXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Neq(math.Inf(1)))}}, + "InjectXNegInfX_eqXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.Inf(-11)).Is(gremlingo.P.Eq(math.Inf(-11)))}}, + "InjectXNegInfArgX_eqXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Eq(math.Inf(-11)))}}, + "InjectXNegInfX_neqXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.Inf(-11)).Is(gremlingo.P.Neq(math.Inf(-11)))}}, + "InjectXNegInfArgX_neqXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Is(gremlingo.P.Neq(math.Inf(-11)))}}, + "InjectXInfX_gtXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.Inf(1)).Is(gremlingo.P.Gt(math.Inf(-11)))}}, + "InjectXInfX_ltXNegInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.Inf(1)).Is(gremlingo.P.Lt(math.Inf(-11)))}}, + "InjectXNegInfX_ltXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.Inf(-11)).Is(gremlingo.P.Lt(math.Inf(1)))}}, + "InjectXNegInfX_gtXInfX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(math.Inf(-11)).Is(gremlingo.P.Gt(math.Inf(1)))}}, "Primitives_Number_eqXbyteX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Unfold().Where(gremlingo.T__.Is(p["xx2"]))}}, "Primitives_Number_eqXshortX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Unfold().Where(gremlingo.T__.Is(p["xx2"]))}}, "Primitives_Number_eqXintX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx1"]).Unfold().Where(gremlingo.T__.Is(p["xx2"]))}}, @@ -980,8 +981,8 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[ "g_V_properties_order_id": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Properties().Order().Id()}}, "g_E_properties_order_value": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.E().Properties().Order().Value()}}, "g_E_properties_order_byXdescX_value": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.E().Properties().Order().By(gremlingo.Desc).Value()}}, - "g_inject_order": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(xx8, xx7, p["xx1"]0, xx4, xx9, p["xx1"]2, p["xx1"], xx5, p["xx1"]1, xx6, p["xx3"], p["xx2"], p["xx1"]3, p["xx1"]4, p["xx1"]5).Order()}}, - "g_inject_order_byXdescX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(xx8, xx7, p["xx1"]0, xx4, xx9, p["xx1"]2, p["xx1"], xx5, p["xx1"]1, xx6, p["xx3"], p["xx2"], p["xx1"]3, p["xx1"]4, p["xx1"]5).Order().By(gremlingo.Desc)}}, + "g_inject_order": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx8"], p["xx7"], p["xx10"], p["xx4"], p["xx9"], p["xx12"], p["xx1"], p["xx5"], p["xx11"], p["xx6"], p["xx3"], p["xx2"], p["xx13"], p["xx14"], p["xx15"]).Order()}}, + "g_inject_order_byXdescX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.Inject(p["xx8"], p["xx7"], p["xx10"], p["xx4"], p["xx9"], p["xx12"], p["xx1"], p["xx5"], p["xx11"], p["xx6"], p["xx3"], p["xx2"], p["xx13"], p["xx14"], p["xx15"]).Order().By(gremlingo.Desc)}}, "g_V_out_out_order_byXascX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Out().Out().Order().By(gremlingo.Asc)}}, "g_V_out_out_order_byXdescX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Out().Out().Order().By(gremlingo.Desc)}}, "g_V_out_out_asXheadX_path_order_byXascX_selectXheadX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Out().Out().As("head").Path().Order().By(gremlingo.Asc).Select("head")}}, diff --git a/gremlin-go/cucumber/tinkerPopWorld.go b/gremlin-go/cucumber/tinkerPopWorld.go index 26caf046a76..c4da778bef7 100644 --- a/gremlin-go/cucumber/tinkerPopWorld.go +++ b/gremlin-go/cucumber/tinkerPopWorld.go @@ -34,15 +34,17 @@ type TinkerPopWorld struct { graphName string traversal *gremlingo.GraphTraversal result []interface{} + error map[bool]string graphDataMap map[string]*DataGraph parameters map[string]interface{} } type DataGraph struct { - name string - connection *gremlingo.DriverRemoteConnection - vertices map[string]*gremlingo.Vertex - edges map[string]*gremlingo.Edge + name string + connection *gremlingo.DriverRemoteConnection + vertices map[string]*gremlingo.Vertex + vertexProperties map[string]*gremlingo.VertexProperty + edges map[string]*gremlingo.Edge } func getEnvOrDefaultString(key string, defaultValue string) string { @@ -76,6 +78,7 @@ func NewTinkerPopWorld() *TinkerPopWorld { graphName: "", traversal: nil, result: nil, + error: make(map[bool]string), graphDataMap: make(map[string]*DataGraph), parameters: make(map[string]interface{}), } @@ -105,10 +108,11 @@ func (t *TinkerPopWorld) loadAllDataGraph() { } g := gremlingo.Traversal_().WithRemote(connection) t.graphDataMap[name] = &DataGraph{ - name: name, - connection: connection, - vertices: getVertices(g), - edges: getEdges(g), + name: name, + connection: connection, + vertices: getVertices(g), + vertexProperties: getVertexProperties(g), + edges: getEdges(g), } } } @@ -187,6 +191,41 @@ func getEdgeKey(edgeKeyMap map[interface{}]interface{}) string { return fmt.Sprint(edgeKeyMap["o"], "-", edgeKeyMap["l"], "->", edgeKeyMap["i"]) } +func getVertexProperties(g *gremlingo.GraphTraversalSource) map[string]*gremlingo.VertexProperty { + vertexPropertyMap := make(map[string]*gremlingo.VertexProperty) + res, err := g.V().Properties().Group().By(&gremlingo.Lambda{ + Script: "{ it -> \n" + + " def val = it.value()\n" + + " if (val instanceof Integer)\n" + + " val = 'd[' + val + '].i'\n" + + " else if (val instanceof Float)\n" + + " val = 'd[' + val + '].f'\n" + + " else if (val instanceof Double)\n" + + " val = 'd[' + val + '].d'\n" + + " return it.element().value('name') + '-' + it.key() + '->' + val\n" + + "}", + Language: "", + }).By(gremlingo.T__.Tail()).Next() + if res == nil { + return nil + } + if err != nil { + return nil + } + v := reflect.ValueOf(res.GetInterface()) + if v.Kind() != reflect.Map { + fmt.Printf("Expecting to get a map as a result, got %v instead.", v.Kind()) + return nil + } + keys := v.MapKeys() + for _, k := range keys { + convKey := k.Convert(v.Type().Key()) + val := v.MapIndex(convKey) + vertexPropertyMap[k.Interface().(string)] = val.Interface().(*gremlingo.VertexProperty) + } + return vertexPropertyMap +} + // This function is used to isolate connection problems to each scenario, and used in the Before context hook to prevent // a failing test in one scenario closing the shared connection that leads to failing subsequent scenario tests. // This function can be removed once all pending tests pass. diff --git a/gremlin-go/driver/anonymousTraversal.go b/gremlin-go/driver/anonymousTraversal.go index ad1bb439ab3..b392d52e256 100644 --- a/gremlin-go/driver/anonymousTraversal.go +++ b/gremlin-go/driver/anonymousTraversal.go @@ -570,7 +570,7 @@ func (anonymousTraversal *anonymousTraversal) MergeE(args ...interface{}) *Graph // MergeV adds the mergeV step to the GraphTraversal. func (anonymousTraversal *anonymousTraversal) MergeV(args ...interface{}) *GraphTraversal { - return anonymousTraversal.graphTraversal().MergeE(args...) + return anonymousTraversal.graphTraversal().MergeV(args...) } // Min adds the min step to the GraphTraversal. diff --git a/gremlin-go/driver/graphBinary.go b/gremlin-go/driver/graphBinary.go index 821a83ef28a..f3decf7e6c7 100644 --- a/gremlin-go/driver/graphBinary.go +++ b/gremlin-go/driver/graphBinary.go @@ -74,6 +74,7 @@ const ( BooleanType DataType = 0x27 TextPType DataType = 0x28 BulkSetType DataType = 0x2a + MergeType DataType = 0x2e DurationType DataType = 0x81 NullType DataType = 0xFE ) @@ -956,6 +957,8 @@ func (serializer *graphBinaryTypeSerializer) getSerializerToWrite(val interface{ return &graphBinaryTypeSerializer{dataType: BarrierType, writer: enumWriter, logHandler: serializer.logHandler}, nil case Scope: return &graphBinaryTypeSerializer{dataType: ScopeType, writer: enumWriter, logHandler: serializer.logHandler}, nil + case Merge: + return &graphBinaryTypeSerializer{dataType: MergeType, writer: enumWriter, logHandler: serializer.logHandler}, nil case p, Predicate: return &graphBinaryTypeSerializer{dataType: PType, writer: pWriter, logHandler: serializer.logHandler}, nil case textP, TextPredicate: diff --git a/gremlin-go/driver/traversal.go b/gremlin-go/driver/traversal.go index 7ba5b5f09f6..52637a869cb 100644 --- a/gremlin-go/driver/traversal.go +++ b/gremlin-go/driver/traversal.go @@ -161,6 +161,10 @@ const ( In Direction = "IN" // Out refers to an outgoing direction. Out Direction = "OUT" + // From refers to an incoming direction. + From Direction = "OUT" + // To refers to an outgoing direction. + To Direction = "IN" // Both refers to either direction In or Out. Both Direction = "BOTH" ) @@ -220,6 +224,16 @@ const ( Value T = "value" ) +// Merge is a set of operations for Vertex merging. +type Merge string + +const ( + // OnCreate Merges on create. + OnCreate Merge = "onCreate" + // OnMatch Merges on match. + OnMatch Merge = "onMatch" +) + // Operator is a set of operations for traversal steps. type Operator string @@ -396,6 +410,10 @@ type TextPredicate interface { And(args ...interface{}) TextPredicate // Or TextPredicate returns a TextPredicate composed of two predicates (logical OR of them). Or(args ...interface{}) TextPredicate + // Regex TextPredicate determines if a string matches the specified regex expression. + Regex(args ...interface{}) TextPredicate + // NotRegex TextPredicate determines if a string does not match the specified regex expression. + NotRegex(args ...interface{}) TextPredicate } type textP p @@ -445,7 +463,7 @@ func (*textP) StartingWith(args ...interface{}) TextPredicate { return newTextP("startingWith", args...) } -// NotRegex TextPredicate determines if a string matches the specified regex expression. +// NotRegex TextPredicate determines if a string does not match the specified regex expression. func (*textP) NotRegex(args ...interface{}) TextPredicate { return newTextP("notRegex", args...) }