This program returns all the synonyms for a given input. But this code is for java 1.8. How to convert this code for Java 1.6.
model.listIndividuals().forEachRemaining(ind -> {
if(((Resource)ind).getLocalName().toString().equalsIgnoreCase(input)){
System.out.println("Synonyms of " + ((Resource)ind).getLocalName().toString() + " are:");
ind.listPropertyValues(isSynonymOf).forEachRemaining(val -> {
System.out.println(" * " + ((Resource) val).getLocalName().toString());
});
}
});
Try this:
Iterator<Individual> iterInd = model.listIndividuals();
while (iterInd.hasNext()) {
Individual ind = iterInd.next();
if (ind.getLocalName().equalsIgnoreCase(input)) {
System.out.println("Synonyms of " + ind.getLocalName() + " are:");
NodeIterator iterVal = ind.listPropertyValues(isSynonymOf);
while (iterVal.hasNext()) {
System.out.println(" * " + iterVal.next().getLocalName());
}
}
}