@@ -0,0 +1,1843 @@
+package similarquestions;%0A%0Aimport java.util.Set;%0Aimport java.io.File;%0Aimport java.util.HashSet;%0Aimport java.util.Iterator;%0A%0Aimport org.neo4j.graphdb.Direction;%0Aimport org.neo4j.graphdb.GraphDatabaseService;%0Aimport org.neo4j.graphdb.Node;%0Aimport org.neo4j.graphdb.Relationship;%0Aimport org.neo4j.graphdb.ResourceIterator;%0Aimport org.neo4j.graphdb.Transaction;%0Aimport org.neo4j.graphdb.factory.GraphDatabaseFactory;%0Aimport graphmodel.ManageElements;%0A%0Apublic class QaLinkedCodeWriter %7B%0A%0A%09SimilarQuestionTaskConfig config = null;%0A%09%0A%09public static void main(String%5B%5D args)%7B%0A%09%09QaLinkedCodeWriter p=new QaLinkedCodeWriter(%22apache-poi%22);%0A%09%09p.run();%0A%09%7D%0A%0A%09public QaLinkedCodeWriter(String projectName) %7B%0A%09%09config = new SimilarQuestionTaskConfig(projectName);%0A%09%7D%0A%0A%09public void run()%7B%0A%09%09GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(new File(config.graphPath));%0A%09%09try (Transaction tx = db.beginTx())%7B%0A%09%09%09ResourceIterator%3CNode%3E nodes=db.getAllNodes().iterator();%0A%09%09%09while (nodes.hasNext())%7B%0A%09%09%09%09Node node=nodes.next();%0A%09%09%09%09if (!node.hasLabel(ManageElements.Labels.QUESTION)&&!node.hasLabel(ManageElements.Labels.ANSWER))%0A%09%09%09%09%09continue;%0A%09%09%09%09Set%3CLong%3E codeSet=new HashSet%3CLong%3E();%0A%09%09%09%09Iterator%3CRelationship%3E rels=node.getRelationships(ManageElements.RelTypes.DOC_LEVEL_REFER,Direction.OUTGOING).iterator();%0A%09%09%09%09while (rels.hasNext())%0A%09%09%09%09%09codeSet.add(rels.next().getEndNode().getId());%0A%09%09%09%09rels=node.getRelationships(ManageElements.RelTypes.LEX_LEVEL_REFER,Direction.OUTGOING).iterator();%0A%09%09%09%09while (rels.hasNext())%0A%09%09%09%09%09codeSet.add(rels.next().getEndNode().getId());%0A%09%09%09%09if (codeSet.size()==0)%0A%09%09%09%09%09continue;%0A%09%09%09%09String codeLine=%22%22;%0A%09%09%09%09for (Long id:codeSet)%0A%09%09%09%09%09codeLine+=id+%22 %22;%0A%09%09%09%09codeLine=codeLine.trim();%0A%09%09%09%09node.setProperty(SimilarQuestionTaskConfig.CODES_LINE, codeLine);%0A%09%09%09%7D%0A%09%09%09tx.success();%0A%09%09%7D%0A%09%09db.shutdown();%0A%09%7D%0A%0A%7D%0A

Add QaLinkedCodeWriter.