Java で Neo4j ノードと関係を作成しました。それらの値は DB から取得されています。Neoclipse に表示しようとすると、最初の 2 つのノードのみが表示され、それらの関係が表示されます。コード:
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 には 1 つのレコードしか表示されず、他は表示されません。ガイドをお願いします。