use of org.apache.stanbol.entityhub.indexing.core.EntityDataIterable in project stanbol by apache.
the class RdfIndexingSourceTest method testBlankNodeSupport.
@Test
public void testBlankNodeSupport() {
log.info(" --- testBlankNodeSupport ---");
String testName = "bnode";
IndexingConfig config = new IndexingConfig(CONFIG_ROOT + File.separatorChar + testName, CONFIG_ROOT + '/' + testName) {
};
EntityDataIterable iterable = config.getDataIterable();
assertNotNull(iterable);
assertEquals(iterable.getClass(), RdfIndexingSource.class);
assertTrue(iterable.needsInitialisation());
iterable.initialise();
// ((RdfIndexingSource)iterable).debug();
EntityDataIterator it = iterable.entityDataIterator();
long count = 0;
while (it.hasNext()) {
String entity = it.next();
log.info("validate Entity " + entity);
assertNotNull(entity);
validateRepresentation(it.getRepresentation(), entity);
count++;
}
// check if all entities where indexed
// Expected are 3 entities First France from france.rdf
// and two from BlankNode Entities in bnode.nt
assertEquals(String.format("> %s Entities expected but only %s processed!", 3, count), 3, count);
}
use of org.apache.stanbol.entityhub.indexing.core.EntityDataIterable in project stanbol by apache.
the class RdfIndexingSourceTest method testEntityDataIterable.
@Test
public void testEntityDataIterable() {
log.info(" --- testEntityDataIterable ---");
String testName = "iterable";
IndexingConfig config = new IndexingConfig(CONFIG_ROOT + File.separatorChar + testName, CONFIG_ROOT + '/' + testName) {
};
EntityDataIterable iterable = config.getDataIterable();
assertNotNull(iterable);
assertEquals(iterable.getClass(), RdfIndexingSource.class);
assertTrue(iterable.needsInitialisation());
iterable.initialise();
EntityDataIterator it = iterable.entityDataIterator();
long count = 0;
while (it.hasNext()) {
String entity = it.next();
log.info("validate Entity " + entity);
assertNotNull(entity);
validateRepresentation(it.getRepresentation(), entity);
count++;
}
// check if all entities where indexed
// this checks if more entities are indexed as listed by the
// textEntityIDs.txt file
assertTrue(String.format("> %s Entities expected but only %s processed!", NUMBER_OF_ENTITIES_EXPECTED, count), NUMBER_OF_ENTITIES_EXPECTED <= count);
}
use of org.apache.stanbol.entityhub.indexing.core.EntityDataIterable in project stanbol by apache.
the class RdfIndexingSourceTest method testEntityDataIterable.
@Test
public void testEntityDataIterable() {
log.info(" --- testEntityDataIterable ---");
String testName = "iterable";
IndexingConfig config = new IndexingConfig(CONFIG_ROOT + File.separatorChar + testName, CONFIG_ROOT + '/' + testName) {
};
EntityDataIterable iterable = config.getDataIterable();
try {
assertNotNull(iterable);
assertEquals(iterable.getClass(), RdfIndexingSource.class);
if (iterable.needsInitialisation()) {
iterable.initialise();
}
EntityDataIterator it = iterable.entityDataIterator();
long count = 0;
while (it.hasNext()) {
String entity = it.next();
log.info("validate Entity " + entity);
assertNotNull(entity);
validateRepresentation(it.getRepresentation(), entity);
count++;
}
// check if all entities where indexed
// this checks if more entities are indexed as listed by the
// textEntityIDs.txt file
assertTrue(String.format("> %s Entities expected but only %s processed!", NUMBER_OF_ENTITIES_EXPECTED, count), NUMBER_OF_ENTITIES_EXPECTED <= count);
} finally {
// we need to ensure close is called as otherwise other tests might fail
iterable.close();
}
}
Aggregations