Not able to retrieve node property

33 views
Skip to first unread message

Nikhanj

unread,
Jul 18, 2012, 1:30:08 AM7/18/12
to ne...@googlegroups.com
Hi,
   I have a list of vertices in a list like - vertexList=[48,47]
   Now I want to traverse this list and get the node property "Type" of its previous node. 

  So I wrote this script
   i=-1; vertexProperty=[]
   while(++i<vertexList.size()) vertexProperty[i]=vertexList[i].in('CATEGORY').Type

  But in the vertexProperty list I did not have the property value stored, rather had information about pipes like-
 
 [StartPipe, InPipe(CATEGORY), PropertyPipe(Type)]
 [StartPipe, InPipe(CATEGORY), PropertyPipe(Type)]

How to get the property from these pipes ???

Regards,
Nikhanj

Nikhanj

unread,
Jul 18, 2012, 7:32:18 AM7/18/12
to ne...@googlegroups.com
Hi,
can anyone help with this issue ??

Andres Taylor

unread,
Jul 18, 2012, 8:25:12 AM7/18/12
to ne...@googlegroups.com
I have no idea what you are asking about. You write about pipes and vertices. If this a gremlin question? You have to give us a little more information before we can help.

Andrés
--
The best way to ask for Cypher help: http://console.neo4j.org/usage.html 

Nikhanj

unread,
Jul 18, 2012, 8:52:33 AM7/18/12
to ne...@googlegroups.com
I have id's of vertices stored in a list like vertexList=[48,2750]
Now for the node with ids in the above list, I want to access its incoming edge :CATEGORY and access the node property:Type.
For that i tried 
    i=-1;
   vertexProperty=[];
   while(++i<vertexList.size()) vertexProperty[i]=vertexList[i].in('CATEGORY').Type

  But in the vertexProperty list I did not have the property value stored, rather had information about pipes like-
 
 [StartPipe, InPipe(CATEGORY), PropertyPipe(Type)]
 [StartPipe, InPipe(CATEGORY), PropertyPipe(Type)].

But when i try for individual id like vertexList[0].in('CATEGORY').Type ,i am able to get the property-Type, correctly
On iterating the list of ids ,it is not coming as expected

Peter Neubauer

unread,
Jul 19, 2012, 9:49:53 AM7/19/12
to ne...@googlegroups.com
Nikhanj,
you need to pull out the first element from the propertyPipe, like


i=-1;
vertexProperty=[]; 
vertexList=[0]; 
while(++i<vertexList.size()) {
  vertexProperty[i]=g.v(vertexList[i]).in('CATEGORY').Type.next(); 
}
vertexProperty

/peter


--

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Wanna learn something new? Come to @graphconnect.

Peter Neubauer

unread,
Jul 19, 2012, 10:11:10 AM7/19/12
to Peter Neubauer, ne...@googlegroups.com
Hi all,
since this comes up all the time, I added it as a tip to the docs, should be up soon at http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html

/peter
Message has been deleted

Nikhanj

unread,
Jul 20, 2012, 2:50:36 AM7/20/12
to ne...@googlegroups.com
Peter,
As per your code,

     i=-1; 
vertexProperty=[]; 
vertexList=[0]; 
while(++i<vertexList.size()) {
  vertexProperty[i]=g.v(vertexList[i]).in('CATEGORY').Type.next(); 
}
vertexProperty

But if you do, vertexList=[0],the value 0 will be stored in vertexList and how will it correspond to pulling first element from propertyPipe..I tried your code without vertexList=[0], and I am able to get Type value. Thanks!

Peter Neubauer

unread,
Jul 20, 2012, 10:09:46 AM7/20/12
to ne...@googlegroups.com
Glad to be able to help :)

/peter
Reply all
Reply to author
Forward
0 new messages