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/

posted @ 2021-06-02 12:20  宁君  阅读(225)  评论(0编辑  收藏  举报