code: private StatementResult printFriends( final Transaction tx )
      {
          StatementResult result = tx.run( "MATCH (a)-[:KNOWS]->(b) RETURN a.name, b.name" );
          while ( result.hasNext() )
          {
              Record record = result.next();
              System.out.println( String.format( "%s knows %s", record.get( "a.name" ).asString(), record.get( "b.name" ).toString() ) );
          }
          return result;
      }
docs: Match and display all friendships.