SlideShare una empresa de Scribd logo
1 de 39
Descargar para leer sin conexión
Hands On Spring Data

Eric Bottard, Developer Advocate, VMware
@ebottard
Florent Biville, Developer, Lateral Thoughts
@fbiville



© 2012 SpringSource, by VMware
Eric BOTTARD


• Developer Advocate VMware
•   @ebottard
•   ebottard@vmware.com




2
Florent BIVILLE


• Développeur chez LateralThoughts
•   @fbiville




3
“   Spring Data is an umbrella project which
    aims to provide a familiar and consistent
    Spring-based programming model for for
    new datastores while retaining store-
    specific features and capabilities
Relational




JDBC
JPA
Document store




MongoDB
CouchDB
Column oriented




HBase
Cassandra
Graph




Neo4j
OrientDB
Data Grids




GemFire
Coherence
Terracotta
Key Value




Redis
Riak
Big Data




Hadoop
Templates
Mapping
Mapping


• Tells the framework how to store object properties and
  relationships
• Favors convention over configuration
• Does not try to shoehorn one model into another (e.g.
  does not use JPA annotations for Mongo)




14
Example: MongoDB
@Document
@CompoundIndexes({
    @CompoundIndex(name = "age_idx", def = "{'lastName': 1, 'age': -1}")
})
public class Person<T extends Address> {

  @Id
  private String id;

  @Indexed(unique = true)
  private Integer ssn;

  @Field("fName")
  private String firstName;

  @Indexed
  private String lastName;

  @Transient
  private Integer accountTotal;

  @DBRef
  private List<Account> accounts;

  private T address;
Repositories
Repositories


public interface PersonRepository
    extends CrudRepository<User, Long> {

       …

}

No implementation needed!
Magic Finders
Magic Finders
public interface PersonRepository extends Repository<User, Long> {

 List<Person> findByEmailAddressAndLastname(EmailAddress emailAddress, String
lastname);

  // Enables the distinct flag for the query
  List<Person> findDistinctPeopleByLastnameOrFirstname(String lastname, String
firstname);
  List<Person> findPeopleDistinctByLastnameOrFirstname(String lastname, String
firstname);

  // Enabling ignoring case for an individual property
  List<Person> findByLastnameIgnoreCase(String lastname);
  // Enabling ignoring case for all suitable properties
  List<Person> findByLastnameAndFirstnameAllIgnoreCase(String lastname, String
firstname);

    // Enabling static ORDER BY for a query
    List<Person> findByLastnameOrderByFirstnameAsc(String lastname);
    List<Person> findByLastnameOrderByFirstnameDesc(String lastname);
}
Pagination
Pagination and Dynamic Ordering


public interface PersonRepository
    extends CrudRepository<User, Long> {

    Page<User> findByLastname(String lastname, Pageable pageable);




    List<User> findByLastname(String lastname, Sort sort);

    // NOTE: Pageable embeds a Sort


}
Qu eries
Explicit Queries


public interface ProductsRepository extends JpaRepository<Product, Long> {

	   @Query(value = "select p from Product p order by p.rating desc",
       countQuery = "select count(p) from Product p")
	   Page<Product> findTopRated(Pageable pageable);
}
Cross Store support
Query DSL Integration
REST
REST Shell
Customization
JSON
Mongo DB - schema-less document DB

databases
mongo> show dbs;
  myDatabase 0.3046578 GB
mongo> use myDatabase;

  collections
  mongo> show collections;
    rockCollection
    colleagueSean
  mongo> db.rockCollection.find().pretty(); // last call “prettifies” output

     documents
     mongo> db.rockCollection.find({name:"The Beatles"}).pretty();
       {"_id" : ObjectId("50b7d870744e5ef5eee5224e"),
       "_class" : "xxx.music.domain.Band",
       "name" : "The Beatles",
       [...] }
MongoDB: Queries as JSON documents



db.inventory.find({
 price:1.99,
 $or: [
   { qty: { $lt: 20 } },
   { sale: true }
 ]
})
GridFS - can I haz large objectz?
• mongo> show collections;
     – fs.chunks
     – fs.files
• CHUNKS
     – 256KB portion of a Mongo object (a.k.a. file), stored into
       collection “fs.chunks”
• FILES
     – Metadata about the file stored into “fs.files”: filename, content
       type ...


• Spring Data brings
     – GridFsTemplate
     – GridFsResource (wraps GridFSDBFile)

33
Nodes & Relationships




35
Nodes


                                                   NoSQL
 Spring        HELPS_WITH                    standsFor: "Not Only
  Data         how: "it roxx"                       SQL"




IS_PART_OF
                                Properties

             Relationship


    Spring
Cypher
Neo4J - Cypher Query Language

start doctor=node:characters(character = 'Doctor')
match (doctor)<-[:COMPANION_OF]-(companion)
    -[:APPEARED_IN]->(episode)
return companion.character, count(episode)
order by count(episode) desc
limit 5
Image credits

•    keys http://www.sxc.hu/photo/1381979
•    spiderweb http://www.sxc.hu/photo/1309629
•    columns http://www.sxc.hu/photo/511217
•    documents http://www.sxc.hu/photo/913588
•    umbrella http://www.sxc.hu/photo/1182110
•    nail http://www.sxc.hu/photo/1101239
•    relational http://www.sxc.hu/photo/541351
•    callback http://www.sxc.hu/photo/1134440
•    repositories http://www.sxc.hu/photo/1352633
•    pagination http://www.sxc.hu/photo/830250
•    magic http://www.sxc.hu/photo/829135
•    cypher http://www.sxc.hu/photo/1118342
•    mapping http://www.sxc.hu/photo/1147986
•    grid http://www.sxc.hu/photo/1222068
•    elephant http://www.sxc.hu/photo/1168187
•    cross knot http://www.sxc.hu/photo/1396427
•    rope knot http://www.sxc.hu/photo/1181983
•    married http://www.sxc.hu/photo/937988
•    shell http://www.sxc.hu/photo/866402
•    diesel http://www.sxc.hu/photo/1076436
•    car tuning http://www.sxc.hu/photo/5877
•    rest on couch: If you haven’t, go watch Fight Club. NOW.



39

Más contenido relacionado

La actualidad más candente

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBNosh Petigara
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationMongoDB
 
Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseAlexandre Rafalovitch
 
Elasticsearch in 15 minutes
Elasticsearch in 15 minutesElasticsearch in 15 minutes
Elasticsearch in 15 minutesDavid Pilato
 
Elastic Search
Elastic SearchElastic Search
Elastic SearchNavule Rao
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...MongoDB
 
Elastify you application: from SQL to NoSQL in less than one hour!
Elastify you application: from SQL to NoSQL in less than one hour!Elastify you application: from SQL to NoSQL in less than one hour!
Elastify you application: from SQL to NoSQL in less than one hour!David Pilato
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_dbRomain Testard
 
Morphia: Simplifying Persistence for Java and MongoDB
Morphia:  Simplifying Persistence for Java and MongoDBMorphia:  Simplifying Persistence for Java and MongoDB
Morphia: Simplifying Persistence for Java and MongoDBJeff Yemin
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMetatagg Solutions
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationMongoDB
 
10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators  10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators iammutex
 
Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 MinutesKarel Minarik
 
Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Karel Minarik
 
mongoDB Performance
mongoDB PerformancemongoDB Performance
mongoDB PerformanceMoshe Kaplan
 

La actualidad más candente (20)

Elastic search 검색
Elastic search 검색Elastic search 검색
Elastic search 검색
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB Application
 
Solr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by CaseSolr vs. Elasticsearch - Case by Case
Solr vs. Elasticsearch - Case by Case
 
Elasticsearch in 15 minutes
Elasticsearch in 15 minutesElasticsearch in 15 minutes
Elasticsearch in 15 minutes
 
Indexing
IndexingIndexing
Indexing
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 
Elastic Search
Elastic SearchElastic Search
Elastic Search
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
 
Elastify you application: from SQL to NoSQL in less than one hour!
Elastify you application: from SQL to NoSQL in less than one hour!Elastify you application: from SQL to NoSQL in less than one hour!
Elastify you application: from SQL to NoSQL in less than one hour!
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_db
 
Morphia: Simplifying Persistence for Java and MongoDB
Morphia:  Simplifying Persistence for Java and MongoDBMorphia:  Simplifying Persistence for Java and MongoDB
Morphia: Simplifying Persistence for Java and MongoDB
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg Solutions
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB Application
 
10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators  10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators
 
MongoDB and Python
MongoDB and PythonMongoDB and Python
MongoDB and Python
 
Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 Minutes
 
Python and MongoDB
Python and MongoDB Python and MongoDB
Python and MongoDB
 
Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]
 
mongoDB Performance
mongoDB PerformancemongoDB Performance
mongoDB Performance
 

Similar a Hands On Spring Data

Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Oliver Gierke
 
An introduction into Spring Data
An introduction into Spring DataAn introduction into Spring Data
An introduction into Spring DataOliver Gierke
 
Terrastore - A document database for developers
Terrastore - A document database for developersTerrastore - A document database for developers
Terrastore - A document database for developersSergio Bossa
 
Polyglot metadata for Hadoop
Polyglot metadata for HadoopPolyglot metadata for Hadoop
Polyglot metadata for HadoopJim Dowling
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...NoSQLmatters
 
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKrCreating web applications with LODSPeaKr
Creating web applications with LODSPeaKrAlvaro Graves
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)javier ramirez
 
Building Your First MongoDB App
Building Your First MongoDB AppBuilding Your First MongoDB App
Building Your First MongoDB AppHenrik Ingo
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowKarsten Dambekalns
 
Rails and alternative ORMs
Rails and alternative ORMsRails and alternative ORMs
Rails and alternative ORMsJonathan Dahl
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020Thodoris Bais
 
Simplifying Persistence for Java and MongoDB with Morphia
Simplifying Persistence for Java and MongoDB with MorphiaSimplifying Persistence for Java and MongoDB with Morphia
Simplifying Persistence for Java and MongoDB with MorphiaMongoDB
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling rogerbodamer
 
Webinar: Simplifying Persistence for Java and MongoDB
Webinar: Simplifying Persistence for Java and MongoDBWebinar: Simplifying Persistence for Java and MongoDB
Webinar: Simplifying Persistence for Java and MongoDBMongoDB
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code FirstJames Johnson
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 
Managing Social Content with MongoDB
Managing Social Content with MongoDBManaging Social Content with MongoDB
Managing Social Content with MongoDBMongoDB
 
Compass Framework
Compass FrameworkCompass Framework
Compass FrameworkLukas Vlcek
 

Similar a Hands On Spring Data (20)

Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!
 
An introduction into Spring Data
An introduction into Spring DataAn introduction into Spring Data
An introduction into Spring Data
 
Terrastore - A document database for developers
Terrastore - A document database for developersTerrastore - A document database for developers
Terrastore - A document database for developers
 
Polyglot metadata for Hadoop
Polyglot metadata for HadoopPolyglot metadata for Hadoop
Polyglot metadata for Hadoop
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
 
LibreCat::Catmandu
LibreCat::CatmanduLibreCat::Catmandu
LibreCat::Catmandu
 
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKrCreating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)
 
Building Your First MongoDB App
Building Your First MongoDB AppBuilding Your First MongoDB App
Building Your First MongoDB App
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
 
Rails and alternative ORMs
Rails and alternative ORMsRails and alternative ORMs
Rails and alternative ORMs
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
Simplifying Persistence for Java and MongoDB with Morphia
Simplifying Persistence for Java and MongoDB with MorphiaSimplifying Persistence for Java and MongoDB with Morphia
Simplifying Persistence for Java and MongoDB with Morphia
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling
 
Webinar: Simplifying Persistence for Java and MongoDB
Webinar: Simplifying Persistence for Java and MongoDBWebinar: Simplifying Persistence for Java and MongoDB
Webinar: Simplifying Persistence for Java and MongoDB
 
La sql
La sqlLa sql
La sql
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code First
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
Managing Social Content with MongoDB
Managing Social Content with MongoDBManaging Social Content with MongoDB
Managing Social Content with MongoDB
 
Compass Framework
Compass FrameworkCompass Framework
Compass Framework
 

Más de Eric Bottard

Devoxx France 2013 Cloud Best Practices
Devoxx France 2013 Cloud Best PracticesDevoxx France 2013 Cloud Best Practices
Devoxx France 2013 Cloud Best PracticesEric Bottard
 
LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices
LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best PracticesLyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices
LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best PracticesEric Bottard
 
Cloud Best Practices
Cloud Best PracticesCloud Best Practices
Cloud Best PracticesEric Bottard
 
Cf intro for spring devs
Cf intro for spring devsCf intro for spring devs
Cf intro for spring devsEric Bottard
 
CloudFoundry Bootcamp springone2gx
CloudFoundry Bootcamp springone2gxCloudFoundry Bootcamp springone2gx
CloudFoundry Bootcamp springone2gxEric Bottard
 
Hands On CloudFoundry
Hands On CloudFoundryHands On CloudFoundry
Hands On CloudFoundryEric Bottard
 

Más de Eric Bottard (6)

Devoxx France 2013 Cloud Best Practices
Devoxx France 2013 Cloud Best PracticesDevoxx France 2013 Cloud Best Practices
Devoxx France 2013 Cloud Best Practices
 
LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices
LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best PracticesLyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices
LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices
 
Cloud Best Practices
Cloud Best PracticesCloud Best Practices
Cloud Best Practices
 
Cf intro for spring devs
Cf intro for spring devsCf intro for spring devs
Cf intro for spring devs
 
CloudFoundry Bootcamp springone2gx
CloudFoundry Bootcamp springone2gxCloudFoundry Bootcamp springone2gx
CloudFoundry Bootcamp springone2gx
 
Hands On CloudFoundry
Hands On CloudFoundryHands On CloudFoundry
Hands On CloudFoundry
 

Hands On Spring Data

  • 1. Hands On Spring Data Eric Bottard, Developer Advocate, VMware @ebottard Florent Biville, Developer, Lateral Thoughts @fbiville © 2012 SpringSource, by VMware
  • 2. Eric BOTTARD • Developer Advocate VMware • @ebottard • ebottard@vmware.com 2
  • 3. Florent BIVILLE • Développeur chez LateralThoughts • @fbiville 3
  • 4. Spring Data is an umbrella project which aims to provide a familiar and consistent Spring-based programming model for for new datastores while retaining store- specific features and capabilities
  • 14. Mapping • Tells the framework how to store object properties and relationships • Favors convention over configuration • Does not try to shoehorn one model into another (e.g. does not use JPA annotations for Mongo) 14
  • 15. Example: MongoDB @Document @CompoundIndexes({ @CompoundIndex(name = "age_idx", def = "{'lastName': 1, 'age': -1}") }) public class Person<T extends Address> { @Id private String id; @Indexed(unique = true) private Integer ssn; @Field("fName") private String firstName; @Indexed private String lastName; @Transient private Integer accountTotal; @DBRef private List<Account> accounts; private T address;
  • 17. Repositories public interface PersonRepository extends CrudRepository<User, Long> { … } No implementation needed!
  • 19. Magic Finders public interface PersonRepository extends Repository<User, Long> { List<Person> findByEmailAddressAndLastname(EmailAddress emailAddress, String lastname); // Enables the distinct flag for the query List<Person> findDistinctPeopleByLastnameOrFirstname(String lastname, String firstname); List<Person> findPeopleDistinctByLastnameOrFirstname(String lastname, String firstname); // Enabling ignoring case for an individual property List<Person> findByLastnameIgnoreCase(String lastname); // Enabling ignoring case for all suitable properties List<Person> findByLastnameAndFirstnameAllIgnoreCase(String lastname, String firstname); // Enabling static ORDER BY for a query List<Person> findByLastnameOrderByFirstnameAsc(String lastname); List<Person> findByLastnameOrderByFirstnameDesc(String lastname); }
  • 21. Pagination and Dynamic Ordering public interface PersonRepository extends CrudRepository<User, Long> { Page<User> findByLastname(String lastname, Pageable pageable); List<User> findByLastname(String lastname, Sort sort); // NOTE: Pageable embeds a Sort }
  • 23. Explicit Queries public interface ProductsRepository extends JpaRepository<Product, Long> { @Query(value = "select p from Product p order by p.rating desc", countQuery = "select count(p) from Product p") Page<Product> findTopRated(Pageable pageable); }
  • 26. REST
  • 29.
  • 30. JSON
  • 31. Mongo DB - schema-less document DB databases mongo> show dbs; myDatabase 0.3046578 GB mongo> use myDatabase; collections mongo> show collections; rockCollection colleagueSean mongo> db.rockCollection.find().pretty(); // last call “prettifies” output documents mongo> db.rockCollection.find({name:"The Beatles"}).pretty(); {"_id" : ObjectId("50b7d870744e5ef5eee5224e"), "_class" : "xxx.music.domain.Band", "name" : "The Beatles", [...] }
  • 32. MongoDB: Queries as JSON documents db.inventory.find({ price:1.99, $or: [ { qty: { $lt: 20 } }, { sale: true } ] })
  • 33. GridFS - can I haz large objectz? • mongo> show collections; – fs.chunks – fs.files • CHUNKS – 256KB portion of a Mongo object (a.k.a. file), stored into collection “fs.chunks” • FILES – Metadata about the file stored into “fs.files”: filename, content type ... • Spring Data brings – GridFsTemplate – GridFsResource (wraps GridFSDBFile) 33
  • 34.
  • 36. Nodes NoSQL Spring HELPS_WITH standsFor: "Not Only Data how: "it roxx" SQL" IS_PART_OF Properties Relationship Spring
  • 38. Neo4J - Cypher Query Language start doctor=node:characters(character = 'Doctor') match (doctor)<-[:COMPANION_OF]-(companion) -[:APPEARED_IN]->(episode) return companion.character, count(episode) order by count(episode) desc limit 5
  • 39. Image credits • keys http://www.sxc.hu/photo/1381979 • spiderweb http://www.sxc.hu/photo/1309629 • columns http://www.sxc.hu/photo/511217 • documents http://www.sxc.hu/photo/913588 • umbrella http://www.sxc.hu/photo/1182110 • nail http://www.sxc.hu/photo/1101239 • relational http://www.sxc.hu/photo/541351 • callback http://www.sxc.hu/photo/1134440 • repositories http://www.sxc.hu/photo/1352633 • pagination http://www.sxc.hu/photo/830250 • magic http://www.sxc.hu/photo/829135 • cypher http://www.sxc.hu/photo/1118342 • mapping http://www.sxc.hu/photo/1147986 • grid http://www.sxc.hu/photo/1222068 • elephant http://www.sxc.hu/photo/1168187 • cross knot http://www.sxc.hu/photo/1396427 • rope knot http://www.sxc.hu/photo/1181983 • married http://www.sxc.hu/photo/937988 • shell http://www.sxc.hu/photo/866402 • diesel http://www.sxc.hu/photo/1076436 • car tuning http://www.sxc.hu/photo/5877 • rest on couch: If you haven’t, go watch Fight Club. NOW. 39