Java教程

neo4j-(11)-java代码操作

本文主要是介绍neo4j-(11)-java代码操作,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1. 原生的Neo4j Java API

Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic( userName, passWord ) );
		Session session = driver.session();
		session.run( "CREATE (a:Person {name: 'Arthur001', title: 'King001'})");

		StatementResult result = session.run( "MATCH (a:Person) WHERE a.name = 'Arthur001' " +
						"RETURN a.name AS name, a.title AS title");
		while ( result.hasNext() )
		{
			Record record = result.next();
			System.out.println( record.get( "title" ).asString() + " " + record.get( "name" ).asString() );
		}
		session.close();
		driver.close();

文档: https://neo4j.com/docs/java-reference/3.5/

这篇关于neo4j-(11)-java代码操作的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!