cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Json Response is unexpected

Hi,

I am new to Neo4J. I have loaded data in Neo4J Database with following nodes and properties.

Label: Customer {Id: '1', SomeProperty:'values'}
Label: Calls {CustomerId: '1', CallId:'values', Duration}
Label: Agent {AgentId: '1', CallId:'values', Duration}

There relation are as follows:
Customer - [customer_called] -> Calls
Calls-[call_attended_by]->Agent

Now, i want to query the details of customer calls and the agent who picked it.

MATCH P = (cust:Customer {Id:'1'})-[relation*1..2]-(related_to)  
RETURN P

It works like charm and I get a good graphical and tabular view but when I check the Json Response from Text/Code View, the json-node of relationship is empty.

Expected response:

"row": [ "customer_called", {Id: '1', SomeProperty:'values'}, {CustomerId: '1', CallId:'values', Duration} ] "row": [ "call_attended_by", {CustomerId: '1', CallId:'values', Duration}, {AgentId: '1', CallId:'values', Duration} ]

Response received:

"row": [ {}, {Id: '1', SomeProperty:'values'}, {CustomerId: '1', CallId:'values', Duration} ] "row": [ {}, {CustomerId: '1', CallId:'values', Duration}, {AgentId: '1', CallId:'values', Duration} ]

Can anyone help in this case

2 REPLIES 2

MuddyBootsCode
Graph Steward

Might be better if you returned something:

match (c:Customer)-[r:whatever the name is*1..2]-(n:related_to)
return c, r, n

Then you'd be able to see the relationship for sure.

@MuddyBootsCode than for the response.
It works this way if i specifically define relationship name and node name which it is related to.

What if I have some additional relationships of customer like

Label: Transaction {CustomerId: '1',ItemId:'x', Cost:'values', }
Label: Items {ItemId:'x', ItemDesc:'values',}

There relation are as follows:
Customer - [customer_bought] -> Transaction
Transaction-[Transaction_details]->Items

There could be 10s of direct relations of a customer and 100's of indirect. Therefore, I was looking for a wild card solution to keep the query concise.
Can you tell if it's possible ?