Beispiel #1
0
        public async Task Should_Execute_A_Traversal()
        {
            var g  = DseGraph.Traversal(Session);
            var rs = await Session.ExecuteGraphAsync(g.V().HasLabel("person").Has("name", P.Eq("marko")));

            var rsSync = Session.ExecuteGraph(g.V().HasLabel("person").Has("name", P.Eq("marko")));

            // The result should be DSE driver vertices
            StatementCoreIntegrationTest.VerifyGraphResultSet(Session, rs);
            StatementCoreIntegrationTest.VerifyGraphResultSet(Session, rsSync);
        }
Beispiel #2
0
        public void Should_Be_Able_To_Create_Vertex_With_Multicardinality_Property()
        {
            var g          = DseGraph.Traversal(Session);
            var direwolves = new[] { "Ghost", "Nymeria", "Shaggydog", "Grey Wind", "Lady" };
            var stmt       = DseGraph.StatementFromTraversal(
                g.AddV("multi_v")
                .Property("pk", Guid.NewGuid())
                .Property("multi_prop", new object[] { direwolves }));

            Session.ExecuteGraph(stmt);
            StatementCoreIntegrationTest.VerifyMultiCardinalityProperty(Session, g, direwolves);
            g.V().HasLabel("multi_v").Drop().Next();
        }
Beispiel #3
0
        public void Should_Be_Able_To_Create_Vertex_With_Multicardinality_Property()
        {
            var g = DseGraph.Traversal(Session);

            g.AddV("multi_v")
            .Property("pk", Guid.NewGuid())
            .Property("multi_prop", new List <string> {
                "Hold", "the", "door"
            })
            .Next();
            StatementCoreIntegrationTest.VerifyMultiCardinalityProperty(Session, g, new [] { "Hold", "the", "door" });
            g.V().HasLabel("multi_v").Drop().Next();
        }
Beispiel #4
0
        public void Should_Be_Able_To_Create_Vertex_With_TupleProperties()
        {
            var g     = DseGraph.Traversal(Session);
            var tuple = new Tuple <string, int>("test 123", 123);
            var guid  = Guid.NewGuid();

            g.AddV("tuple_v")
            .Property("pk", guid)
            .Property("tuple_prop", tuple)
            .Next();

            StatementCoreIntegrationTest.VerifyProperty(Session, g, "tuple_v", guid, "tuple_prop", tuple);
            g.V().HasLabel("tuple_v").Drop().Next();
        }
Beispiel #5
0
        public void Should_Be_Able_To_Create_Vertex_With_MetaProperties()
        {
            var g        = DseGraph.Traversal(Session);
            var guid     = Guid.NewGuid();
            var metaProp = new MetaProp {
                SubProp = "Dragonglass", SubProp2 = "Valyrian steel"
            };

            g.AddV("meta_v")
            .Property("pk", guid)
            .Property("meta_prop", metaProp)
            .Next();

            StatementCoreIntegrationTest.VerifyMetaProperties(Session, g, guid, metaProp);
            g.V().HasLabel("meta_v").Drop().Next();
        }
Beispiel #6
0
        public void Should_Be_Able_To_Create_Vertex_With_CollectionProperties()
        {
            var g    = DseGraph.Traversal(Session);
            var stmt = DseGraph.StatementFromTraversal(g.AddV("collection_v")
                                                       .Property("pk", "What can kill a dragon")
                                                       .Property("sub_prop", new List <string> {
                "Qyburn's scorpion"
            })
                                                       .Property("sub_prop2", new List <string> {
                "Another dragon"
            }));

            Session.ExecuteGraph(stmt);
            StatementCoreIntegrationTest.VerifyCollectionProperties(Session, g, "What can kill a dragon", "Qyburn's scorpion", "Another dragon");
            var dropstmt = DseGraph.StatementFromTraversal(g.V().HasLabel("collection_v").Drop());

            Session.ExecuteGraph(dropstmt);
        }
Beispiel #7
0
        public void Should_Be_Able_To_Create_Vertex_With_CollectionProperties()
        {
            Session.UserDefinedTypes.Define(UdtMap.For <MetaProp>("meta_prop_type", GraphName)
                                            .Map(u => u.SubProp, "sub_prop").Map(u => u.SubProp2, "sub_prop2"));
            var g = DseGraph.Traversal(Session);

            g.AddV("collection_v")
            .Property("pk", "White Walkers")
            .Property("sub_prop", new List <string> {
                "Dragonglass"
            })
            .Property("sub_prop2", new List <string> {
                "Valyrian steel"
            })
            .Next();
            StatementCoreIntegrationTest.VerifyCollectionProperties(Session, g, "White Walkers", "Dragonglass", "Valyrian steel");
            g.V().HasLabel("collection_v").Drop().Next();
        }
Beispiel #8
0
        public void Should_Be_Able_To_Create_Vertex_With_MetaProperties()
        {
            Session.UserDefinedTypes.Define(UdtMap.For <MetaProp>("meta_prop_type", GraphName)
                                            .Map(u => u.SubProp, "sub_prop").Map(u => u.SubProp2, "sub_prop2"));
            var g        = DseGraph.Traversal(Session);
            var guid     = Guid.NewGuid();
            var metaProp = new MetaProp {
                SubProp = "Qyburn's scorpion", SubProp2 = "Another dragon"
            };
            var stmt = DseGraph.StatementFromTraversal(g.AddV("meta_v")
                                                       .Property("pk", guid)
                                                       .Property("meta_prop", metaProp));

            Session.ExecuteGraph(stmt);
            StatementCoreIntegrationTest.VerifyMetaProperties(Session, g, guid, metaProp);
            var dropstmt = DseGraph.StatementFromTraversal(g.V().HasLabel("meta_v").Drop());

            Session.ExecuteGraph(dropstmt);
        }