public void testSelfFilter() { var _List = new List<String>() { "marko", "antonio", "rodriguez", "was", "here", "." }; var _Pipe1 = new AggregatorPipe<String>(new List<String>()); var _Pipe2 = new CollectionFilterPipe<String>(_Pipe1.SideEffect, ComparisonFilter.NOT_EQUAL); var _Pipeline = new Pipeline<String, String>(_Pipe1, _Pipe2); _Pipeline.SetSourceCollection(_List); var _Counter = 0; while (_Pipeline.MoveNext()) _Counter++; Assert.AreEqual(6, _Counter); _Pipe1 = new AggregatorPipe<String>(new List<String>()); _Pipe2 = new CollectionFilterPipe<String>(_Pipe1.SideEffect, ComparisonFilter.EQUAL); _Pipeline = new Pipeline<String, String>(_Pipe1, _Pipe2); _Pipeline.SetSourceCollection(_List); _Counter = 0; while (_Pipeline.MoveNext()) _Counter++; Assert.AreEqual(0, _Counter); }
public void testListProperty() { var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _Vadas = _Graph.VertexById(2); var _Pipe = new PropertyPipe<String, Object>(Keys: "name"); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, String>(_Pipe); _Pipeline.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>() { _Marko, _Vadas }.GetEnumerator()); var _Counter = 0; while (_Pipeline.MoveNext()) { var _Name = _Pipeline.Current; Assert.IsTrue(_Name.Equals("vadas") || _Name.Equals("marko")); _Counter++; } Assert.AreEqual(2, _Counter); }
public void testPropertyFilter() { var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _Pipe1 = new OutEdgesPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe2 = new InVertexPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe3 = new VertexPropertyFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>("lang", v => v == "java"); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(new List<IPipe>() { _Pipe1, _Pipe2, _Pipe3 }); _Pipeline.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>() { _Marko }.GetEnumerator()); var _Counter = 0; while (_Pipeline.MoveNext()) { _Counter++; var _Vertex = _Pipeline.Current; Assert.AreEqual(3, _Vertex.Id); Assert.AreEqual("java", _Vertex.GetProperty("lang")); Assert.AreEqual("lop", _Vertex.GetProperty("name")); } Assert.AreEqual(1, _Counter); }
public void testFilterIds1() { var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _Pipe1 = new OutEdgesPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe2 = new InVertexPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe3 = new VertexIdFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(v => v != 3); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_Pipe1, _Pipe2, _Pipe3); _Pipeline.SetSourceCollection(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>() { _Marko }); var _Counter = 0; while (_Pipeline.MoveNext()) { var _Vertex = _Pipeline.Current; Assert.AreEqual("lop", _Vertex.GetProperty("name")); _Counter++; } Assert.AreEqual(1, _Counter); }
public void testBasicGather() { var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Pipe0 = new OutEdgesPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe1 = new InVertexPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe2 = new GatherPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IEnumerable<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>>(_Pipe0, _Pipe1, _Pipe2); _Pipeline.SetSource(new SingleEnumerator<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_Graph.VertexById(1))); while (_Pipeline.MoveNext()) Console.WriteLine(_Pipeline.Current + "--->");// + pipeline.Path); }
public void testGraphFutureFilter() { var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _OutEPipe = new OutEdgesPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _InVPipe = new InVertexPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _PropertyFilterPipe = new VertexPropertyFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>("name", v => v.Equals("lop")); var _FutureFilterPipe = new FutureFilterPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new Pipeline<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_InVPipe, _PropertyFilterPipe)); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_OutEPipe, _FutureFilterPipe); _Pipeline.SetSourceCollection(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>() { _Marko }); int _Counter = 0; while (_Pipeline.MoveNext()) { _Counter++; Assert.AreEqual(9, _Pipeline.Current.Id); } Assert.AreEqual(1, _Counter); }
public void testMultiProperty() { var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _EVP = new InVertexPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _PPipe = new PropertyPipe<String, Object>(Keys: "name"); var _Pipeline = new Pipeline<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, String>(_EVP, _PPipe); _Pipeline.SetSourceCollection(_Marko.OutEdges()); var _Counter = 0; while (_Pipeline.MoveNext()) { var _Name = _Pipeline.Current; Assert.IsTrue(_Name.Equals("vadas") || _Name.Equals("josh") || _Name.Equals("lop")); _Counter++; } Assert.AreEqual(3, _Counter); }
public void testAndOrPipeGraph() { // ./outE[@label='created' or (@label='knows' and @weight > 0.5)] var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _Pipe1 = new OutEdgesPipe <UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _PipeA = new EdgeLabelFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(v => v != "created"); var _PipeB = new EdgeLabelFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(v => v != "knows"); var _PipeC = new EdgePropertyFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>("weight", v => (0.5).Equals(v)); var _PipeD = new AndFilterPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new HasNextPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_PipeB), new HasNextPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_PipeC)); var _Pipe2 = new OrFilterPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new HasNextPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_PipeA), new HasNextPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_PipeD)); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_Pipe1, _Pipe2); _Pipeline.SetSourceCollection(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>() { _Marko }); int _Counter = 0; while (_Pipeline.MoveNext()) { var _Edge = _Pipeline.Current; Assert.IsTrue(_Edge.Id.Equals(8) || _Edge.Id.Equals(9)); Assert.IsTrue(_Edge.Label.Equals("created") || (((Double)_Edge.GetProperty("weight")) > 0.5 && _Edge.Label.Equals("knows"))); _Counter++; } Assert.AreEqual(2, _Counter); }
public void testOrPipeGraph() { // ./outE[@label='created' or @weight > 0.5] var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _Peter = _Graph.VertexById(6); var _Pipe0 = new OutEdgesPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe1 = new EdgeLabelFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(v => v != "created"); var _Pipe2 = new EdgePropertyFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>("weight", v => (0.5).Equals(v)); var _ORFilterPipe = new OrFilterPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new HasNextPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_Pipe1), new HasNextPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_Pipe2)); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IGenericPropertyEdge<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_Pipe0, _ORFilterPipe); _Pipeline.SetSourceCollection(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>() { _Marko, _Peter, _Marko }); var _Counter = 0; while (_Pipeline.MoveNext()) { var _Edge = _Pipeline.Current; Assert.IsTrue(_Edge.Id.Equals(8) || _Edge.Id.Equals(9) || _Edge.Id.Equals(12)); Assert.IsTrue(((Double)_Edge.GetProperty("weight")) > 0.5f || _Edge.Label.Equals("created")); _Counter++; } Assert.AreEqual(5, _Counter); }
public void testFutureFilterGraph() { // ./outE[@label='created']/inV[@name='lop']/../../@name var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _PipeA = new OutEdgesPipe <UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _PipeB = new EdgeLabelFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(v => v != "created"); var _PipeC = new InVertexPipe <UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _PipeD = new VertexPropertyFilterPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>("name", v => v == "lop"); var _Pipe1 = new AndFilterPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new HasNextPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_PipeA, _PipeB, _PipeC, _PipeD))); var _Pipe2 = new PropertyPipe<String, Object>(Keys: "name"); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, String>(_Pipe1, _Pipe2); _Pipeline.SetSourceCollection(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>() { _Marko }); var _Counter = 0; while (_Pipeline.MoveNext()) { var name = _Pipeline.Current; Assert.AreEqual("marko", name); _Counter++; } Assert.AreEqual(1, _Counter); }
public void testFutureFilter() { var _Names = new List<String>() { "marko", "peter", "josh", "marko", "jake", "marko", "marko" }; var _PipeA = new CharacterCountPipe(); var _PipeB = new ObjectFilterPipe<UInt64>(4, ComparisonFilter.EQUAL); var _Pipe1 = new OrFilterPipe<String>(new HasNextPipe<String>(new Pipeline<String, UInt64>(_PipeA, _PipeB))); var _Pipeline = new Pipeline<String, String>(_Pipe1); _Pipeline.SetSourceCollection(_Names); int _Counter = 0; while (_Pipeline.MoveNext()) { var name = _Pipeline.Current; _Counter++; Assert.IsTrue((name.Equals("marko") || name.Equals("peter")) && !name.Equals("josh") && !name.Equals("jake")); } Assert.AreEqual(5, _Counter); }
public void testComplexTwoFutureFilterGraph() { // ./outE/inV/../../outE/../outE/inV/@name var _Graph = TinkerGraphFactory.CreateTinkerGraph(); var _Marko = _Graph.VertexById(1); var _PipeA = new OutEdgesPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _PipeB = new InVertexPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe1 = new OrFilterPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new HasNextPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_PipeA, _PipeB))); var _PipeC = new OutEdgesPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe2 = new OrFilterPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>( new HasNextPipe<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>(_PipeC)); var _Pipe3 = new OutEdgesPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe4 = new InVertexPipe<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>(); var _Pipe5 = new PropertyPipe<String, Object>(Keys: "name"); var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>, String>(_Pipe1, _Pipe2, _Pipe3, _Pipe4, _Pipe5); _Pipeline.SetSourceCollection(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object, UInt64, Int64, String, String, Object>>() { _Marko }); var _Counter = 0; while (_Pipeline.MoveNext()) { var _Name = _Pipeline.Current; Assert.IsTrue(_Name.Equals("vadas") || _Name.Equals("lop") || _Name.Equals("josh")); _Counter++; } Assert.AreEqual(3, _Counter); }