GraphGists

Using the Design for Queryability modeling approach by Ian Robinson

1. Application/End-User Goals

As an employee

I want to know who in the company has similar skills to me

So that we can exchange knowledge

2. Questions To Ask of the Domain

Which people, who work for the same company as me, have similar skills to me?

3. Identify Entities

Which people, who work for the same company as me, have similar skills to me?

  • Person

  • Company

  • Skill

4. Identify Relationships Between Entities

Which people, who work for the same company as me, have similar skills to me?

  • Person WORKS_FOR Company

  • Person HAS_SKILL Skill

5. Convert to Cypher Paths

  • Person WORKS_FOR Company →

(:Person) - [:WORKS_FOR] -> (:Company)
  • Person HAS_SKILL Skill →

(:Person) - [:HAS_SKILL] -> (:Skill)

Consolidate Paths

(:Person) - [:WORKS_FOR] -> (:Company)
(:Person) - [:HAS_SKILL] -> (:Skill)

(:Company) < - [:WORKS_FOR] - (:Person) - [:HAS_SKILL] - > (:Skill)

Candidate Data Model

skills use case

Company Employees

MATCH (company {name:'ACME'})<-[:WORKS_FOR]-(p:Person)
RETURN p.name as name
ORDER by name

People Skills

MATCH (p:Person)-[:HAS_SKILL]->(s:Skill)
RETURN p.name, collect(s.name) as skills
ORDER by length(skills) DESC

6. Express Question as Graph Pattern

Which people, who work for the same company as me, have similar skills to me?

skills model
MATCH (company)<-[:WORKS_FOR]-(me:Person)-[:HAS_SKILL]->(skill),
      (company)<-[:WORKS_FOR]-(colleague)-[:HAS_SKILL]->(skill)
WHERE  me.name = 'Ian'
WITH colleague.name AS name,
       count(skill) AS score,
       collect(skill.name) AS skills
WHERE score > 1
RETURN name,score,skills
ORDER BY score DESC