use of won.matcher.solr.index.AtomIndexer in project webofneeds by researchstudio-sat.
the class SolrAtomIndexer method main.
public static void main(String[] args) throws IOException, InterruptedException, JsonLdError {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SolrTestAppConfiguration.class);
AtomIndexer indexer = ctx.getBean(AtomIndexer.class);
// set the options of the atom producer (e.g. if it should exhaust) in the
// SolrAtomIndexerAppConfiguration file
AtomProducer atomProducer = ctx.getBean(RoundRobinCompositeAtomProducer.class);
Model atomModel = new AtomModelWrapper(atomProducer.create()).copyAtomModel(AtomGraphType.ATOM);
int atoms = 0;
while (!atomProducer.isExhausted()) {
// indexer.indexAtomModel(atomModel, UUID.randomUUID().toString(), true);
Dataset ds = DatasetFactory.createTxnMem();
ds.addNamedModel("https://node.matchat.org/won/resource/atom/test#atom", atomModel);
AtomModelWrapper atomModelWrapper = new AtomModelWrapper(atomModel, null);
atomModel = atomModelWrapper.normalizeAtomModel();
indexer.indexAtomModel(atomModel, SolrMatcherEvaluation.createAtomId(ds), true);
atoms++;
if (atoms % 100 == 0) {
System.out.println("Indexed " + atoms + " atoms.");
}
atomModel = new AtomModelWrapper(atomProducer.create()).copyAtomModel(AtomGraphType.ATOM);
}
System.out.println("Indexed " + atoms + " atoms.");
System.exit(0);
}
Aggregations