use of org.wikidata.query.rdf.tool.utils.StreamDumper in project wikidata-query-rdf by wikimedia.
the class Update method initialize.
private static Updater<? extends Change.Batch> initialize(String[] args, Closer closer) throws URISyntaxException {
try {
UpdateOptions options = handleOptions(UpdateOptions.class, args);
MetricRegistry metricRegistry = createMetricRegistry(closer, options.metricDomain());
StreamDumper wikibaseStreamDumper = createStreamDumper(dumpDirPath(options));
WikibaseRepository wikibaseRepository = new WikibaseRepository(UpdateOptions.uris(options), options.constraints(), metricRegistry, wikibaseStreamDumper, UpdateOptions.revisionDuration(options), RDFParserSuppliers.defaultRdfParser());
closer.register(wikibaseRepository);
UrisScheme wikibaseUris = WikibaseOptions.wikibaseUris(options);
URI root = wikibaseRepository.getUris().builder().build();
URI sparqlUri = UpdateOptions.sparqlUri(options);
HttpClient httpClient = buildHttpClient(getHttpProxyHost(), getHttpProxyPort());
closer.register(wrapHttpClient(httpClient));
Retryer<ContentResponse> retryer = buildHttpClientRetryer();
Duration rdfClientTimeout = getRdfClientTimeout();
RdfClient rdfClient = new RdfClient(httpClient, sparqlUri, retryer, rdfClientTimeout);
RdfRepository rdfRepository = new RdfRepository(wikibaseUris, rdfClient, MAX_FORM_CONTENT_SIZE);
Instant startTime = getStartTime(startInstant(options), rdfRepository, options.init());
Change.Source<? extends Change.Batch> changeSource = buildChangeSource(options, startTime, wikibaseRepository, rdfClient, root, metricRegistry);
Munger munger = mungerFromOptions(options);
ExecutorService updaterExecutorService = createUpdaterExecutorService(options.threadCount());
Updater<? extends Change.Batch> updater = createUpdater(wikibaseRepository, wikibaseUris, rdfRepository, changeSource, munger, updaterExecutorService, options.importAsync(), options.pollDelay(), options.verify(), metricRegistry);
closer.register(updater);
return updater;
} catch (Exception e) {
log.error("Error during initialization.", e);
throw e;
}
}
Aggregations