Can you correct my cypher queries or provide a new solution to query

cypher
knowledge-base

(Sucheta) #1

Hi,

I have the following relation -

I need queries like -

[1] To Get only Century (which is the topmost root node) and EwayBill node and Generate subnode of EwayBill. So i tried this
query-

   MATCH (cc:Century), (eway:EwayBill), (generate:Generate) OPTIONAL MATCH 
  (cc:Century)-[r1:Service]-> (eway:EwayBill)<-[r2:API]-(eway:EwayBill)-[r4:APIM]-> (eway:EwayBill)<-
   [r3: APIA]-(generate:Generate)  RETURN cc,r1,r2,r3,r4,eway,generate;

But i get only three nodes -i.e. Century, EwayBill and Generate. No arrows to show relationship.

kindly correct this query so i get the relationship arrows also.

[2]
Is it possible to generate a query where when we select
Century (root node)
Generate (which is subnode of EwayBill . And EwayBill is directly connected as node to Century)
FiringRatio (which is subnode of Bapi. And Bapi is a node directly connected to Century).

After selecting these three nodes , i directly get the graph network showing there connections.


(Ameyasoft) #2

Hi,

Try this for # 1:
MATCH (cc:Century)-[:Service]->(eway:EwayBill)-->(generate:Generate)
RETURN cc,eway,generate;
-Kamal


(Sucheta) #3

Hi Kamal,

Thanks for the guidance. I used this query -

MATCH (cc:Century)-[r:Service]->(eway:EwayBill)-[r2:API]->(generate:Generate) RETURN cc,eway,r,generate,r2;