Search in sources :

Example 1 with EntityhubSearcher

use of org.apache.stanbol.enhancer.engines.keywordextraction.linking.impl.EntityhubSearcher in project stanbol by apache.

the class KeywordLinkingEngine method activateEntitySearcher.

/**
 * Initialise the {@link #entitySearcher} based on the value of the
 * {@link #REFERENCED_SITE_ID} property in the parsed configuration
 * @param context
 * @param configuration
 * @throws ConfigurationException
 */
protected void activateEntitySearcher(ComponentContext context, Dictionary<String, Object> configuration) throws ConfigurationException {
    Object value = configuration.get(REFERENCED_SITE_ID);
    // init the EntitySource
    if (value == null) {
        throw new ConfigurationException(REFERENCED_SITE_ID, "The ID of the Referenced Site is a required Parameter and MUST NOT be NULL!");
    }
    referencedSiteName = value.toString();
    if (referencedSiteName.isEmpty()) {
        throw new ConfigurationException(REFERENCED_SITE_ID, "The ID of the Referenced Site is a required Parameter and MUST NOT be an empty String!");
    }
    // TODO: make limit configurable!
    if (Entityhub.ENTITYHUB_IDS.contains(referencedSiteName.toLowerCase())) {
        entitySearcher = new EntityhubSearcher(context.getBundleContext(), 10);
    } else {
        entitySearcher = new ReferencedSiteSearcher(context.getBundleContext(), referencedSiteName, 10);
    }
}
Also used : ConfigurationException(org.osgi.service.cm.ConfigurationException) ReferencedSiteSearcher(org.apache.stanbol.enhancer.engines.keywordextraction.linking.impl.ReferencedSiteSearcher) EntityhubSearcher(org.apache.stanbol.enhancer.engines.keywordextraction.linking.impl.EntityhubSearcher)

Aggregations

EntityhubSearcher (org.apache.stanbol.enhancer.engines.keywordextraction.linking.impl.EntityhubSearcher)1 ReferencedSiteSearcher (org.apache.stanbol.enhancer.engines.keywordextraction.linking.impl.ReferencedSiteSearcher)1 ConfigurationException (org.osgi.service.cm.ConfigurationException)1