public void AsAOutAsAOutASASelectAByUnfoldValuesNameFoldLimitRangeLocal_4_5() { using (GraphViewCommand graphCommand = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = graphCommand.g().V().As("a").Out().As("a").Out().As("a").Select("a").By(GraphTraversal2.__().Unfold().Values("name").Fold()).Range(GremlinKeyword.Scope.Local, 4, 5); Assert.IsTrue(traversal.Next().Count == 0); } }
public void CoinWithProbabilityEq1() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Coin(1.0).Values("name"); List <string> result = traversal.Next(); CheckUnOrderedResults(new[] { "marko", "vadas", "lop", "josh", "ripple", "peter" }, result); } }
public void AsAOutAsAOutASASelectAByUnfoldValuesNameFoldLimitRangeLocal_1_2() { using (GraphViewCommand graphCommand = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = graphCommand.g().V().As("a").Out().As("a").Out().As("a").Select("a").By(GraphTraversal2.__().Unfold().Values("name").Fold()).Range(GremlinKeyword.Scope.Local, 1, 2); CheckUnOrderedResults(new [] {"josh", "josh"}, traversal.Next()); } }
public void CoinWithProbabilityEq0() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Coin(0.0).Values("name"); List <string> result = traversal.Next(); Assert.AreEqual(result.Count, 0); } }
public void get_g_V_groupXaX_byXname_substring_1X_byXconstantX1XX_capXaX() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { command.OutputFormat = OutputFormat.GraphSON; GraphTraversal2 traversal = command.g().V(); dynamic results = JsonConvert.DeserializeObject <dynamic>(traversal.FirstOrDefault()); } }
public void get_g_V_unionXoutXknowsX__outXcreatedX_inXcreatedXX_groupCount_selectXvaluesX_unfold_sum() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Union(GraphTraversal2.__().Out("knows"), GraphTraversal2.__().Out("created").In("created")).GroupCount().Select(GremlinKeyword.Column.Values).Unfold().Sum(); List <string> results = traversal.Next(); Assert.AreEqual(12, int.Parse(results[0])); } }
public void get_g_withSideEffectXa_markoX_addV_propertyXname_selectXaXX_name() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { command.OutputFormat = OutputFormat.GraphSON; GraphTraversal2 traversal = command.g().V(); dynamic results = JsonConvert.DeserializeObject <dynamic>(traversal.FirstOrDefault()); } }
public void get_g_V_hasXname_markoX_propertyXfriendWeight_outEXknowsX_weight_sum__acl_privateX() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { command.OutputFormat = OutputFormat.GraphSON; GraphTraversal2 traversal = command.g().V().Has("name", "marko").Property("friendWeight", GraphTraversal2.__().OutE("knows").Values("weight").Sum(), "acl", "private"); dynamic results = JsonConvert.DeserializeObject <dynamic>(traversal.FirstOrDefault()); } }
public void get_g_V_age_max() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Values("age").Max(); List <string> result = traversal.Next(); Assert.AreEqual(35, int.Parse(result[0])); } }
public void get_g_V_both_both_count() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Both().Both().Count(); List <string> result = traversal.Next(); Assert.AreEqual(30, int.Parse(result[0])); } }
public void get_g_V_out_aggregateXaX_path() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { command.OutputFormat = OutputFormat.GraphSON; GraphTraversal2 traversal = command.g().V().Out().Aggregate("a").Path(); dynamic results = JsonConvert.DeserializeObject <dynamic>(traversal.FirstOrDefault()); string markoId = this.ConvertToVertexId(command, "marko"); string lopId = this.ConvertToVertexId(command, "lop"); string vadasId = this.ConvertToVertexId(command, "vadas"); string joshId = this.ConvertToVertexId(command, "josh"); string rippleId = this.ConvertToVertexId(command, "ripple"); string peterId = this.ConvertToVertexId(command, "peter"); List <string> path1 = new List <string> { markoId, lopId }; List <string> path2 = new List <string> { markoId, vadasId }; List <string> path3 = new List <string> { markoId, joshId }; List <string> path4 = new List <string> { joshId, rippleId }; List <string> path5 = new List <string> { joshId, lopId }; List <string> path6 = new List <string> { peterId, lopId }; List <string> expect = new List <string> { string.Join(",", path1), string.Join(",", path2), string.Join(",", path3), string.Join(",", path4), string.Join(",", path5), string.Join(",", path6), }; List <string> ans = new List <string>(); foreach (dynamic result in results) { List <string> steps = new List <string>(); foreach (dynamic step in result["objects"]) { steps.Add(step["id"].ToString()); } ans.Add(string.Join(",", steps)); } CheckUnOrderedResults(expect, ans); } }
public void get_g_V_outE_order_byXweight_decrX_weight() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().OutE().Order().By("weight", GremlinKeyword.Order.Decr).Values("weight"); List <string> results = traversal.Next(); CheckOrderedResults(new[] { 1.0, 1.0, 0.5, 0.4, 0.4, 0.2 }, results.Select(double.Parse)); } }
public void get_g_V_order_byXnameX_name() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Order().By("name").Values("name"); List <string> results = traversal.Next(); CheckOrderedResults(new[] { "josh", "lop", "marko", "peter", "ripple", "vadas" }, results); } }
public void get_g_V_hasLabelXsongX_order_byXperfomances_decrX_byXnameX_rangeX110_120X_name() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Both().HasLabel("song").Order().By("performances", GremlinKeyword.Order.Decr).By("name").Range(110, 120).Values("name"); List <string> results = traversal.Next(); Assert.AreEqual(0, results.Count); } }
public void get_g_V_both_hasLabelXpersonX_order_byXage_decrX_name() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Both().HasLabel("person").Order().By("age", GremlinKeyword.Order.Decr).Values("name"); List <string> results = traversal.Next(); CheckOrderedResults(new[] { "peter", "josh", "josh", "josh", "marko", "marko", "marko", "vadas" }, results); } }
public void get_g_V_groupXaX_byXnameX_capXaX() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { command.OutputFormat = OutputFormat.GraphSON; GraphTraversal2 traversal = command.g().V().Group("a").By("name").Cap("a"); this.AssertCommonA(command, traversal); } }
public void get_g_V_fold_countXlocalX() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Fold().Count(GremlinKeyword.Scope.Local); List <string> result = traversal.Next(); Assert.AreEqual(6, int.Parse(result[0])); } }
public void g_E_sampleX2X_byXweightX() { using (GraphViewCommand graphCommand = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = graphCommand.g().E().Sample(2).By("weight"); List <string> result = traversal.Next(); Assert.AreEqual(2, result.Count); } }
public void get_g_V_repeatXoutX_timesX8X_count() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Repeat(GraphTraversal2.__().Out()).Times(8).Count(); List <string> result = traversal.Next(); Assert.AreEqual(0, int.Parse(result[0])); } }
public void g_V_localXoutE_sampleX1X_byXweightXX() { using (GraphViewCommand graphCommand = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = graphCommand.g().V().Local(GraphTraversal2.__().OutE().Sample(1).By("weight")); List <string> results = traversal.Next(); Assert.AreEqual(3, results.Count); } }
public void get_g_V_repeatXbothX_timesX5X_age_max() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Repeat(GraphTraversal2.__().Both()).Times(5).Values("age").Max(); List <string> result = traversal.Next(); Assert.AreEqual(35, int.Parse(result[0])); } }
public void get_g_V_hasLabelXpersonX_optionalXoutXknowsX_optionalXoutXcreatedXXX_path() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { command.OutputFormat = OutputFormat.GraphSON; GraphTraversal2 traversal = command.g().V().HasLabel("person").Optional(GraphTraversal2.__().Out("knows").Optional(GraphTraversal2.__().Out("created"))).Path(); dynamic results = JsonConvert.DeserializeObject <dynamic>(traversal.FirstOrDefault()); List <string> ans = new List <string>(); foreach (dynamic result in results) { Console.WriteLine(result); List <string> steps = new List <string>(); foreach (dynamic step in result["objects"]) { steps.Add(step["id"].ToString()); } ans.Add(string.Join(",", steps)); } string markoId = this.ConvertToVertexId(command, "marko"); string lopId = this.ConvertToVertexId(command, "lop"); string vadasId = this.ConvertToVertexId(command, "vadas"); string joshId = this.ConvertToVertexId(command, "josh"); string rippleId = this.ConvertToVertexId(command, "ripple"); string peterId = this.ConvertToVertexId(command, "peter"); List <string> path1 = new List <string> { markoId, vadasId }; List <string> path2 = new List <string> { markoId, joshId, rippleId }; List <string> path3 = new List <string> { markoId, joshId, lopId }; List <string> path4 = new List <string> { vadasId }; List <string> path5 = new List <string> { joshId }; List <string> path6 = new List <string> { peterId }; List <string> expect = new List <string> { string.Join(",", path1), string.Join(",", path2), string.Join(",", path3), string.Join(",", path4), string.Join(",", path5), string.Join(",", path6), }; CheckUnOrderedResults(expect, ans); } }
public void get_g_withSideEffectXa_testX_V_hasLabelXsoftwareX_propertyXtemp_selectXaXX_valueMapXname_tempX() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { command.OutputFormat = OutputFormat.GraphSON; GraphTraversal2 traversal = command.g().V(); dynamic results = JsonConvert.DeserializeObject <dynamic>(traversal.FirstOrDefault()); } }
public void VerticesUntilOutOutRepeatInAsASelectAByTailLocalName() { using (GraphViewCommand graphCommand = new GraphViewCommand(graphConnection)) { var traversal = graphCommand.g().V().Until(GraphTraversal2.__().Out().Out()).Repeat(GraphTraversal2.__().In().As("a")).Select("a").By(GraphTraversal2.__().Tail(/*local*/).Values("name")); // TODO: Implement the Asserts once the above bugs are fixed. } }
public void get_g_V_out_group_byXlabelX_selectXpersonX_unfold_outXcreatedX_name_limitX2X() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Out().Group().By("label").Select("person").Unfold().Out("created").Values("name").Limit(2); List <string> results = traversal.Next(); CheckUnOrderedResults(new [] { "ripple", "lop" }, results); } }
public void VerticesEmitRepeatOutTimes2Path() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { command.OutputFormat = OutputFormat.GraphSON; GraphTraversal2 traversal = command.g().V().Emit().Repeat(GraphTraversal2.__().Out()).Times(2).Path(); this.AssertPath(traversal); } }
public void DropVertex() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Drop(); List <string> result = traversal.Next(); Assert.AreEqual(0, GetEdgeCount(command)); Assert.AreEqual(0, GetVertexCount(command)); } }
public void get_g_V_valuesXnameX_order_tail() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Values("name").Order().Tail(); List <string> results = traversal.Next(); CheckOrderedResults(new[] { "vadas" }, results); } }
public void get_g_V_repeatXbothX_timesX3X_tailX7X() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Repeat(GraphTraversal2.__().Both()).Times(3).Tail(7); List <string> results = traversal.Next(); Assert.AreEqual(7, results.Count); } }
public void get_g_V_valuesXnameX_order_tailXglobal_2X() { using (GraphViewCommand command = new GraphViewCommand(graphConnection)) { GraphTraversal2 traversal = command.g().V().Values("name").Order().Tail(GremlinKeyword.Scope.Global, 2); List <string> results = traversal.Next(); CheckOrderedResults(new [] { "ripple", "vadas" }, results); } }