查询重复的关系,并删除
String url ="bolt://192.168.126.xx:7687";
String userName = "neo4j";
String passWord = "xxx";
// 使用 basic authentication方式创建连接
try {
Driver driver = GraphDatabase.driver(url, AuthTokens.basic(userName, passWord), Config.builder().withMaxConnectionLifetime(30, TimeUnit.MINUTES).withMaxConnectionPoolSize(50).withConnectionAcquisitionTimeout(2, TimeUnit.MINUTES).build());
Session session = driver.session();
//查询关系类型为1种,且关系数量>1的
String cond="match (a)-[r]->(b) with a,b,count(distinct type(r)) as tr, count(r) as c where c>1 and tr=1 return a, b, c,tr limit 10";
List rst= session.run(cond).list();
while(rst.size()>0) {
for(Record r:rst) {
NodeValue a=(NodeValue)r.get("a");
NodeValue b=(NodeValue)r.get