use of org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig in project stanbol by apache.
the class SolrYardIndexingDestinationTest method testWithSolrConf.
@Test
public void testWithSolrConf() throws YardException, IOException {
String testName = "withSolrConf";
IndexingConfig config = new IndexingConfig(CONFIG_ROOT + File.separatorChar + testName, CONFIG_ROOT + '/' + testName) {
};
validateSolrDestination(config);
}
use of org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig 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();
}
}
use of org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig in project stanbol by apache.
the class ConfigTest method testEntityIdIteratorConfig.
@Test
public void testEntityIdIteratorConfig() {
IndexingConfig config = new IndexingConfig();
EntityIterator iterator = config.getEntityIdIterator();
ScoreNormaliser normaliser = config.getNormaliser();
if (iterator.needsInitialisation()) {
iterator.initialise();
}
float lastScore = Float.MAX_VALUE;
float lastNormalisedScore = 1f;
while (iterator.hasNext()) {
EntityScore entity = iterator.next();
assertNotNull(entity);
assertNotNull(entity.id);
assertNotNull(entity.score);
//log.info("Entity: {}",entity);
assertTrue(entity.id.startsWith("http://dbpedia.org/resource/"));
float score = entity.score.floatValue();
assertTrue(score > 0);
assertTrue(score <= lastScore);
lastScore = score;
Float normalisedScore = normaliser.normalise(entity.score);
assertNotNull(normalisedScore);
float nScore = normalisedScore.floatValue();
assertTrue(nScore <= lastNormalisedScore);
if (score < 2) {
//the value of "min-score" in minincoming
log.info("score=" + score + " nScore=" + nScore);
assertTrue(nScore < 0);
return;
} else {
assertTrue(nScore > 0);
}
}
}
use of org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig in project stanbol by apache.
the class FieldValueFilter method setConfiguration.
@Override
public void setConfiguration(Map<String, Object> config) {
log.info("> configure {}", getClass().getSimpleName());
IndexingConfig indexingConfig = (IndexingConfig) config.get(IndexingConfig.KEY_INDEXING_CONFIG);
nsPrefixProvider = indexingConfig.getNamespacePrefixService();
Object value = config.get(PARAM_FIELD);
if (value == null || value.toString().isEmpty()) {
this.field = getUri(DEFAULT_FIELD);
} else {
this.field = getUri(value.toString());
}
log.info(" - field: {}", field);
value = config.get(PARAM_VALUES);
log.info(" - filters:");
parseFilterConfig(value);
}
use of org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig in project stanbol by apache.
the class EntityIneratorToScoreProviderAdapter method setConfiguration.
@Override
public void setConfiguration(Map<String, Object> config) {
//the IndexingConfig is available via the IndexingConfig.KEY_INDEXING_CONFIG key!
IndexingConfig indexingConfig = (IndexingConfig) config.get(IndexingConfig.KEY_INDEXING_CONFIG);
//configure first the EntityIterator to adapt
entityIterator = indexingConfig.getEntityIdIterator();
if (entityIterator == null) {
throw new IllegalArgumentException("No EntityIterator available via the indexing configuration " + indexingConfig.getName());
}
}
Aggregations