Пример #1
0
 public void Predicates_NotEqualTo()
 {
     using (var client = TestDatabase.GetClient("predicates_neq"))
     {
         client.Execute(VertexQuery.Create("test").AddProperty("age", 30)).Wait();
         Assert.AreEqual(0, client.Execute(VertexQuery.All().Values("age").Is(GraphPredicate.NotEqualTo(age))).Result.Count());
         Assert.AreEqual(1, client.Execute(VertexQuery.All().Values("age").Is(GraphPredicate.NotEqualTo(age + 1))).Result.Count());
     }
 }
Пример #2
0
        public void Steps_Where()
        {
            using (var client = TestDatabase.GetClient("where"))
            {
                client.Execute(VertexQuery.Create("one")).Wait();
                client.Execute(VertexQuery.Create("two")).Wait();
                client.Execute(VertexQuery.Create("three")).Wait();
                client.Execute(VertexQuery.All().HasLabel("one").AddEdge("to", DirectionStep.To(VertexQuery.Find("two")))).Wait();
                client.Execute(VertexQuery.All().HasLabel("two").AddEdge("to", DirectionStep.To(VertexQuery.Find("three")))).Wait();

                var query  = VertexQuery.All().HasLabel("one").As("a").Both().Both().Where(GraphPredicate.NotEqualTo("a"));
                var result = client.Execute(query).Result;
                Assert.AreEqual(result.Count(), 1);
                Assert.AreEqual(result.First().label, "three");
            }
        }