com.ontotext.kim.model.EntityPriority Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gazetteer-lkb Show documentation
Show all versions of gazetteer-lkb Show documentation
A Large Knowledge Based (LKB) Gazetteer
The newest version!
package com.ontotext.kim.model;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import com.ontotext.kim.KIMConstants;
import com.ontotext.kim.client.KIMException;
public class EntityPriority implements KIMConstants {
protected final static String PRIORITY_CONF_FILE = "./config/entity-priority.conf";
protected final String PRIORITY_CLASS_PREFIX = "priority.class.";
protected final String PRIORITY_INSTANCE_PREFIX = "priority.instance.";
protected final String PRIORITY_RULE_PREFIX = "priority.rule";
protected Properties m_prop;
protected int m_nDefaultInstancePriority;
protected int m_nDefaultClassPriority;
protected int m_nThreshold;
protected boolean m_bFilterLookups;
protected Map m_hClassPrio;
protected Map m_hInstPrio;
protected Map m_hRules;
/**
* read the config file
*/
public EntityPriority() {
m_hClassPrio = new HashMap(50);
m_hInstPrio = new HashMap(50);
m_hRules = new HashMap(100);
m_prop = new Properties();
}
public void init() throws Exception {
m_prop.load(new FileInputStream(new File(System.getProperty(
"kim.home.dir", "."), PRIORITY_CONF_FILE.substring(1))));
m_nDefaultInstancePriority = Integer.parseInt(m_prop
.getProperty("priority.default.instance"));
m_nDefaultClassPriority = Integer.parseInt(m_prop
.getProperty("priority.default.class"));
m_nThreshold = Integer.parseInt(m_prop
.getProperty("priority.threshold"));
m_bFilterLookups = (m_prop.getProperty("priority.filterLookups") == null) ? false
: Boolean.parseBoolean(m_prop
.getProperty("priority.filterLookups"));
// init class and instance priority
for (Iterator
© 2015 - 2024 Weber Informatics LLC | Privacy Policy