for (Map row : result){
for (Node node : row.get("p").nodes()) {
  node.getProperty("name")
}
}
Sent from mobile device

Am 06.06.2014 um 07:55 schrieb John Fry <[email protected]>:

> Some code that works below to answer my own question above in case it helps 
> anyone.
> 
> //import java.io.File;
> //import java.io.IOException;
> import java.util.Iterator;
> //import java.util.List;
> //import java.util.Map;
> //import java.util.Map.Entry;
> 
> import org.neo4j.cypher.javacompat.ExecutionEngine;
> import org.neo4j.cypher.javacompat.ExecutionResult;
> import org.neo4j.graphdb.GraphDatabaseService;
> import org.neo4j.graphdb.Node;
> //import org.neo4j.graphdb.Transaction;
> import org.neo4j.graphdb.Path;
> //import org.neo4j.graphdb.Relationship;
> import org.neo4j.graphdb.factory.GraphDatabaseFactory;
> //import org.neo4j.helpers.collection.IteratorUtil;
> 
> //import static org.neo4j.kernel.impl.util.FileUtils.deleteRecursively;
> 
> public class JavaQuery
> {
>     String nodeNames;
>     
>     private static final String DB_PATH = 
> "/usr/local/Cellar/neo4j/2.0.2/libexec/data/graph.db";
> 
>     public static void main( String[] args )
>     {
>         JavaQuery javaQuery = new JavaQuery();
>         javaQuery.run();
>     }
> 
>     void run()
>     {
>         GraphDatabaseService db = new 
> GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );
> 
>         ExecutionEngine engine = new ExecutionEngine( db );
>         System.out.println("DB Open");
>         
>         ExecutionResult result;
>         result = engine.execute("" +
>                 "START a=node(13091), b=node(7495999) " +
>                 "MATCH p=allshortestpaths((a)-[*..10]-(b)) " +
>                 "return p;");
>         
>         final Iterator rels = result.columnAs("p");
> 
>         while (rels.hasNext()){
>             Path path = (Path) rels.next();
> 
>             nodeNames = "Path: ";
>             Iterable<Node>  nodes = path.nodes();
>             java.util.Iterator<Node> nodeIterator = nodes.iterator();
>             while (nodeIterator.hasNext()){
>                 Node n = nodeIterator.next();
>                 nodeNames += (String) n.getProperty("title") + " -> ";
>                 
>             }
>             System.out.println(nodeNames);
>         }
>        
>         db.shutdown();
>         System.out.println("DB Shutdown");
>     }
> 
> }
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to