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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }