Program: 50190
Project: 50190
Buggy source:
/** 
 * There are three possibilities 1. the ottol id is present 2. there is no ottol id but the TNRS gets one with high probability 3. there is no ottol id and the TNRS is no help For 3 (the problematic one), we will add an entry in an index and add a name to the taxonomy. This is a special case when adding things from phylografter The names that are added need to be searched if there were not matches in  the TNRS this is similar to fixNamesFromTrees but it will not add the taxon if not found. it will try and prune
 * @param studyid
 * @param trees
 * @param graphDb
 * @throws IOException
 */
public static boolean fixNamesFromTrees(List<JadeTree> trees,GraphDatabaseAgent graphDb,boolean prune,MessageLogger logger) throws IOException {
  String urlbasecontext="String_Node_Str";
  String urlbasefetch="String_Node_Str";
  logger.message("String_Node_Str");
  for (int i=0; i < trees.size(); i++) {
    JadeTree currTree=trees.get(i);
    logger.indentMessageStr(1,"String_Node_Str","String_Node_Str",(String)currTree.getObject("String_Node_Str"));
    ArrayList<JadeNode> searchnds=new ArrayList<JadeNode>();
    HashMap<String,JadeNode> namenodemap=new HashMap<String,JadeNode>();
    ArrayList<JadeNode> matchednodes=new ArrayList<JadeNode>();
    for (int j=0; j < currTree.getExternalNodeCount(); j++) {
      JadeNode ndJ=currTree.getExternalNode(j);
      if (ndJ.getObject("String_Node_Str") == null) {
        logger.indentMessageStrStr(2,"String_Node_Str","String_Node_Str",ndJ.getName(),"String_Node_Str",(String)ndJ.getObject("String_Node_Str"));
        searchnds.add(ndJ);
        namenodemap.put(ndJ.getName(),ndJ);
      }
    }
    if (searchnds.size() == 0) {
      logger.indentMessage(1,"String_Node_Str");
    }
 else {
      StringBuffer sb=new StringBuffer();
      ArrayList<String> namelist=new ArrayList<String>();
      for (int j=0; j < currTree.getExternalNodeCount(); j++) {
        namelist.add(currTree.getExternalNode(j).getName());
      }
      HashMap<String,Object> namemap=new HashMap<String,Object>();
      namemap.put("String_Node_Str",namelist);
      String contextQueryParameters=new JSONObject(namemap).toJSONString();
      System.out.println(contextQueryParameters);
      ClientConfig cc=new DefaultClientConfig();
      Client c=Client.create(cc);
      WebResource contextQuery=c.resource(urlbasecontext);
      String contextResponseJSONStr=null;
      try {
        contextQuery.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE).post(String.class,contextQueryParameters);
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str");
      }
      JSONObject contextResponse=(JSONObject)JSONValue.parse(contextResponseJSONStr);
      String cn=(String)contextResponse.get("String_Node_Str");
      ArrayList<String> namelist2=new ArrayList<String>();
      for (int j=0; j < searchnds.size(); j++) {
        if (searchnds.get(j).getObject("String_Node_Str") == null) {
          namelist2.add(searchnds.get(j).getName());
        }
      }
      HashMap<String,Object> namemap2=new HashMap<String,Object>();
      namemap2.put("String_Node_Str",namelist2);
      namemap2.put("String_Node_Str",cn);
      contextQueryParameters=new JSONObject(namemap2).toJSONString();
      cc=new DefaultClientConfig();
      c=Client.create(cc);
      contextQuery=c.resource(urlbasefetch);
      String tnrsResponseJSONStr=null;
      try {
        tnrsResponseJSONStr=contextQuery.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE).post(String.class,contextQueryParameters);
      }
 catch (      Exception x) {
        logger.indentMessageStr(1,"String_Node_Str","String_Node_Str",contextQueryParameters);
      }
      if (tnrsResponseJSONStr != null) {
        contextResponse=(JSONObject)JSONValue.parse(tnrsResponseJSONStr);
        JSONArray unm=(JSONArray)contextResponse.get("String_Node_Str");
        logger.indentMessageInt(1,"String_Node_Str","String_Node_Str",unm.size());
        JSONArray res=(JSONArray)contextResponse.get("String_Node_Str");
        for (        Object id : res) {
          JSONArray tres=(JSONArray)((JSONObject)id).get("String_Node_Str");
          String origname=(String)((JSONObject)id).get("String_Node_Str");
          for (          Object tid : tres) {
            Double score=(Double)((JSONObject)tid).get("String_Node_Str");
            boolean permat=(Boolean)((JSONObject)tid).get("String_Node_Str");
            String ottId=String.valueOf(((JSONObject)tid).get("String_Node_Str"));
            String matchedName=(String)((JSONObject)tid).get("String_Node_Str");
            if (score >= 1) {
              Long tnrsottId=Long.valueOf(ottId);
              JadeNode fixedNode=namenodemap.get(origname);
              logger.indentMessageLongStrStrStr(2,"String_Node_Str","String_Node_Str",tnrsottId,"String_Node_Str",matchedName,"String_Node_Str",origname,"String_Node_Str",(String)fixedNode.getObject("String_Node_Str"));
              fixedNode.assocObject("String_Node_Str",tnrsottId);
              matchednodes.add(namenodemap.get(origname));
              namenodemap.remove(origname);
              break;
            }
          }
        }
      }
      Index<Node> graphNodeIndex=graphDb.getNodeIndex("String_Node_Str");
      ArrayList<String> removenames=new ArrayList<String>();
      for (      String name : namenodemap.keySet()) {
        IndexHits<Node> hits=graphNodeIndex.get("String_Node_Str",name);
        if (hits.size() == 0) {
        }
 else         if (hits.size() == 1) {
          String uidString=(String)hits.getSingle().getProperty("String_Node_Str");
          Long lid=Long.valueOf(uidString);
          logger.indentMessageLong(2,"String_Node_Str",name,lid);
          namenodemap.get(name).assocObject("String_Node_Str",Long.valueOf(lid));
          removenames.add(name);
        }
 else         if (hits.size() > 1) {
          logger.indentMessageInt(2,"String_Node_Str",name,hits.size());
        }
        hits.close();
      }
      for (      String name : removenames) {
        namenodemap.remove(name);
      }
      if (namenodemap.size() > 0) {
        if (prune) {
          for (          String name : namenodemap.keySet()) {
            JadeNode jnode=namenodemap.get(name);
            logger.indentMessageStrStr(2,"String_Node_Str","String_Node_Str",name,"String_Node_Str",(String)jnode.getObject("String_Node_Str"));
            try {
              currTree.pruneExternalNode(jnode);
            }
 catch (            Exception x) {
              logger.indentMessageStr(3,"String_Node_Str","String_Node_Str",name);
              return false;
            }
          }
        }
 else {
          return false;
        }
      }
    }
    if (prune) {
      TLongHashSet tipottols=new TLongHashSet();
      HashSet<JadeNode> pru=new HashSet<JadeNode>();
      for (int j=0; j < currTree.getExternalNodeCount(); j++) {
        JadeNode currNd=currTree.getExternalNode(j);
        Long tid=(Long)currNd.getObject("String_Node_Str");
        if (tid == null) {
          logger.indentMessage(2,"String_Node_Str");
          logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNd.getName(),"String_Node_Str",(String)currNd.getObject("String_Node_Str"));
          pru.add(currNd);
        }
 else         if (tipottols.contains(tid)) {
          logger.indentMessage(2,"String_Node_Str");
          logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNd.getName(),"String_Node_Str",(String)currNd.getObject("String_Node_Str"));
          logger.indentMessageLong(3,"String_Node_Str","String_Node_Str",tid);
          pru.add(currNd);
        }
 else {
          IndexHits<Node> hits=graphDb.getNodeIndex("String_Node_Str").get("String_Node_Str",String.valueOf(tid));
          if (hits.size() == 0) {
            logger.indentMessage(2,"String_Node_Str");
            logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNd.getName(),"String_Node_Str",(String)currNd.getObject("String_Node_Str"));
            logger.indentMessageLong(3,"String_Node_Str","String_Node_Str",tid);
            pru.add(currNd);
          }
 else {
            tipottols.add(tid);
          }
          hits.close();
        }
      }
      for (int j=0; j < currTree.getExternalNodeCount(); j++) {
        JadeNode currNdJ=currTree.getExternalNode(j);
        if (pru.contains(currNdJ)) {
          continue;
        }
        Long tid=(Long)currNdJ.getObject("String_Node_Str");
        IndexHits<Node> hits=graphDb.getNodeIndex("String_Node_Str").get("String_Node_Str",String.valueOf(tid));
        Node firstNode=hits.getSingle();
        hits.close();
        TLongArrayList t1=new TLongArrayList((long[])firstNode.getProperty("String_Node_Str"));
        for (int k=0; k < currTree.getExternalNodeCount(); k++) {
          JadeNode currNdK=currTree.getExternalNode(k);
          if (pru.contains(currNdK) || k == j) {
            continue;
          }
          Long tid2=(Long)currNdK.getObject("String_Node_Str");
          IndexHits<Node> hits2=graphDb.getNodeIndex("String_Node_Str").get("String_Node_Str",String.valueOf(tid2));
          Node secondNode=hits2.getSingle();
          hits2.close();
          if (secondNode == null) {
            logger.indentMessageStr(2,"String_Node_Str","String_Node_Str",String.valueOf(tid2));
            pru.add(currNdK);
          }
 else {
            TLongArrayList t2=new TLongArrayList((long[])secondNode.getProperty("String_Node_Str"));
            if (LicaUtil.containsAnyt4jUnsorted(t1,t2)) {
              logger.indentMessage(2,"String_Node_Str");
              if (t2.size() < t1.size()) {
                pru.add(currNdJ);
                logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNdK.getName(),"String_Node_Str",(String)currNdK.getObject("String_Node_Str"));
                logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNdJ.getName(),"String_Node_Str",(String)currNdJ.getObject("String_Node_Str"));
                break;
              }
 else {
                pru.add(currNdK);
                logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNdJ.getName(),"String_Node_Str",(String)currNdJ.getObject("String_Node_Str"));
                logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNdK.getName(),"String_Node_Str",(String)currNdK.getObject("String_Node_Str"));
              }
            }
          }
        }
      }
      for (      JadeNode tn : pru) {
        logger.indentMessageStrStr(2,"String_Node_Str","String_Node_Str",tn.getName(),"String_Node_Str",(String)tn.getObject("String_Node_Str"));
        try {
          currTree.pruneExternalNode(tn);
        }
 catch (        Exception x) {
          logger.indentMessageStr(3,"String_Node_Str","String_Node_Str",tn.getName());
          return false;
        }
      }
      currTree.processRoot();
      if (prune == true) {
        logger.indentMessageStr(1,"String_Node_Str","String_Node_Str",currTree.getRoot().getNewick(false));
      }
    }
    logger.indentMessage(1,"String_Node_Str");
    for (int k=0; k < currTree.getExternalNodeCount(); k++) {
      JadeNode ndK=currTree.getExternalNode(k);
      Long tid=(Long)ndK.getObject("String_Node_Str");
      IndexHits<Node> hits=graphDb.getNodeIndex("String_Node_Str").get("String_Node_Str",String.valueOf(tid));
      Node firstNode=hits.getSingle();
      hits.close();
      Node cnode=firstNode;
      if (cnode == null) {
        logger.indentMessageLongStrStr(2,"String_Node_Str","String_Node_Str",tid,"String_Node_Str",ndK.getName(),"String_Node_Str",(String)ndK.getObject("String_Node_Str"));
      }
 else {
        String cnodeName=(String)cnode.getProperty("String_Node_Str");
        StringBuffer sb=new StringBuffer();
        sb.append(cnodeName == null ? "String_Node_Str" : cnodeName);
        while (cnode.hasRelationship(Direction.OUTGOING,RelType.TAXCHILDOF)) {
          cnode=cnode.getSingleRelationship(RelType.TAXCHILDOF,Direction.OUTGOING).getEndNode();
          cnodeName=(String)cnode.getProperty("String_Node_Str");
          sb.append("String_Node_Str");
          sb.append(cnodeName == null ? "String_Node_Str" : cnodeName);
        }
        logger.indentMessageLongStrStr(2,"String_Node_Str","String_Node_Str",tid,"String_Node_Str",sb.toString(),"String_Node_Str",(String)ndK.getObject("String_Node_Str"));
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * There are three possibilities 1. the ottol id is present 2. there is no ottol id but the TNRS gets one with high probability 3. there is no ottol id and the TNRS is no help For 3 (the problematic one), we will add an entry in an index and add a name to the taxonomy. This is a special case when adding things from phylografter The names that are added need to be searched if there were not matches in  the TNRS this is similar to fixNamesFromTrees but it will not add the taxon if not found. it will try and prune
 * @param studyid
 * @param trees
 * @param graphDb
 * @throws IOException
 */
public static boolean fixNamesFromTrees(List<JadeTree> trees,GraphDatabaseAgent graphDb,boolean prune,MessageLogger logger) throws IOException {
  String urlbasecontext="String_Node_Str";
  String urlbasefetch="String_Node_Str";
  logger.message("String_Node_Str");
  for (int i=0; i < trees.size(); i++) {
    JadeTree currTree=trees.get(i);
    logger.indentMessageStr(1,"String_Node_Str","String_Node_Str",(String)currTree.getObject("String_Node_Str"));
    ArrayList<JadeNode> searchnds=new ArrayList<JadeNode>();
    HashMap<String,JadeNode> namenodemap=new HashMap<String,JadeNode>();
    ArrayList<JadeNode> matchednodes=new ArrayList<JadeNode>();
    for (int j=0; j < currTree.getExternalNodeCount(); j++) {
      JadeNode ndJ=currTree.getExternalNode(j);
      if (ndJ.getObject("String_Node_Str") == null) {
        logger.indentMessageStrStr(2,"String_Node_Str","String_Node_Str",ndJ.getName(),"String_Node_Str",(String)ndJ.getObject("String_Node_Str"));
        searchnds.add(ndJ);
        namenodemap.put(ndJ.getName(),ndJ);
      }
    }
    if (searchnds.size() == 0) {
      logger.indentMessage(1,"String_Node_Str");
    }
 else {
      StringBuffer sb=new StringBuffer();
      ArrayList<String> namelist=new ArrayList<String>();
      for (int j=0; j < currTree.getExternalNodeCount(); j++) {
        namelist.add(currTree.getExternalNode(j).getName());
      }
      HashMap<String,Object> namemap=new HashMap<String,Object>();
      namemap.put("String_Node_Str",namelist);
      String contextQueryParameters=new JSONObject(namemap).toJSONString();
      System.out.println(contextQueryParameters);
      ClientConfig cc=new DefaultClientConfig();
      Client c=Client.create(cc);
      WebResource contextQuery=c.resource(urlbasecontext);
      String contextResponseJSONStr=null;
      try {
        contextQuery.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE).post(String.class,contextQueryParameters);
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str");
      }
      if (contextResponseJSONStr != null) {
        JSONObject contextResponse=(JSONObject)JSONValue.parse(contextResponseJSONStr);
        String cn=(String)contextResponse.get("String_Node_Str");
        ArrayList<String> namelist2=new ArrayList<String>();
        for (int j=0; j < searchnds.size(); j++) {
          if (searchnds.get(j).getObject("String_Node_Str") == null) {
            namelist2.add(searchnds.get(j).getName());
          }
        }
        HashMap<String,Object> namemap2=new HashMap<String,Object>();
        namemap2.put("String_Node_Str",namelist2);
        namemap2.put("String_Node_Str",cn);
        contextQueryParameters=new JSONObject(namemap2).toJSONString();
        cc=new DefaultClientConfig();
        c=Client.create(cc);
        contextQuery=c.resource(urlbasefetch);
        String tnrsResponseJSONStr=null;
        try {
          tnrsResponseJSONStr=contextQuery.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE).post(String.class,contextQueryParameters);
        }
 catch (        Exception x) {
          logger.indentMessageStr(1,"String_Node_Str","String_Node_Str",contextQueryParameters);
        }
        if (tnrsResponseJSONStr != null) {
          contextResponse=(JSONObject)JSONValue.parse(tnrsResponseJSONStr);
          JSONArray unm=(JSONArray)contextResponse.get("String_Node_Str");
          logger.indentMessageInt(1,"String_Node_Str","String_Node_Str",unm.size());
          JSONArray res=(JSONArray)contextResponse.get("String_Node_Str");
          for (          Object id : res) {
            JSONArray tres=(JSONArray)((JSONObject)id).get("String_Node_Str");
            String origname=(String)((JSONObject)id).get("String_Node_Str");
            for (            Object tid : tres) {
              Double score=(Double)((JSONObject)tid).get("String_Node_Str");
              boolean permat=(Boolean)((JSONObject)tid).get("String_Node_Str");
              String ottId=String.valueOf(((JSONObject)tid).get("String_Node_Str"));
              String matchedName=(String)((JSONObject)tid).get("String_Node_Str");
              if (score >= 1) {
                Long tnrsottId=Long.valueOf(ottId);
                JadeNode fixedNode=namenodemap.get(origname);
                logger.indentMessageLongStrStrStr(2,"String_Node_Str","String_Node_Str",tnrsottId,"String_Node_Str",matchedName,"String_Node_Str",origname,"String_Node_Str",(String)fixedNode.getObject("String_Node_Str"));
                fixedNode.assocObject("String_Node_Str",tnrsottId);
                matchednodes.add(namenodemap.get(origname));
                namenodemap.remove(origname);
                break;
              }
            }
          }
        }
        Index<Node> graphNodeIndex=graphDb.getNodeIndex("String_Node_Str");
        ArrayList<String> removenames=new ArrayList<String>();
        for (        String name : namenodemap.keySet()) {
          IndexHits<Node> hits=graphNodeIndex.get("String_Node_Str",name);
          if (hits.size() == 0) {
          }
 else           if (hits.size() == 1) {
            String uidString=(String)hits.getSingle().getProperty("String_Node_Str");
            Long lid=Long.valueOf(uidString);
            logger.indentMessageLong(2,"String_Node_Str",name,lid);
            namenodemap.get(name).assocObject("String_Node_Str",Long.valueOf(lid));
            removenames.add(name);
          }
 else           if (hits.size() > 1) {
            logger.indentMessageInt(2,"String_Node_Str",name,hits.size());
          }
          hits.close();
        }
        for (        String name : removenames) {
          namenodemap.remove(name);
        }
        if (namenodemap.size() > 0) {
          if (prune) {
            for (            String name : namenodemap.keySet()) {
              JadeNode jnode=namenodemap.get(name);
              logger.indentMessageStrStr(2,"String_Node_Str","String_Node_Str",name,"String_Node_Str",(String)jnode.getObject("String_Node_Str"));
              try {
                currTree.pruneExternalNode(jnode);
              }
 catch (              Exception x) {
                logger.indentMessageStr(3,"String_Node_Str","String_Node_Str",name);
                return false;
              }
            }
          }
 else {
            return false;
          }
        }
      }
    }
    if (prune) {
      TLongHashSet tipottols=new TLongHashSet();
      HashSet<JadeNode> pru=new HashSet<JadeNode>();
      for (int j=0; j < currTree.getExternalNodeCount(); j++) {
        JadeNode currNd=currTree.getExternalNode(j);
        Long tid=(Long)currNd.getObject("String_Node_Str");
        if (tid == null) {
          logger.indentMessage(2,"String_Node_Str");
          logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNd.getName(),"String_Node_Str",(String)currNd.getObject("String_Node_Str"));
          pru.add(currNd);
        }
 else         if (tipottols.contains(tid)) {
          logger.indentMessage(2,"String_Node_Str");
          logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNd.getName(),"String_Node_Str",(String)currNd.getObject("String_Node_Str"));
          logger.indentMessageLong(3,"String_Node_Str","String_Node_Str",tid);
          pru.add(currNd);
        }
 else {
          IndexHits<Node> hits=graphDb.getNodeIndex("String_Node_Str").get("String_Node_Str",String.valueOf(tid));
          if (hits.size() == 0) {
            logger.indentMessage(2,"String_Node_Str");
            logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNd.getName(),"String_Node_Str",(String)currNd.getObject("String_Node_Str"));
            logger.indentMessageLong(3,"String_Node_Str","String_Node_Str",tid);
            pru.add(currNd);
          }
 else {
            tipottols.add(tid);
          }
          hits.close();
        }
      }
      for (int j=0; j < currTree.getExternalNodeCount(); j++) {
        JadeNode currNdJ=currTree.getExternalNode(j);
        if (pru.contains(currNdJ)) {
          continue;
        }
        Long tid=(Long)currNdJ.getObject("String_Node_Str");
        IndexHits<Node> hits=graphDb.getNodeIndex("String_Node_Str").get("String_Node_Str",String.valueOf(tid));
        Node firstNode=hits.getSingle();
        hits.close();
        TLongArrayList t1=new TLongArrayList((long[])firstNode.getProperty("String_Node_Str"));
        for (int k=0; k < currTree.getExternalNodeCount(); k++) {
          JadeNode currNdK=currTree.getExternalNode(k);
          if (pru.contains(currNdK) || k == j) {
            continue;
          }
          Long tid2=(Long)currNdK.getObject("String_Node_Str");
          IndexHits<Node> hits2=graphDb.getNodeIndex("String_Node_Str").get("String_Node_Str",String.valueOf(tid2));
          Node secondNode=hits2.getSingle();
          hits2.close();
          if (secondNode == null) {
            logger.indentMessageStr(2,"String_Node_Str","String_Node_Str",String.valueOf(tid2));
            pru.add(currNdK);
          }
 else {
            TLongArrayList t2=new TLongArrayList((long[])secondNode.getProperty("String_Node_Str"));
            if (LicaUtil.containsAnyt4jUnsorted(t1,t2)) {
              logger.indentMessage(2,"String_Node_Str");
              if (t2.size() < t1.size()) {
                pru.add(currNdJ);
                logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNdK.getName(),"String_Node_Str",(String)currNdK.getObject("String_Node_Str"));
                logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNdJ.getName(),"String_Node_Str",(String)currNdJ.getObject("String_Node_Str"));
                break;
              }
 else {
                pru.add(currNdK);
                logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNdJ.getName(),"String_Node_Str",(String)currNdJ.getObject("String_Node_Str"));
                logger.indentMessageStrStr(3,"String_Node_Str","String_Node_Str",currNdK.getName(),"String_Node_Str",(String)currNdK.getObject("String_Node_Str"));
              }
            }
          }
        }
      }
      for (      JadeNode tn : pru) {
        logger.indentMessageStrStr(2,"String_Node_Str","String_Node_Str",tn.getName(),"String_Node_Str",(String)tn.getObject("String_Node_Str"));
        try {
          currTree.pruneExternalNode(tn);
        }
 catch (        Exception x) {
          logger.indentMessageStr(3,"String_Node_Str","String_Node_Str",tn.getName());
          return false;
        }
      }
      currTree.processRoot();
      if (prune == true) {
        logger.indentMessageStr(1,"String_Node_Str","String_Node_Str",currTree.getRoot().getNewick(false));
      }
    }
    logger.indentMessage(1,"String_Node_Str");
    for (int k=0; k < currTree.getExternalNodeCount(); k++) {
      JadeNode ndK=currTree.getExternalNode(k);
      Long tid=(Long)ndK.getObject("String_Node_Str");
      IndexHits<Node> hits=graphDb.getNodeIndex("String_Node_Str").get("String_Node_Str",String.valueOf(tid));
      Node firstNode=hits.getSingle();
      hits.close();
      Node cnode=firstNode;
      if (cnode == null) {
        logger.indentMessageLongStrStr(2,"String_Node_Str","String_Node_Str",tid,"String_Node_Str",ndK.getName(),"String_Node_Str",(String)ndK.getObject("String_Node_Str"));
      }
 else {
        String cnodeName=(String)cnode.getProperty("String_Node_Str");
        StringBuffer sb=new StringBuffer();
        sb.append(cnodeName == null ? "String_Node_Str" : cnodeName);
        while (cnode.hasRelationship(Direction.OUTGOING,RelType.TAXCHILDOF)) {
          cnode=cnode.getSingleRelationship(RelType.TAXCHILDOF,Direction.OUTGOING).getEndNode();
          cnodeName=(String)cnode.getProperty("String_Node_Str");
          sb.append("String_Node_Str");
          sb.append(cnodeName == null ? "String_Node_Str" : cnodeName);
        }
        logger.indentMessageLongStrStr(2,"String_Node_Str","String_Node_Str",tid,"String_Node_Str",sb.toString(),"String_Node_Str",(String)ndK.getObject("String_Node_Str"));
      }
    }
  }
  return true;
}