Set<Source> sources = new HashSet<Source>();
Set<Term> terms = new HashSet<Term>();
Set<SemanticType> semanticTypes = new LinkedHashSet<SemanticType>();
Set<Definition> definitions = new LinkedHashSet<Definition>();
Map<String, Source> codes = new HashMap<String,Source>();
Term preferred = null;
// lookup main concept info
PreparedStatement st = con.prepareStatement("SELECT * FROM mrconso WHERE cui = ? "+((lang != null)?" AND lat = ?":""));
st.setString(1,cui);
if(lang != null)
st.setString(2,lang);
ResultSet result = st.executeQuery();
while(result.next()){
String src = result.getString("sab");
String text = result.getString("str");
String lang = result.getString("lat");
String form = result.getString("tty");
String code = result.getString("code");
String pref = result.getString("ispref");
Source source = Source.getSource(src);
Term term = new Term(text);
term.setForm(form);
term.setLanguage(lang);
term.setSource(source);
if("y".equalsIgnoreCase(pref))
term.setPreferred(true);
synonyms.add(text);
sources.add(source);
terms.add(term);
codes.put(code,source);
if(preferred == null && term.isPreferred())
preferred = term;
}
result.close();
st.close();