官方有例子:
Driver driver = GraphDatabase.driver( “bolt://localhost:7687”, AuthTokens.basic( “neo4j”, “neo4j” ) );
Session session = driver.session();
session.run( “CREATE (wd:Person {name: {name}, title: {title}})”,
parameters( “name”, “node”, “title”, “Test” ) );
StatementResult result = session.run( "MATCH (node:Person) WHERE node.name = {name} " +
“RETURN node.name AS name, node.title AS title”,
parameters( “name”, “node” ) );
while ( result.hasNext() )
{
Record record = result.next();
System.out.println( record.get( “title” ).asString() + " " + record.get( “name” ).asString() );
}
session.close();
driver.close();