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/