Пример #1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Usage();
                return;
            }

            if (args.Length >= 2)
            {
                TrinityConfig.StorageRoot = args[1];
            }
            Global.LoadTSLStorageExtension(args[0]);
            Global.LocalStorage.LoadStorage();

            TrinityConfig.HttpPort = 80;
            FanoutSearchModule.EnableExternalQuery(true);
            FanoutSearchModule.SetQueryTimeout(3000);
            FanoutSearchModule.RegisterIndexService(Indexer);
            FanoutSearch.LambdaDSL.SetDialect("g", "v", "outV", "outE", "Action");

            TrinityServer server = new TrinityServer();

            server.RegisterCommunicationModule <FanoutSearchModule>();
            server.Start();
        }
Пример #2
0
        static void Main(string[] args)
        {
            FanoutSearchModule.EnableExternalQuery(true);
            FanoutSearchModule.SetQueryTimeout(30000);
            FanoutSearchModule.RegisterIndexService(Indexer);
            FanoutSearchModule.RegisterExpressionSerializerFactory(() => new ExpressionSerializer());
            LambdaDSL.SetDialect("MyGraph", "StartFrom", "VisitNode", "FollowEdge", "Action");

            TrinityConfig.HttpPort = 80;
            var server = new TrinityServer();

            server.RegisterCommunicationModule <FanoutSearchModule>();
            server.Start();

            if (!Trinity.Global.LocalStorage.LoadStorage() || !Trinity.Global.LocalStorage.Movie_Accessor_Selector().Any())
            {
                Trinity.Global.LocalStorage.LoadStorage();
                ImportMovieData(@"D:\MovieDomain\GraphEngineServer\bin\Debug\");
                Trinity.Global.LocalStorage.SaveStorage();
            }
            else
            {
                Console.WriteLine("=============================Movie had been imported once. Skipping this turn.");
            }
            //TestMovieData(@"D:\MovieDomain\GraphEngineServer\bin\Debug\");

            //ImportToyData();
            //PrepareSeedEntity();
        }
Пример #3
0
 public TrinityServerFixture()
 {
     Global.Initialize();
     LambdaDSL.SetDialect("MAG", "StartFrom", "VisitNode", "FollowEdge", "Action");
     FanoutSearchModule.SetQueryTimeout(-1);
     FanoutSearchModule.RegisterIndexService(FakeIndexService);
     server = new TrinityServer();
     server.RegisterCommunicationModule <FanoutSearchModule>();
     server.Start();
 }
Пример #4
0
        internal static void Initialize()
        {
            Global.Initialize();
            LambdaDSL.SetDialect("MAG", "StartFrom", "VisitNode", "FollowEdge", "Action");
            FanoutSearchModule.SetQueryTimeout(-1);
            FanoutSearchModule.RegisterIndexService(FakeIndexService);
            FanoutSearchModule.RegisterExpressionSerializerFactory(() => new ExpressionSerializer());
            TrinityServer server = new TrinityServer();

            server.RegisterCommunicationModule <FanoutSearchModule>();
            server.Start();
        }
Пример #5
0
        private static void Initialize()
        {
            //  Setup LIKQ index service
            FanoutSearchModule.RegisterIndexService(IndexService);
            //  Set LIKQ starting node keyword to 'Freebase'
            LambdaDSL.SetDialect("Freebase", "StartFrom", "VisitNode", "FollowEdge", "Action");
            //  Plug-in Freebase ICell adapter
            FanoutSearchModule.RegisterUseICellOperationMethod(CellGroupAccessor.New);
            //  Plug-in Serialize.Linq expression serializer
            FanoutSearchModule.RegisterExpressionSerializerFactory(ExpressionSerializerFactory);
            //  Configure LIKQ timeout
            FanoutSearchModule.SetQueryTimeout(1000000);

            string storage_path = Path.Combine(Global.MyAssemblyPath, "storage");

            if (Directory.Exists(storage_path) && Directory.GetFileSystemEntries(storage_path).Count() == 0)
            {
                Directory.Delete(storage_path);
            }

            if (!Directory.Exists(storage_path))
            {
                DownloadDataFile();
            }

            Global.LocalStorage.LoadStorage();
            string sqlite_db_path = Path.Combine(storage_path, "freebase.sqlite");

            if (!File.Exists(sqlite_db_path))
            {
                BuildIndex(sqlite_db_path);
            }

            s_dbconn = new SQLiteConnection($"Data Source={sqlite_db_path};Version=3;");
            s_dbconn.Open();

            return;
        }