Skip to content

Instantly share code, notes, and snippets.

@peterneubauer
Last active December 19, 2015 22:29
Show Gist options
  • Save peterneubauer/6028026 to your computer and use it in GitHub Desktop.
Save peterneubauer/6028026 to your computer and use it in GitHub Desktop.
A graph capturing common insurance scenarios

Graphs in Insurance

The domain

The setup is based on the slideshow below.

CREATE (home1{name:'home1'})-[:sub_product]->(buildingA{name:'Building A'})
CREATE (buildingA)-[:attribute]->(size120{name:'120m2'})
CREATE (buildingA)-[:covered_by]->(coverage_super{name:'Coverage Super'})
CREATE (coverage_super)-[:sub_cover]->(coverage_fire{name:'Coverage Fire'})
CREATE (coverage_super)-[:covers_risk]->(risk_bsmall{name:'Risk - Building Small'})
CREATE (risk_bsmall)-[:risk_has_attribute]->(size120)
CREATE (home1)<-[:concerns]-(questionaire1{name:'Questionaire 1'})
CREATE (home1)<-[:owns]-(customer1{name:'John Doe'})
CREATE (customer1)-[:fills_in]->(questionaire1)
CREATE (questionaire1)-[:contains_question]->(size120)
CREATE (customer1)-[:is_offered]->(quote1)
CREATE (quote1)-[:includes]->(risk_bsmall)
CREATE (quote1)-[:includes]->(coverage_fire)
CREATE (quote1)<-[:made]-(agent1{name:'Agent 1'})
CREATE (quote1)-[:based_on]->(policy1{name:'Policy 1'})
CREATE (customer1)-[:is_offered]->(policy1)
CREATE (policy1)<-[:made]-(agent1)
CREATE (customer1)-[:signed]->(agreement1)
CREATE (agreement1)<-[:owns]-(agent1)

Find a Custumers asset based on an agent

MATCH agent-[:owns]->agreement<-[:signed]-customer-[:owns]->asset
WHERE HAS(agent.name) AND agent.name='Agent 1'
RETURN agent.name as Agent, customer.name as Customer, asset.name as Asset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment