GraphGists

Developers using Neo4j are currently working alone when they should be working together, but they don’t know who is working on the same technologies. This graph aims to solve this by linking developers with similar interests, projects and events.

Setup of known data

Technologies/Interests

Who is interested in the same technologies as me?

MATCH (me:Member)-[:INTEREST]->(t:Technology)<-[:INTEREST]-(m:Member)
WHERE me.first_name = 'Jacqui'
RETURN m, count(t) AS shared_interests, collect(t.name) AS interests
ORDER BY shared_interests DESC

What are members' primary interests?

MATCH (m:Member)-[:INTEREST]->(t1:Technology)
RETURN m, collect(DISTINCT t1.name) AS primary_interests

What are members' secondary interests?

MATCH (m:Member)-[:INTEREST]->(:Technology)-[]->(t2:Technology)
RETURN m, collect(DISTINCT t2.name) AS secondary_interests

Location

Which members live in the same location as me?

MATCH (me:Member)-[:BASED_IN]->(l:Location)<-[:BASED_IN]-(m:Member)
WHERE me.first_name = 'Jacqui'
RETURN m, l.name

Which members live near me?

See notes for more on how we need to think about this.

MATCH (me:Member)-[:BASED_IN]->(l:Location)<-[*1..3]-(m:Member)
WHERE me.first_name = 'Jacqui'
WITH me,m
MATCH (m)-[:BASED_IN]->(ml:Location)
RETURN m, ml.name AS location

Events

What events are happening, and where?

MATCH (e:Event)-[:IN]->(l:Location)
RETURN e.name AS event, e.date AS date, l.name AS location

What events are happening in the future?

MATCH (e:Event)-[:IN]->(l:Location)
WHERE e.date > timestamp()
RETURN e.name AS event, e.date AS date, l.name AS location

What events are happening in the UK in the next week?

MATCH (e:Event)-[*]->(l:Location)
WHERE l.name = 'UK'
AND e.date > timestamp()
AND e.date < 1385683199000
WITH e
MATCH (e:Event)-[:IN]->(lo:Location)
RETURN e.name AS event, e.date AS date, lo.name AS location

What events involving technologies that I am interested in, are happening in the future?

MATCH (l:Location)<-[:IN]-(e:Event)-[:INVOLVES]->(t:Technology)<-[:INTEREST]-(me:Member)
WHERE me.first_name = 'Jacqui'
AND e.date > timestamp()
RETURN e.name AS event, e.date AS date, l.name AS location, t.name as technology

Who attended an event that I attended?

MATCH (m:Member)-[*1..1]->(e:Event)<-[:ATTEND]-(me:Member)
WHERE me.first_name = 'Jacqui'
AND e.date < timestamp()
RETURN e.name AS event, m AS member

Who is attending a future event that I am attending?

MATCH (m:Member)-[*1..1]->(e:Event)<-[:ATTEND]-(me:Member)
WHERE me.first_name = 'Jacqui'
AND e.date > timestamp()
RETURN e.name AS event, m AS member

Who is attending a future event that I am attending, and is interested in the same technologies as me?

MATCH (m:Member)-[*1..1]->(e:Event)<-[:ATTEND]-(me:Member),
(m:Member)-[:INTEREST]->(t:Technology)<-[:INTEREST]-(me:Member)
WHERE me.first_name = 'Jacqui'
AND e.date > timestamp()
RETURN e.name AS event, m AS member, collect(t.name) as technologies

What other technologies are members, who are interested in the same technologies as me, interested in?

MATCH (me:Member)-[:INTEREST]->(t1:Technology)<-[:INTEREST]-(m:Member)
WHERE me.first_name = 'Jacqui'
WITH me,t1,m
MATCH (m:Member)-[:INTEREST]->(t:Technology)
WHERE NOT (me)-[:INTEREST]->(t)
RETURN DISTINCT m, collect(t1.name) AS shared_technologies, collect(DISTINCT t.name) as other_technologies