Hi Nubia,

>From your Cypher query, I could not guess your data model. Here is my data 
model.

Cypher script to create the database:


CREATE (c:TeamChatSession {id: 100})
CREATE (u:User {id: 10})
CREATE (u1:User {id: 20})
CREATE (c)-[:CREATE_CHAT]->(u)
CREATE (c)-[:CREATE_CHAT]->(u1)
CREATE (u2:User {id: 30})
CREATE (u3:User {id: 40})
CREATE (c)-[:CREATE_CHAT]->(u2)
CREATE (c)-[:CREATE_CHAT]->(u3)

CREATE (i:ChatItem {id: 25})
CREATE (i2:ChatItem {id: 30})
CREATE (u)-[:PARTOF]->(i)
CREATE (u1)-[:PARTOF]->(i2)

CREATE (i3:ChatItem {id: 35})
CREATE (i4:ChatItem {id: 40})
CREATE (u2)-[:PARTOF]->(i3)
CREATE (u3)-[:PARTOF]->(i4)

CREATE (i2)-[:MENTIONED]->(u)
CREATE (i4)-[:MENTIONED]->(u);

<https://lh3.googleusercontent.com/-ASQHVP6wGtQ/WRt6Qv9nrgI/AAAAAAAACN8/FoTp5zzyptY2clVap8u9IywVlu4CKgKxACLcB/s1600/Screen%2BShot%2B05-16-17%2Bat%2B12.39%2BPM.PNG>
Here is the query to return the users in the graph database that post chats 
that mention other users and the result.

MATCH PATH = (c)-[:CREATE_CHAT]->(n)-[:PARTOF]->(p)-[:MENTIONED]->(q)
RETURN PATH;

<https://lh3.googleusercontent.com/-zBWRiG5FXbA/WRt6XnpAsUI/AAAAAAAACOA/ef69OZj_4DIrdgiAoBYaMHuBtow5IwUgACLcB/s1600/Screen%2BShot%2B05-16-17%2Bat%2B12.44%2BPM.PNG>
Hope this will help you.
Thanks,
-Kamal

On Monday, May 15, 2017 at 8:23:12 AM UTC-7, Nubia L. wrote:
>
> My task is to return the users in the graph database that post chats that 
> mention other users
>
> My graph database was setup using the following listing of commands:
> Loaded from file 1
> MERGE (c:TeamChatSession {id: toInt(row[1])})
> MERGE (i:ChatItem {id: toInt(row[2])})
> MERGE (u)-[:CreateChat{timeStamp: row[3]}]->(c)
> MERGE (i)-[:PartOf{timeStamp: row[3]}]->(c)
>
> Loaded from file 2
> MERGE (i:ChatItem {id: toInt(row[0])})
> MERGE (u:User {id: toInt(row[1])}) 
> MERGE (i)-[:Mentioned{timeStamp: row[2]}]->(u)
>
> Note that not all chat items mention users, so the path terminates for a 
> majority of the database. 
>
> I have gotten this partial command to run effectively:
> match (a:ChatItem)-[:PartOf*]->(s)<-[:CreateChat*]-(u:User) 
>
> The problem come in when I attempt to construct the full path from u1 to u2
> match p = 
> (u1:User)-[:CreateChat]->(c:TeamChatSession)<-[:PartOf]-(i:ChatItem)-[r:Mentioned]->(u2:User)
> return p
>
> When I enter this query, the system just hangs. 
>

-- 
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.

Reply via email to