@Service @Property(name="stanbol.enhancer.engine.name",value="geonames") @Property(name="service.ranking",intValue=-100) public class LocationEnhancementEngine extends org.apache.stanbol.enhancer.servicesapi.impl.AbstractEnhancementEngine<IOException,RuntimeException> implements org.apache.stanbol.enhancer.servicesapi.EnhancementEngine, org.apache.stanbol.enhancer.servicesapi.ServiceProperties
| Modifier and Type | Field and Description |
|---|---|
static org.apache.clerezza.commons.rdf.IRI |
CONCEPT_GEONAMES_FEATURE |
static String |
DEFAULT_ENGINE_NAME |
static int |
DEFAULT_SERVICE_RANKING
Default value for the
Constants.SERVICE_RANKING used by this engine. |
static Integer |
defaultOrder
The default value for the Execution of this Engine.
|
static Map<FeatureClass,Collection<org.apache.clerezza.commons.rdf.IRI>> |
FEATURE_CLASS_CONCEPT_MAPPINGS
This maps geonames.org feature classes to dbpedia.org ontology classes
|
static Map<String,Collection<org.apache.clerezza.commons.rdf.IRI>> |
FEATURE_TYPE_CONCEPT_MAPPINGS |
static String |
GEONAMES_ANONYMOUS_SERVICE_STATE
The useage of the anonymous server is deactivated by default because it
is often overloaded and therefore causes randomly errors.
|
static String |
GEONAMES_SERVER_URL |
static String |
GEONAMES_TOKEN |
static String |
GEONAMES_USERNAME |
protected GeonamesAPIWrapper |
geonamesService
The geonames.org API wrapper used to make service requests
|
static String |
MAX_LOCATION_ENHANCEMENTS |
static String |
MIN_HIERARCHY_SCORE |
static String |
MIN_SCORE |
CANNOT_ENHANCE, ENHANCE_ASYNC, ENHANCE_SYNCHRONOUS, PROPERTY_NAMEENHANCEMENT_ENGINE_ORDERING, ORDERING_CONTENT_EXTRACTION, ORDERING_DEFAULT, ORDERING_EXTRACTION_ENHANCEMENT, ORDERING_NLP_CHUNK, ORDERING_NLP_LANGAUGE_DETECTION, ORDERING_NLP_LEMMATIZE, ORDERING_NLP_NER, ORDERING_NLP_POS, ORDERING_NLP_SENTENCE_DETECTION, ORDERING_NLP_TOKENIZING, ORDERING_POST_PROCESSING, ORDERING_PRE_PROCESSING| Constructor and Description |
|---|
LocationEnhancementEngine() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(org.osgi.service.component.ComponentContext ce) |
int |
canEnhance(org.apache.stanbol.enhancer.servicesapi.ContentItem ci) |
void |
computeEnhancements(org.apache.stanbol.enhancer.servicesapi.ContentItem ci) |
protected void |
deactivate(org.osgi.service.component.ComponentContext ce) |
protected Collection<Toponym> |
getHierarchy(Toponym toponym)
Returns the hierarchy for the parsed toponym.
|
Integer |
getMaxLocationEnhancements()
Getter for the maximum number of enhancements added for a single
TextAnnotation.
|
Double |
getMinHierarchyScore()
Setter for the minimum value used to decide based on the score of
locations returned by the geonames.org web service if also the hierarchy
of that point should be added as enhancements to the analysed
content item.
|
Double |
getMinScore()
Getter for the minimum score used to decide if results of geoname.org
search results are added as EntityEnhancements to the ContentItem
|
Map<String,Object> |
getServiceProperties() |
void |
setMaxLocationEnhancements(Integer maxNumber)
Setter for the maximum number of enhancements added for a single
TextAnnotation.
|
void |
setMinHierarchyScore(Double minHierarchyScore)
Setter for the minimum value used to decide based on the score of
locations returned by the geonames.org web service if also the hierarchy
of that point should be added as enhancements to the analysed
content item.
|
void |
setMinScore(Double minScore)
Setter for the minimum score used to decide if results of geoname.org
search results are added as EntityEnhancements to the ContentItem.
|
getName, toStringpublic static final String DEFAULT_ENGINE_NAME
public static final int DEFAULT_SERVICE_RANKING
Constants.SERVICE_RANKING used by this engine.
This is a negative value to allow easy replacement by this engine depending
to a remote service with one that does not have this requirementpublic static final Integer defaultOrder
ServiceProperties.ORDERING_EXTRACTION_ENHANCEMENTpublic static final Map<FeatureClass,Collection<org.apache.clerezza.commons.rdf.IRI>> FEATURE_CLASS_CONCEPT_MAPPINGS
public static final Map<String,Collection<org.apache.clerezza.commons.rdf.IRI>> FEATURE_TYPE_CONCEPT_MAPPINGS
@Property(doubleValue=0.33) public static final String MIN_SCORE
@Property(intValue=3) public static final String MAX_LOCATION_ENHANCEMENTS
@Property(doubleValue=0.7) public static final String MIN_HIERARCHY_SCORE
public static final org.apache.clerezza.commons.rdf.IRI CONCEPT_GEONAMES_FEATURE
@Property(value="http://api.geonames.org/") public static final String GEONAMES_SERVER_URL
@Property(boolValue=false) public static final String GEONAMES_ANONYMOUS_SERVICE_STATE
@Property public static final String GEONAMES_USERNAME
@Property public static final String GEONAMES_TOKEN
protected GeonamesAPIWrapper geonamesService
protected void activate(org.osgi.service.component.ComponentContext ce)
throws IOException,
org.osgi.service.cm.ConfigurationException
activate in class org.apache.stanbol.enhancer.servicesapi.impl.AbstractEnhancementEngine<IOException,RuntimeException>IOExceptionorg.osgi.service.cm.ConfigurationExceptionprotected void deactivate(org.osgi.service.component.ComponentContext ce)
deactivate in class org.apache.stanbol.enhancer.servicesapi.impl.AbstractEnhancementEngine<IOException,RuntimeException>public int canEnhance(org.apache.stanbol.enhancer.servicesapi.ContentItem ci)
throws org.apache.stanbol.enhancer.servicesapi.EngineException
canEnhance in interface org.apache.stanbol.enhancer.servicesapi.EnhancementEngineorg.apache.stanbol.enhancer.servicesapi.EngineExceptionpublic void computeEnhancements(org.apache.stanbol.enhancer.servicesapi.ContentItem ci)
throws org.apache.stanbol.enhancer.servicesapi.EngineException
computeEnhancements in interface org.apache.stanbol.enhancer.servicesapi.EnhancementEngineorg.apache.stanbol.enhancer.servicesapi.EngineExceptionprotected Collection<Toponym> getHierarchy(Toponym toponym) throws Exception
toponym - the toponymException - on any error while accessing the webservicepublic final Integer getMaxLocationEnhancements()
public final void setMaxLocationEnhancements(Integer maxNumber)
null or < 1, than the
value is set to DEFAULT_MAX_LOCATION_ENHANCEMENTS.maxNumber - the maximum number of enhancements added to a singel
text annotationpublic Map<String,Object> getServiceProperties()
getServiceProperties in interface org.apache.stanbol.enhancer.servicesapi.ServicePropertiespublic void setMinScore(Double minScore)
null is parsed the value is set to
DEFAULT_MIN_SCORE. For values > 1 the
value is set to 1 and for values < 0 the value is set to 0.minScore - the minScore to setpublic Double getMinScore()
public void setMinHierarchyScore(Double minHierarchyScore)
null is parsed the value is set to
DEFAULT_MIN_HIERARCHY_SCORE.
For values > 1 the value is set to 1 and for values < 0 the value
is set to 0.minHierarchyScore - the minHierarchyScore to setpublic Double getMinHierarchyScore()
Copyright © 2010–2016 The Apache Software Foundation. All rights reserved.