public final void loadData(final LanguageSet langs) throws DaoException { final TIntSet savedConcepts = TCollections.synchronizedSet(new TIntHashSet()); final AtomicInteger matches = new AtomicInteger(); final AtomicInteger count = new AtomicInteger(); WikidataFilter filter = (new WikidataFilter.Builder()).withPropertyId(COORDINATE_LOCATION_PROPERTY_ID).build(); Iterable<WikidataStatement> statements = wdDao.get(filter); ParallelForEach.iterate(statements.iterator(), WpThreadUtils.getMaxThreads(), 100, new Procedure<WikidataStatement>() { @Override public void call(WikidataStatement statement) throws Exception { try { if (storeStatement(savedConcepts, langs, statement)) { matches.incrementAndGet(); } } catch (Exception e) { LOG.error("storage of statement failed: " + statement.toString(), e); miDao.incrementErrorsQuietly(Geometry.class); } if (count.incrementAndGet() % 10000 == 0){ LOG.info("Matched " + matches + " out of " + count + " statements from " + this.getClass().getName()); } } }, Integer.MAX_VALUE); }
public final void loadData(final LanguageSet langs) throws DaoException { final TIntSet savedConcepts = TCollections.synchronizedSet(new TIntHashSet()); final AtomicInteger matches = new AtomicInteger(); final AtomicInteger count = new AtomicInteger(); WikidataFilter filter = (new WikidataFilter.Builder()).withPropertyId(COORDINATE_LOCATION_PROPERTY_ID).build(); Iterable<WikidataStatement> statements = wdDao.get(filter); ParallelForEach.iterate(statements.iterator(), WpThreadUtils.getMaxThreads(), 100, new Procedure<WikidataStatement>() { @Override public void call(WikidataStatement statement) throws Exception { try { if (storeStatement(savedConcepts, langs, statement)) { matches.incrementAndGet(); } } catch (Exception e) { LOG.error("storage of statement failed: " + statement.toString(), e); miDao.incrementErrorsQuietly(Geometry.class); } if (count.incrementAndGet() % 10000 == 0){ LOG.info("Matched " + matches + " out of " + count + " statements from " + this.getClass().getName()); } } }, Integer.MAX_VALUE); }