Re: [Neo4j] strange problem while getting a node property

2011-07-28 Thread Jean-Sébastien Stoffen
Hi,

thank you very much!
In deed, node 0 doesn't have any properties.
I did not think about this.

Now it's working perfectly.

Regards,
Jean-Sébastien Stoffen

Le 28/07/11 13:26, Niels Hoogeveen a écrit :
> 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
>

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] strange problem while getting a node property

2011-07-28 Thread Chris Gioran
Hi Jean-Sébastien,

could you please tell us:

0. Are you sure that Node#0 is the one reporting that it has the
property key "package"?
1. How is the graph created? Specifically, how are the properties
added? The "package" property is being reported as existing, so it has
to get there somehow.
2. What version of Neo4j are you using?
3. Are the operations you described part of the same or different
transactions? The same instance of the database?

It would be very helpful if you provided a small piece of code that
reproduces what you see.

cheers,
CG

On Thu, Jul 28, 2011 at 2:18 PM, Jean-Sébastien Stoffen  wrote:
> 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


Re: [Neo4j] strange problem while getting a node property

2011-07-28 Thread Niels Hoogeveen

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