/* * Add specified closure of OWLObject to annotation and bioentity docs. * Not the map for bio. */ private Map<String, String> addClosureToAnnAndBio( List<String> relations, String closureName, String closureNameLabel, String closureMap, OWLObject cls, OWLGraphWrapper graph, SolrInputDocument ann_doc, SolrInputDocument bio_doc, boolean isNegated) { // Add closures to doc; label and id. graph.addPropertyIdsForMaterialization(relations); final Map<String, String> cmap = graph.getRelationClosureMap(cls, relations); List<String> idClosure = new ArrayList<String>(cmap.keySet()); List<String> labelClosure = new ArrayList<String>(cmap.values()); ann_doc.addField(closureName, idClosure); ann_doc.addField(closureNameLabel, labelClosure); // WARNING this is a side effect for the bio-entity // only add the class and closure, if it is a non-negated annotation if (isNegated == false) { for (String tid : idClosure) { addFieldUnique(bio_doc, closureName, tid); } for (String tlabel : labelClosure) { addFieldUnique(bio_doc, closureNameLabel, tlabel); } } // Compile closure maps to JSON. if (!cmap.isEmpty()) { String jsonized_cmap = gson.toJson(cmap); ann_doc.addField(closureMap, jsonized_cmap); // NOTE: This is harder since we'd be adding multiple, so the is done on a collector variable // elsewhere. // bio_doc.addField(closureMap, jsonized_cmap); } if (isNegated) { // WARNING this is a side effect for the bio-entity // only add the class and closure, if it is a non-negated annotation return Collections.emptyMap(); } return cmap; }