Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-24-2018 12:56 AM
Hi Team,
I am trying to run the procedure in java through bolt statement.like below
StatementResult result1 = session.run("MATCH (n) WHERE ID(n)=125 CALL apoc.path.expandConfig(n,{relationshipFilter: '',minLevel:1, maxLevel: 20,labelFilter:'-Dense|-Product1|-ProductType1', maxLevel:4}) YIELD path RETURN path limit 8”);
{
"path":{
"nodes":[
{
"labels":[
"SelName"
],
"id":125,
"properties":{
"selName":{
"val":"EMB"
},
"norm_name":{
"val":"emb"
},
"platfm":{
"val":"amazon.in"
}
}
}
],
"relationships":[
],
"segments":[
]
}
}
[{"selName":"EMB","norm_name":"emb","platfm":"│
│amazon.in"},{},{}]
Please help me out to get the output
10-24-2018 01:58 PM
Looks like you only want the properties of nodes in the path? If so, try:
RETURN [node in nodes(path) | properties(node)] as nodes
LIMIT 8
10-25-2018 03:48 AM
Thank you Andrew for responding,
After running ur given format I am getting the data with nodes but I want now print with only selName can you suggest with same query.
Below is json format current I am getting,
{"nodes":[{"selName":"EMB","norm_name":"emb","platfm":"amazon.in"},{"selName":"emb1","norm_name":"emb","platfm":"ebay.com"},{"sellerName":"emb2","norm_name":"emb","platfm":"eBay.com"}],
[{"selName":"EMB11","norm_name":"emb11","platfm":"amazon.in"},{"selName":"emb111","norm_name":"emb","platfrm":"ebay.com"},{"sellerName":"emb222","norm_name":"emb","platfrm":"eBay.com"}]}
Below is query,
MATCH (n) WHERE ID(n)=125 CALL apoc.path.expandConfig(n,{relationshipFilter: '',minLevel:1, maxLevel: 20,labelFilter:'-Dense|-Product|-ProductType', maxLevel:4}) YIELD path RETURN [node in nodes(path) | properties(node)] as nodes LIMIT 8
10-25-2018 08:37 AM
If you only need a certain property, then specify that in the list projection. Looks like you have differing property keys depending on certain nodes, so we can use coalesce()
to find the first non-null value:
MATCH (n) WHERE ID(n)=125
CALL apoc.path.expandConfig(n,{relationshipFilter: '',minLevel:1, maxLevel: 20,labelFilter:'-Dense|-Product|-ProductType', maxLevel:4}) YIELD path
RETURN [node in nodes(path) | coalesce(node.selName, node.sellerName)] as nodes
LIMIT 8
10-25-2018 09:35 PM
Hi Andrew, while running above query I am getting below issue,
Here is issue,
Neo.ClientError.Statement.SyntaxError: Invalid input '|': expected whitespace, comment, '.', node labels, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR or ']' (line 1, column 225 (offset: 224))
"MATCH (n) WHERE ID(n)=125 CALL apoc.path.expandConfig(n,{relationshipFilter: '',minLevel:1, maxLevel: 20,labelFilter:'-Dense|-Product|-ProductType', maxLevel:4}) YIELD path RETURN [node in nodes(path) | properties(node) | COLLECT(node.selName, node.sellerName)] as nodes LIMIT 8"
^
Can you please suggest..
10-25-2018 10:58 PM
The query you ran is not the query I provided. You have an extra segment in the list projection that wasn't there before, and you're using COLLECT() instead of COALESCE() (which won't work in this case). Is there some reason the query I provided isn't working for you?
10-25-2018 11:03 PM
Sorry for wrong sent Andrew,
I am using below query itself which is given by you , here is
MATCH (n) WHERE ID(n)=125 CALL apoc.path.expandConfig(n,{relationshipFilter: '',minLevel:1, maxLevel: 20,labelFilter:'-Dense|-Product|-ProductType', maxLevel:4}) YIELD path RETURN [node in nodes(path) | coalesce(node.selName, node.sellerName)] as nodes LIMIT 8
But same issue getting above mentioned..
10-25-2018 11:06 PM
Actually the query looks good, it's working for me. What version of Neo4j are you using?
10-26-2018 12:32 AM
yes its working fine Andrew there is a small mistake done by me i.e.,I written return twice...
Thanks again..
Do we have any solution for,
How to do expand and collapse PARENT AND child nodes in NeoVis by clicking on Nodes.
I am getting result with full nodes information but I want expand and collapse nodes for same results.
Please reply me as soon.
Here is I am following NeoVis POC Link Below
10-26-2018 10:43 AM
That's a completely different question unrelated to this one. I think you had best create a separate question for it in the appropriate category. I haven't worked with Neovis myself here, others may be able to help.
All the sessions of the conference are now available online