I've tried several examples
from http://docs.neo4j.org/chunked/2.0.1/tutorials-cypher-java.html but
none are compatible with the API I'm using it seems.
I'm using 2.0.1 API with Maven:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>2.0.1</version>
<type>test-jar</type>
</dependency>
Consider this example:
try (Transaction tx = db.beginTx()) {
result = engine.execute(String.format("MATCH (x:%s) RETURN x", label
));
for ( Map<String, Object> row : result) {
for ( Entry<String, Object> column : row.entrySet()) {
rows += column.getKey() + ": " + column.getValue() + "; ";
}
rows += "\n";
}
}
My Eclipse tells me this about the "result" variable: "Can only iterate
over an array or an instance of java.lang.Iterable".
Also, when trying another example, I'm getting "Type mismatch: cannot
convert from Iterator<Object> to Iterator<Node>" for the "result" variable.
try (Transaction tx = db.beginTx()) {
result = engine.execute(String.format("MATCH (x:%s) RETURN x", label
));
Iterator<Node> n_column = result.columnAs( "n" );
for ( Node node : IteratorUtil.asIterable( n_column ) ) {
// note: we're grabbing the name property from the node,
// not from the n.name in this case.
nodeResult = node + ": " + node.getProperty( "name" );
}
}
Are these examples updated? What am I missing here? I just want get a List
of nodes having a particular label..
--
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.