Esempio n. 1
0
        private void ClearDatabase()
        {
            db.Query <Person>().Remove().Execute();
            db.Query <Follow>().Remove().Execute();
            db.Query <Host>().Remove().Execute();

            if (db.ListGraphs().Count(x => x.Key == "SocialGraph") != 0)
            {
                db.Graph("SocialGraph").Drop();
            }
        }
        public void createGraph(string name)
        {
            var graph = db.Graph(name);

            graph.Create(new List <EdgeDefinitionTypedData>
            {
                new EdgeDefinitionTypedData
                {
                    Collection = typeof(Edge_Friend),
                    From       = new List <Type> {
                        typeof(User)
                    },
                    To = new List <Type> {
                        typeof(User)
                    }
                },
                new EdgeDefinitionTypedData
                {
                    Collection = typeof(Edge_ownOBJ),
                    From       = new List <Type> {
                        typeof(User)
                    },
                    To = new List <Type> {
                        typeof(OBJ)
                    }
                },
                new EdgeDefinitionTypedData
                {
                    Collection = typeof(Edge_ownScene),
                    From       = new List <Type> {
                        typeof(User)
                    },
                    To = new List <Type> {
                        typeof(Scene)
                    }
                },
                new EdgeDefinitionTypedData
                {
                    Collection = typeof(Edge_shareOBJ),
                    From       = new List <Type> {
                        typeof(OBJ)
                    },
                    To = new List <Type> {
                        typeof(User)
                    }
                },
                new EdgeDefinitionTypedData
                {
                    Collection = typeof(Edge_shareScene),
                    From       = new List <Type> {
                        typeof(Scene)
                    },
                    To = new List <Type> {
                        typeof(User)
                    }
                },
                new EdgeDefinitionTypedData
                {
                    Collection = typeof(Edge_isIn),
                    From       = new List <Type> {
                        typeof(OBJ)
                    },
                    To = new List <Type> {
                        typeof(Scene)
                    }
                }
            });
        }