//if(obj == null)
// System.err.println("object is null");
StringBuffer buff = new StringBuffer();
if(obj instanceof Concept){
String clr = " bgcolor=\"#EEEEEE\"";
Concept c = (Concept) obj;
buff.append("<table border=0>");
buff.append("<tr valign=top><td"+clr+">code</td><td>"+c.getCode()+"</td></tr>");
buff.append("<tr valign=top><td"+clr+">name</td><td>"+c.getName()+"</td></tr>");
SemanticType [] sem = c.getSemanticTypes();
StringBuffer sembuff = new StringBuffer();
if(sem != null && sem.length >0){
for(int j=0;j<sem.length;j++)
sembuff.append(sem[j].getName()+" ");
}
buff.append("<tr valign=top><td"+clr+">semantic types</td><td>"+sembuff+"</td></tr>");
buff.append("<tr valign=top><td"+clr+">definitions</td><td><ul>");
Definition [] def = c.getDefinitions();
if(def != null)
for(int j=0;j<def.length;j++)
buff.append("<li>"+def[j].getDefinition()+" ["+def[j].getSource()+"]</li>");
buff.append("</ul></td></tr>");
buff.append("<tr valign=top><td"+clr+">synonyms</td><td>");
String [] syn = c.getSynonyms();
if(syn != null)
for(int j=0;j<syn.length;j++)
buff.append(syn[j]+", ");
buff.append("</td></tr>");
buff.append("<tr valign=top><td"+clr+">sources</td><td>");
Source [] src = c.getSources();
if(src != null)
for(int j=0;j<src.length;j++)
buff.append(src[j]+", ");
buff.append("</td></tr>");
buff.append("<tr valign=top><td"+clr+">relations</td><td>");
Relation [] rs = c.getRelations();
if(rs != null)
for(int j=0;j<rs.length;j++){
String code = c.getCode();
try{
code = URLEncoder.encode(c.getCode(),"utf-8");
}catch(Exception ex){}
String url = servletName+"?action=get_related_concepts&relation="+rs[j].getName()+"&code="+code;
buff.append("<a href=\""+url+"\">"+rs[j].getName()+"</a>, ");
}
buff.append("</td></tr>");
buff.append("<tr valign=top><td"+clr+">codes</td><td>");
Map mp = c.getCodes();
if(mp != null)
for(Object o: mp.keySet())
buff.append(o+" = "+mp.get(o)+", ");
buff.append("</td></tr>");
buff.append("</table>");