Occurrences oc = occurences.get(key);
if (oc != null) {
//Yes : increment occurence count
oc.addOccurrences(oc.getOccurrences() + 1);
//...and reference the document
oc.addDocument(doc);
} else {
//No : create a new occurence with EPSG4326_WKT as "term"
oc = new Occurrences(entry.getValue());
//... with a count set to 1
oc.addOccurrences(1);