Cypher Query Language
Upcoming SlideShare
Loading in...5
×
 

Cypher Query Language

on

  • 4,643 views

Cypher is a declarative query language recently added to the Neo4j graph database. In this talk we explain the motivations for creating this language, describe its current features and design, and ...

Cypher is a declarative query language recently added to the Neo4j graph database. In this talk we explain the motivations for creating this language, describe its current features and design, and dive a little into its implementation. Finally, we discuss the future direction of how we expect the language to evolve.

Statistics

Views

Total Views
4,643
Views on SlideShare
4,643
Embed Views
0

Actions

Likes
2
Downloads
59
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Cypher Query Language Cypher Query Language Presentation Transcript

  • FOSDEM 2012 Graph Processing Room 5 Feb 2012 Cypher Query Language Andrés Taylor and Alistair JonesWednesday, February 8, 2012
  • What is Cypher? • Graph Query Language for Neo4j • Aims to make querying simpleWednesday, February 8, 2012
  • Motivation Something new? • Existing Neo4j query mechanisms were not simple enough • Too verbose (Java API) • Too prescriptive (Gremlin)Wednesday, February 8, 2012 View slide
  • Motivation SQL? • Unable to express paths • these are crucial for graph-based reasoning • neo4j is schema/table freeWednesday, February 8, 2012 View slide
  • Motivation SPARQL? • SPARQL designed for a different data model • namespaces • properties as nodesWednesday, February 8, 2012
  • DesignWednesday, February 8, 2012
  • Design Decisions Declarative Imperative Declarative follow relationship specify starting point breadth-first vs depth-first specify desired outcome explicit algorithm algorithm adaptable based on queryWednesday, February 8, 2012
  • Design Decisions Pattern matchingWednesday, February 8, 2012
  • Design Decisions Pattern matching A B CWednesday, February 8, 2012
  • Design Decisions A Pattern matching B CWednesday, February 8, 2012
  • Design Decisions A Pattern matching B CWednesday, February 8, 2012
  • Design Decisions A Pattern matching B CWednesday, February 8, 2012
  • Design Decisions A Pattern matching B CWednesday, February 8, 2012
  • Design Decisions ASCII-art patternsWednesday, February 8, 2012
  • Design Decisions ASCII-art patterns () --> ()Wednesday, February 8, 2012
  • Design Decisions ASCII-art patterns A BWednesday, February 8, 2012
  • Design Decisions ASCII-art patterns A B (A) --> (B)Wednesday, February 8, 2012
  • Design Decisions ASCII-art patterns LOVES A BWednesday, February 8, 2012
  • Design Decisions ASCII-art patterns LOVES A B A -[:LOVES]-> BWednesday, February 8, 2012
  • Design Decisions ASCII-art patterns A B CWednesday, February 8, 2012
  • Design Decisions ASCII-art patterns A B C A --> B --> CWednesday, February 8, 2012
  • Design Decisions ASCII-art patterns A B CWednesday, February 8, 2012
  • Design Decisions ASCII-art patterns A B C A --> B --> C, A --> CWednesday, February 8, 2012
  • Design Decisions ASCII-art patterns A B C A --> B --> C, A --> C A --> B --> C <-- AWednesday, February 8, 2012
  • Design Decisions Variable length paths A B A B A B ...Wednesday, February 8, 2012
  • Design Decisions Variable length paths A B A B A B ... A -[*]-> BWednesday, February 8, 2012
  • Design Decisions Optional relationships A BWednesday, February 8, 2012
  • Design Decisions Optional relationships A B A -[?]-> BWednesday, February 8, 2012
  • Design Decisions Closures start london = node(1), moscow = node(2) match path = london -[*]-> moscow where all(city in nodes(path) where city.capital = true)Wednesday, February 8, 2012
  • Design Decisions Parsed, not an internal DSL Execution Semantics Serialisation Type System PortabilityWednesday, February 8, 2012
  • Design Decisions Familiar for SQL users select start from match where where group by return order byWednesday, February 8, 2012
  • ImplementationWednesday, February 8, 2012
  • Implementation Execution Plan start n=node(0) return n Parameters() Nodes(n) Extract([n]) ColumnFilter([n])Wednesday, February 8, 2012
  • Implementation Execution Plan start n=node(0) match n-[*]-> b return n.name, n, count(*) order by n.age Parameters() Nodes(n) PatternMatch(n-[*]->b) Extract([n.name, n]) EagerAggregation( keys: [n.name, n], aggregates: [count(*)]) Extract([n.age]) Sort(n.age ASC) ColumnFilter([n.name,n,count(*)])Wednesday, February 8, 2012
  • Implementation Execution Plan start n=node(0) match n-[*]-> b return n.name, n, count(*) order by n.name Parameters() Nodes(n) PatternMatch(n-[*]->b) Extract([n.name, n]) Sort(n.name ASC,n ASC) EagerAggregation( keys: [n.name, n], aggregates: [count(*)]) ColumnFilter([n.name,n,count(*)])Wednesday, February 8, 2012
  • Thanks for Listening! Questions? Andrés Taylor andres.taylor@neotechnology.com @andres_taylor Alistair Jones alistair.jones@neotechnology.com @apcjWednesday, February 8, 2012