Exemple #1
0
        public static DataLoader initInstance(IConfiguration config)
        {
            if (uniqueInstance == null)
            {
                uniqueInstance = new DataLoader();

                persistanceType = (PersistanceType)Enum.Parse(typeof(PersistanceType), config.GetSection("PersistanceType").Value, true);

                if (persistanceType == PersistanceType.File)
                {
                    filePathConfig = config.GetSection("FileDataPath").Get <FilePathConfig>();
                    uniqueInstance.dataAccessor = new FileDataAccessor(filePathConfig.RootPath);
                }
                else
                {
                    string connectionString = config.GetConnectionString("MongoDbConnection");
                    string mgmtDBName       = config.GetConnectionString("DataStoreMgmtDatabaseName");

                    uniqueInstance.dataAccessor = new MongoDataAccessor(connectionString, mgmtDBName);
                }
            }

            return(uniqueInstance);
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            /* default to import all arguments */
            string usage = "Usage: ./DataProcessor [options] --rootPath=<rootPath>\nThere are three arguments to trigger different data importing jobs.\nThey are '--kg', '--nlu' and '--vc'. Or you can use '--all' to trigger all data importing jobs.";


            FilePathConfig filePaths = config.GetSection("FileDataPath").Get <FilePathConfig>();
            string         kgPath    = filePaths.KGFilePath;
            string         nluPath   = filePaths.NLUFilePath;
            string         vcPath    = filePaths.VCFilePath;

            bool kg  = false;
            bool nlu = false;
            bool vc  = false;

            if (args.Length == 0)
            {
                Console.WriteLine(usage);
                Environment.Exit(1);
            }
            else
            {
                foreach (string arg in args)
                {
                    if (arg == "--all")
                    {
                        kg  = true;
                        nlu = true;
                        vc  = true;
                    }
                    else if (arg == "--kg")
                    {
                        kg = true;
                    }
                    else if (arg == "--nlu")
                    {
                        nlu = true;
                    }
                    else if (arg == "--vc")
                    {
                        vc = true;
                    }
                    else if (arg == "--help")
                    {
                        Console.WriteLine();
                        Environment.Exit(0);
                    }
                }
            }

            if (kg)
            {
                ImportKG(kgPath);
            }

            if (nlu)
            {
                ImportNLU(nluPath);
            }

            if (vc)
            {
                ImportVC(vcPath);
            }

            Console.WriteLine("Finished!");
        }
Exemple #3
0
 public OneDriveServer(OneDriveUser oneDriveUser, FilePathConfig filePaths, ILogger <OneDriveServer> logger) : base(filePaths, logger)
 {
     OneDriveUser = oneDriveUser;
 }
Exemple #4
0
        private KGDataAccessor(IConfiguration config)
        {
            log = Log.Logger.ForContext <KGDataAccessor>();

            string persistanceType = config.GetSection("PersistanceType").Value;

            if (persistanceType == "File")
            {
                FilePathConfig filePaths = config.GetSection("FileDataPath").Get <FilePathConfig>();

                string kgPath = filePaths.KGFilePath;

                log.Here().Information("KGFilePath: " + kgPath);

                KGDataImporter importer = new KGDataImporter(kgPath);

                this.vList = importer.ParseKGVertexes();
                this.eList = importer.ParseKGEdges();

                log.Here().Information("KG data has been parsed from Files.");

                string vcPath = filePaths.VCFilePath;

                log.Here().Information("VCFilePath: " + vcPath);

                VisuliaztionImporter vImporter = new VisuliaztionImporter(vcPath);

                this.vcList = vImporter.GetVisuliaztionConfigs();
            }
            else
            {
                BsonDocument allFilter = new BsonDocument();

                string connectionString = config.GetConnectionString("MongoDbConnection");
                string dbName           = config.GetConnectionString("DatabaseName");

                Console.WriteLine("Database Name: " + dbName);

                MongoClient client = new MongoClient(connectionString);

                IMongoDatabase db = client.GetDatabase(dbName);

                log.Here().Information("connectionString: " + connectionString + ", databaseName: " + dbName);

                IMongoCollection <Vertex> vCollection = db.GetCollection <Vertex>("Vertexes");

                this.vList = vCollection.Find(allFilter).ToList();

                IMongoCollection <Edge> eCollection = db.GetCollection <Edge>("Edges");

                this.eList = eCollection.Find(allFilter).ToList();

                log.Here().Information("KG data has been parsed from MongoDB.");

                IMongoCollection <VisulizationConfig> vcCollection = db.GetCollection <VisulizationConfig>("VisulizationConfigs");

                this.vcList = vcCollection.Find(allFilter).ToList();

                log.Here().Information("Visulization Config data has been parsed from MongoDB.");
            }
        }
Exemple #5
0
 public FileProcessingService()
 {
     _fileManager = new FileManager();
     defaultPath  = FilePathConfig.GetPathFile();
 }