Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var db       = new MongoClient("mongodb://127.0.0.1:27017/").GetDatabase("wikidata");
            var triplets = db.GetCollection <Triplet>("triplet");

            _config = new PathConfiguration();

            _asyncSaver = new AsyncSaver(triplets);

            _count       = GetLinesCount(_config.PositionsPath, _config.GetPath(CountFilePath));
            _offset      = GetOffset(_config.GetPath(OffsetFilePath));
            _startOffset = _offset;
            _timer       = new Stopwatch();

            using (var wikiFile = new WikidumpReader(_config.WikipediaPath))
            {
                var algo = new AlgoInMemory(_asyncSaver, wikiFile, triplets, _config.PositionsPath);

                _timer.Start();
                algo.OnProcessed += algo_OnProcessed;
                algo.Process(_offset);
            }
            _asyncSaver.Join();
            Task.WaitAll();
            Console.ReadKey();
        }
Exemplo n.º 2
0
 protected AlgoBase(AsyncSaver saver,
                    IWikidumpReader wikiReader,
                    IMongoCollection <Triplet> triplets,
                    string positionsPath)
 {
     _saver      = saver;
     _wikiReader = wikiReader;
     _triplets   = triplets;
     _positions  = PrepareCsvReader(positionsPath);
 }
 public AlgoInMemory(AsyncSaver saver, IWikidumpReader wikiReader, IMongoCollection <Triplet> triplets, string positionsPath)
     : base(saver, wikiReader, triplets, positionsPath)
 {
     _tripletsInMemory = GetTripletsCache();
 }
Exemplo n.º 4
0
 public AlgoInDb(AsyncSaver saver, IWikidumpReader wikiReader, IMongoCollection <Triplet> triplets, string positionsPath)
     : base(saver, wikiReader, triplets, positionsPath)
 {
 }