Hi, You can try this:
//Get tp1 nodes tagged to "result" MATCH (tp1:Testplan)-[:TAGGED]->(kw1:Tag) WHERE kw1.name = "result" WITH COLLECT (tp1) as nodes UNWIND nodes as tp2 //use the above collection to get the tp1 nodes tagged to "result" and "error" MATCH (tp2)-[:TAGGED]->(kw2:Tag) WHERE kw2.name="error" WITH COLLECT (tp2) as nodes UNWIND nodes as tp3 //use the second collection to get the tp1 nodes tagged to "result", "error" and "prerequisites" MATCH (tp3)-[:TAGGED]->(kw3:Tag) WHERE kw2.name="prerequisites" RETUTN Count(tp3) as Cnt Here Cnt gives the total count of tp1 nodes tagged to "result", "error" and "prerequisites" -Kamal On Monday, August 7, 2017 at 7:32:47 AM UTC-7, amarrtya jana wrote: > > Hi, > > I have two types of nodes in my graph. One type is Testplan and the other > is Tag. Testplans are tagged to Tags. I want most common pairs of Tags that > share the same Testplans with a Tag having a specific name. I have been > able to achieve the most common Tags sharing the same Testplan with one > Tag, but getting confused when trying to do it for pairs of Tags. The > cypher returning the list of single tags is shared below > > MATCH (kw1:Tag)<-[e:TAGGED]-(tp1:Testplan)-[e2:TAGGED]->(kw2:Tag) > WHERE kw1.name = "result" > > RETURN kw1,kw2,count(tp1) > > ORDER BY count(tp1) DESC > > This cypher returns something as follows > > Kw1 kw2 count(tp1) > “result” “error” 104 > “result” “prerequisites” 89 > “result” “alpha” 63 > > I want the result to be > > Kw1 kw2 count(tp1) > “result” “error”,”prerequisites” 70 > “result” “error”,”alpha” 63 > > > Here the count in the second table gives the number of Testplans being TAGGED > to "result","error" and "prerequisites" and similarly "result","error" and > "alpha" > > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
