Hi guys,
I’m trying to execute this query in Java application.
ResultSet resultSet = graph.query(“Usergraph”, “MATCH (n:User)<-[:provider*]-(f:User)WHERE n.userid=7 RETURN collect(f)”);
its returning
results=[Record{values=[
[Node{labels=[User], id=3, propertyMap={providerid=Property{name=‘providerid’, value=2}, level=Property{name=‘level’, value=3}, userid=Property{name=‘userid’, value=4}, name=Property{name=‘name’, value=Ravi}, id=Property{name=‘id’, value=4}}},
Node{labels=[User], id=1, propertyMap={providerid=Property{name=‘providerid’, value=1}, level=Property{name=‘level’, value=4}, userid=Property{name=‘userid’, value=2}, name=Property{name=‘name’, value=Natraj}, id=Property{name=‘id’, value=2}}},
Node{labels=[User], id=0, propertyMap={providerid=Property{name=‘providerid’, value=0}, level=Property{name=‘level’, value=5}, userid=Property{name=‘userid’, value=1}, name=Property{name=‘name’, value=Ram}, id=Property{name=‘id’, value=1}}}]]}]}
Now what method i should use to get each node seperately in java.
if it returns one node im using the below iteration
resultSet = graph.query(“social”, “MATCH p = (:person)-[:knows]->(:person) RETURN p”);
while(resultSet.hasNext()) {
Record record = resultSet.next();
Path p = record.getValue(“p”);
// More path API at Javadoc.
System.out.println(p.nodeCount());
}
For Multiple node What i need to use.
Thanks in Advance