if (resource instanceof Individual) {
//get all individuals same as this one
for (Iterator i=resource.listSameAs(); i.hasNext();) {
Individual individual = (Individual) i.next();
//add labels
for (Iterator j =individual.listLabels(null); j.hasNext();) {
Literal l = (Literal) i.next();
synonyms.put(l.toString(), "1");
}
}
} else if (resource instanceof OntClass) {