SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
Kaiso	
  -­‐	
  an	
  object	
  persistence	
  framework	
  for	
  
Python	
  and	
  Neo4j
David	
  Szo>en

onefinestay	
  

!
!
!

@szo;en	
  
github.com/davidszo;en
1

©	
  Lifealike	
  Limited,	
  2013.
Overview
• About	
  onefinestay	
  
• We	
  care	
  about	
  homes	
  
• How	
  we	
  track	
  our	
  homes	
  using	
  Neo4j	
  
• Kaiso	
  demo

2

©	
  Lifealike	
  Limited,	
  2013.
onefinestay	
  -­‐	
  the	
  unhotel	
  
3

©	
  Lifealike	
  Limited,	
  2013.
onefinestay	
  -­‐	
  the	
  unhotel
• Guests	
  live	
  like	
  a	
  local	
  
– but	
  with	
  services	
  and	
  ameniNes	
  of	
  a	
  hotel	
  
!

• Members	
  with	
  disNncNve	
  homes	
  earn

hassle-­‐free	
  income	
  
!

• From	
  just	
  a	
  handful	
  of	
  homes	
  in	
  2010	
  to

over	
  1000	
  homes	
  in	
  4	
  ciNes	
  in	
  2013
4

©	
  Lifealike	
  Limited,	
  2013.
How	
  do	
  we	
  do	
  it?
• Provision:	
  Home	
   	
  Unhotel	
  
– Clean	
  
– Pack	
  away	
  certain	
  items	
  
• Make	
  wardrobe	
  space	
  

• Deprovision:	
  Unhotel	
   	
  Home	
  
– Clean	
  
– Put	
  everything	
  back
5

©	
  Lifealike	
  Limited,	
  2013.
We	
  care	
  about	
  our	
  homes.	
  A	
  lot.
• Every	
  home	
  is	
  different	
  
• We	
  require	
  inNmate	
  knowledge	
  
!

• For	
  guests:	
  “I	
  can’t	
  walk	
  up	
  stairs”,	
  “Where	
  is	
  the	
  iron?”	
  
• For	
  members:	
  “Please	
  put	
  my	
  fragile	
  vase	
  away	
  before	
  
the	
  guests	
  arrive”	
  
• For	
  us:	
  “How	
  much	
  bed	
  linen	
  do	
  I	
  need	
  to	
  take	
  to	
  this	
  
home	
  for	
  this	
  booking?”
6

©	
  Lifealike	
  Limited,	
  2013.
Previous	
  system
• Custom	
  storage	
  soluNon	
  
• Dates	
  back	
  to	
  when	
  we	
  were	
  much	
  smaller	
  
• Problems:	
  
– Siloed	
  
– Hard	
  to	
  query	
   	
  denormalised	
  copies

7

©	
  Lifealike	
  Limited,	
  2013.
New	
  system
• Want	
  to	
  model	
  our	
  homes	
  
– both	
  layout	
  and	
  contents	
  
!

• Need	
  flexibility	
  
– Our	
  needs	
  are	
  likely	
  to	
  grow	
  and	
  change	
  
!

• Track	
  not	
  only	
  objects,	
  but	
  their	
  classes	
  
– Ideally	
  treat	
  the	
  taxonomy	
  itself	
  as	
  data
8

©	
  Lifealike	
  Limited,	
  2013.
Enter	
  Neo4j
• Handle	
  complex	
  data	
  structures	
  
!

• Ensure	
  extensibility	
  for	
  future	
  needs	
  
!

• Easy	
  to	
  create	
  powerful	
  queries	
  
!

• Makes	
  for	
  a	
  nice	
  conceptual	
  model	
  of	
  our	
  data
9

©	
  Lifealike	
  Limited,	
  2013.
Flexibility	
  requirements
• We	
  want	
  to	
  associate	
  informaNon	
  with	
  classes	
  
as	
  well	
  as	
  objects	
  
– This	
  dishwasher	
  is	
  of	
  make	
  Electropool	
  
– (All)	
  appliances	
  need	
  PAT	
  tesNng	
  
!

• Unlike	
  convenNonal	
  object	
  mappers,	
  the	
  
taxonomy/class	
  hierarchy	
  needs	
  to	
  be	
  editable	
  
by	
  users,	
  and	
  so	
  should	
  be	
  part	
  of	
  the	
  data
10

©	
  Lifealike	
  Limited,	
  2013.
Kaiso	
  -­‐	
  an	
  object	
  persistence	
  framework
# (import some stuff)!

!

class Animal(Entity):!
id = Uuid(unique=True)!
name = String()!
friend_of = Outgoing(FriendOf)!

!

class Carnivore(Animal): pass!
class Herbivore(Animal): pass!

!

class Penguin(Herbivore):!
favourite_ice_cream = String()!

!

class Lion(Carnivore):!
n_siblings = Integer()!
11

©	
  Lifealike	
  Limited,	
  2013.
Kaiso:	
  Create	
  some	
  instances
# import types, connect to db!

!

manager = Manager("http://localhost:7474/db/data/")!

!

manager.save(Lion)!
manager.save(Penguin)!

!

# create some instances!
fred = Penguin(name="Fred")!
tom = Lion(name="Tom")!

!

relation = FriendOf(fred, tom)!

!

manager.save(fred)!
manager.save(tom)!
manager.save(relation)
12

©	
  Lifealike	
  Limited,	
  2013.
Instances	
  are	
  saved	
  in	
  the	
  graph...

FRIENDOF

[6]	
  Penguin:	
  Fred

13

[7]	
  Lion:	
  Tom

©	
  Lifealike	
  Limited,	
  2013.
...	
  and	
  so	
  is	
  the	
  class	
  hierarchy
[1]	
  Type:	
  Animal
ISA

ISA

[4]	
  Type:	
  Herbivore

[2]	
  Type:	
  Carnivore

ISA

ISA

[3]	
  Type:	
  Lion

[5]	
  Type:	
  Penguin

INSTANCEOF

INSTANCEOF
FRIENDOF

[6]	
  Penguin:	
  Fred
14

[7]	
  Lion:	
  Tom

©	
  Lifealike	
  Limited,	
  2013.
Kaiso:	
  Queries	
  based	
  on	
  the	
  type	
  hierarchy
START!
Herbivore=node:persistabletype(id="Herbivore"),!
Carnivore=node:persistabletype(id="Carnivore")!

!

MATCH!
Carnivore <-[:ISA*]-()<-[:INSTANCEOF]-(carnivore),!
Herbivore <-[:ISA*]-()<-[:INSTANCEOF]-(herbivore),!

!
!

(herbivore)-[:FRIENDOF]->(carnivore)!

RETURN!
"The herbivore",!
herbivore.name,!
“is a friend of the carnivore",!
carnivore.name;!

!

=> +--------------------------------------------------------------------+!
=> | "The herbivore" | "Fred" | "is a friend of the carnivore" | “Tom" |
=> +--------------------------------------------------------------------+
15

©	
  Lifealike	
  Limited,	
  2013.
Thank	
  you
QuesNons?	
  
!
!

Kaiso	
  
github.com/onefinestay/kaiso	
  
!
github.com/davidszo;en	
  
@davidszo;en
16

©	
  Lifealike	
  Limited,	
  2013.

Weitere ähnliche Inhalte

Ähnlich wie Kaiso: Modeling Complex Class Hierarchies with Neo4j - David Szotten @ GraphConnect London 2013

[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...
[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...
[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...
Jessica Tai
 
"Building a Resilient Cloud Infrastructure. From Scratch." - Cloud East, 28 J...
"Building a Resilient Cloud Infrastructure. From Scratch." - Cloud East, 28 J..."Building a Resilient Cloud Infrastructure. From Scratch." - Cloud East, 28 J...
"Building a Resilient Cloud Infrastructure. From Scratch." - Cloud East, 28 J...
Jeremy Jarvis
 
Think like a storage architect, in four questions
Think like a storage architect, in four questionsThink like a storage architect, in four questions
Think like a storage architect, in four questions
Cheryl Hung
 
Capstone digital HI presentation
Capstone digital HI presentationCapstone digital HI presentation
Capstone digital HI presentation
Eric Fitzgerald
 

Ähnlich wie Kaiso: Modeling Complex Class Hierarchies with Neo4j - David Szotten @ GraphConnect London 2013 (20)

[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...
[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...
[Annotated] QConSF 2018: Airbnb's Great Migration - From Monolith to Service-...
 
Connecting Intelligent Content with Micropublishing and Beyond
Connecting Intelligent Content with Micropublishing and BeyondConnecting Intelligent Content with Micropublishing and Beyond
Connecting Intelligent Content with Micropublishing and Beyond
 
"Building a Resilient Cloud Infrastructure. From Scratch." - Cloud East, 28 J...
"Building a Resilient Cloud Infrastructure. From Scratch." - Cloud East, 28 J..."Building a Resilient Cloud Infrastructure. From Scratch." - Cloud East, 28 J...
"Building a Resilient Cloud Infrastructure. From Scratch." - Cloud East, 28 J...
 
Building reusable components with generics and protocols
Building reusable components with generics and protocolsBuilding reusable components with generics and protocols
Building reusable components with generics and protocols
 
Intro to iOS: Object Oriented Programming and Objective-C
Intro to iOS: Object Oriented Programming and Objective-CIntro to iOS: Object Oriented Programming and Objective-C
Intro to iOS: Object Oriented Programming and Objective-C
 
Entity API in Drupal 8 (Drupal Tech Talk October 2014)
Entity API in Drupal 8 (Drupal Tech Talk October 2014)Entity API in Drupal 8 (Drupal Tech Talk October 2014)
Entity API in Drupal 8 (Drupal Tech Talk October 2014)
 
SMIRK, developing a mobile SMILE - presentation to IFLA Information Literacy ...
SMIRK, developing a mobile SMILE - presentation to IFLA Information Literacy ...SMIRK, developing a mobile SMILE - presentation to IFLA Information Literacy ...
SMIRK, developing a mobile SMILE - presentation to IFLA Information Literacy ...
 
Asist mit 2012
Asist mit 2012Asist mit 2012
Asist mit 2012
 
Surviving a Hackathon and Beyond
Surviving a Hackathon and BeyondSurviving a Hackathon and Beyond
Surviving a Hackathon and Beyond
 
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
 
Social dev camp_2011
Social dev camp_2011Social dev camp_2011
Social dev camp_2011
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
Make Your Content Nimble - Sem Tech UK
Make Your Content Nimble - Sem Tech UKMake Your Content Nimble - Sem Tech UK
Make Your Content Nimble - Sem Tech UK
 
Think like a storage architect, in four questions
Think like a storage architect, in four questionsThink like a storage architect, in four questions
Think like a storage architect, in four questions
 
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
Jeremy Engle's slides from Redshift / Big Data meetup on July 13, 2017
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptx
 
Capstone digital HI presentation
Capstone digital HI presentationCapstone digital HI presentation
Capstone digital HI presentation
 
Neo4j Graph Data Modeling
Neo4j Graph Data ModelingNeo4j Graph Data Modeling
Neo4j Graph Data Modeling
 
SMIRK presentation from ECIL2014
SMIRK presentation from ECIL2014SMIRK presentation from ECIL2014
SMIRK presentation from ECIL2014
 

Mehr von Neo4j

Mehr von Neo4j (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansQIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
 
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosBBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
 
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfRabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)
 
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
 
Enabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge GraphsEnabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge Graphs
 
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdfNeo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
 
Neo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with GraphNeo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with Graph
 

Kürzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Kaiso: Modeling Complex Class Hierarchies with Neo4j - David Szotten @ GraphConnect London 2013

  • 1. Kaiso  -­‐  an  object  persistence  framework  for   Python  and  Neo4j David  Szo>en
 onefinestay   ! ! ! @szo;en   github.com/davidszo;en 1 ©  Lifealike  Limited,  2013.
  • 2. Overview • About  onefinestay   • We  care  about  homes   • How  we  track  our  homes  using  Neo4j   • Kaiso  demo 2 ©  Lifealike  Limited,  2013.
  • 3. onefinestay  -­‐  the  unhotel   3 ©  Lifealike  Limited,  2013.
  • 4. onefinestay  -­‐  the  unhotel • Guests  live  like  a  local   – but  with  services  and  ameniNes  of  a  hotel   ! • Members  with  disNncNve  homes  earn
 hassle-­‐free  income   ! • From  just  a  handful  of  homes  in  2010  to
 over  1000  homes  in  4  ciNes  in  2013 4 ©  Lifealike  Limited,  2013.
  • 5. How  do  we  do  it? • Provision:  Home    Unhotel   – Clean   – Pack  away  certain  items   • Make  wardrobe  space   • Deprovision:  Unhotel    Home   – Clean   – Put  everything  back 5 ©  Lifealike  Limited,  2013.
  • 6. We  care  about  our  homes.  A  lot. • Every  home  is  different   • We  require  inNmate  knowledge   ! • For  guests:  “I  can’t  walk  up  stairs”,  “Where  is  the  iron?”   • For  members:  “Please  put  my  fragile  vase  away  before   the  guests  arrive”   • For  us:  “How  much  bed  linen  do  I  need  to  take  to  this   home  for  this  booking?” 6 ©  Lifealike  Limited,  2013.
  • 7. Previous  system • Custom  storage  soluNon   • Dates  back  to  when  we  were  much  smaller   • Problems:   – Siloed   – Hard  to  query    denormalised  copies 7 ©  Lifealike  Limited,  2013.
  • 8. New  system • Want  to  model  our  homes   – both  layout  and  contents   ! • Need  flexibility   – Our  needs  are  likely  to  grow  and  change   ! • Track  not  only  objects,  but  their  classes   – Ideally  treat  the  taxonomy  itself  as  data 8 ©  Lifealike  Limited,  2013.
  • 9. Enter  Neo4j • Handle  complex  data  structures   ! • Ensure  extensibility  for  future  needs   ! • Easy  to  create  powerful  queries   ! • Makes  for  a  nice  conceptual  model  of  our  data 9 ©  Lifealike  Limited,  2013.
  • 10. Flexibility  requirements • We  want  to  associate  informaNon  with  classes   as  well  as  objects   – This  dishwasher  is  of  make  Electropool   – (All)  appliances  need  PAT  tesNng   ! • Unlike  convenNonal  object  mappers,  the   taxonomy/class  hierarchy  needs  to  be  editable   by  users,  and  so  should  be  part  of  the  data 10 ©  Lifealike  Limited,  2013.
  • 11. Kaiso  -­‐  an  object  persistence  framework # (import some stuff)! ! class Animal(Entity):! id = Uuid(unique=True)! name = String()! friend_of = Outgoing(FriendOf)! ! class Carnivore(Animal): pass! class Herbivore(Animal): pass! ! class Penguin(Herbivore):! favourite_ice_cream = String()! ! class Lion(Carnivore):! n_siblings = Integer()! 11 ©  Lifealike  Limited,  2013.
  • 12. Kaiso:  Create  some  instances # import types, connect to db! ! manager = Manager("http://localhost:7474/db/data/")! ! manager.save(Lion)! manager.save(Penguin)! ! # create some instances! fred = Penguin(name="Fred")! tom = Lion(name="Tom")! ! relation = FriendOf(fred, tom)! ! manager.save(fred)! manager.save(tom)! manager.save(relation) 12 ©  Lifealike  Limited,  2013.
  • 13. Instances  are  saved  in  the  graph... FRIENDOF [6]  Penguin:  Fred 13 [7]  Lion:  Tom ©  Lifealike  Limited,  2013.
  • 14. ...  and  so  is  the  class  hierarchy [1]  Type:  Animal ISA ISA [4]  Type:  Herbivore [2]  Type:  Carnivore ISA ISA [3]  Type:  Lion [5]  Type:  Penguin INSTANCEOF INSTANCEOF FRIENDOF [6]  Penguin:  Fred 14 [7]  Lion:  Tom ©  Lifealike  Limited,  2013.
  • 15. Kaiso:  Queries  based  on  the  type  hierarchy START! Herbivore=node:persistabletype(id="Herbivore"),! Carnivore=node:persistabletype(id="Carnivore")! ! MATCH! Carnivore <-[:ISA*]-()<-[:INSTANCEOF]-(carnivore),! Herbivore <-[:ISA*]-()<-[:INSTANCEOF]-(herbivore),! ! ! (herbivore)-[:FRIENDOF]->(carnivore)! RETURN! "The herbivore",! herbivore.name,! “is a friend of the carnivore",! carnivore.name;! ! => +--------------------------------------------------------------------+! => | "The herbivore" | "Fred" | "is a friend of the carnivore" | “Tom" | => +--------------------------------------------------------------------+ 15 ©  Lifealike  Limited,  2013.
  • 16. Thank  you QuesNons?   ! ! Kaiso   github.com/onefinestay/kaiso   ! github.com/davidszo;en   @davidszo;en 16 ©  Lifealike  Limited,  2013.