有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Neoclipse图中缺少java节点

enter image description here我在java中创建了Neo4j节点和关系,它们的值来自DB。当我试图在Neoclipse上显示它时,只会显示前两个节点及其关系。 代码:

 GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase("D://ws-NEO//Fade");
        Transaction tx=graphDb.beginTx();       
        Connection conn = null;
        try{
        conn=ConnectionFactory.getConnection();
        Statement stat=conn.createStatement();
        String sql="select * from Fade where App_Int_Id < 19";  //Two records are there in result
        ResultSet rs=stat.executeQuery(sql);        
        String n1 = "",n2="",rel="",type="";
        while(rs.next()){
            n1=rs.getString(2);   
            n2=rs.getString(7);     
            rel=rs.getString(3);    
            type=rs.getString(4);           
        Node first=graphDb.createNode();
        first.setProperty("name", n1);  

        Node second=graphDb.createNode();
        second.setProperty("name", n2);         
        RelationshipType KNOWS = DynamicRelationshipType.withName(rel);     

            first.createRelationshipTo(second, KNOWS);      
        }
         tx.success();}
         finally
            {    tx.finish();
             graphDb.shutdown();
             conn.close();         
            }

It outputs two records in console:
node1 -- My App
node2 -- GCAM
relationship -- Cash focus
Node1 ceated  
Node2 ceated
relationship created
----------------------------------------------------------------------------------------------------
node1 -- My Test app
node2 -- GCAM
relationship -- Test Interface 11
Node1 ceated  
Node2 ceated
relationship created
----------------------------------------------------------------------------------------------------

但是,在Neoclipse中只显示一条记录,其他记录丢失。Plz指南


共 (1) 个答案

  1. # 1 楼答案

    Neoclipse的默认遍历深度似乎为1,给出了您看到的结果。但是遍历深度是可调的,neoclipse将在下次启动时记住上次使用的遍历深度

    要增加遍历深度,可以单击图形窗格顶部工具栏中的绿色“+”按钮,要减少遍历深度,可以单击绿色“-”按钮

    您还可以通过单击开始节点来更改它(用于遍历目的)。双击一个节点会显示它的所有邻居节点

    还有很多功能,但您需要阅读帮助文档,并使用该工具来发现其所有功能