When iterating over all nodes, you also pull the reference node (with id = 0), which probably doesn't have the requested property. If you want to list all properties of a node, it's better to use a construct like: for(String key: node.getPropertyKeys()){ System.out.println(node.getProperty(key));}
> Date: Thu, 28 Jul 2011 13:18:50 +0200 > From: c-...@jsnet.be > To: user@lists.neo4j.org > Subject: [Neo4j] strange problem while getting a node property > > Hi, > I've this strange problem when I try to collect data from the graph with > the Java API in Groovy : > > db.allNodes.each {node -> > cpt=0 > node.getRelationships().each {rel -> > cpt++ > } > println ("${node} ${cpt}") > println node.getPropertyKeys() > } > > The iteration on each node is right working. > The iteration to count the relationships on each node is working too. > > The call node.getPropertyKeys() gives me the list of the properties like > this : > [nbrel, version, maintainer, section, architecture, package, priority, > dataset, installedSize] > > But, > > If a call node.getProperty("package") > I receive this error : > Caught: org.neo4j.graphdb.NotFoundException: package property not found > for NodeImpl#0 > > And, If I set the value just before, for test like this : > node.setProperty("package", "test") > println node.getProperty("package") > > I get the value. > > So I can't get property which was not set by the node.setProperty method. > The initial data are copied into the graph with a perl script using the > Neo4j REST interface. > > Maybe I do something wrong, > I'm a newbie in both Neo4j and Groovy > > Regards, > Jean-Sébastien Stoffen > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user