public List<OntologyTerm> getParents(boolean includeCyclic) { if (parents != null) { return parents; } try { this.parents = new ArrayList<OntologyTerm>(searcher.searchByChildId(id, 0, Integer.MAX_VALUE)); } catch (Exception e) { throw new IllegalStateException("Problem getting parents for document: " + id, e); } return parents; }
public List<OntologyTerm> getParents(boolean includeCyclic) { if (parents != null) { return parents; } try { final QueryResponse queryResponse = searcher.searchByChildId(id, 0, Integer.MAX_VALUE); this.parents = new ArrayList<OntologyTerm>( queryResponse.getResults().size() ); parents.addAll(processParentsHits(queryResponse, id)); } catch (Exception e) { throw new IllegalStateException("Problem getting parents for document: " + id, e); } return parents; }
private String findNameAndSynonyms(OntologySearcher searcher, String id, String defaultValue) throws SolrServerException { QueryResponse queryResponse = searcher.searchByChildId(id, 0, 1); String childName = null; if (queryResponse.getResults().getNumFound() > 0) { final SolrDocument solrDocument = queryResponse.getResults().iterator().next(); childName = (String) solrDocument.getFieldValue(OntologyFieldNames.CHILD_NAME); Collection<Object> fieldValues = solrDocument.getFieldValues(OntologyFieldNames.CHILDREN_SYNONYMS); synonymsStr = new HashSet<String>(); if(fieldValues != null){ for (Object fieldValue : fieldValues) { synonymsStr.add(fieldValue.toString()); } } } return childName == null ? defaultValue : childName; }