Your SlideShare is downloading. ×
0

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,999
On Slideshare
0
From Embeds
0
Number of Embeds
32
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Webinar Aug 8 2013 What‘s new in Neo4j 2.0 Michael Hunger, Neo Technology @mesirii | @neo4j
  • 2. BIG NEWS Neo4j 2.0.0-M04 released today!
  • 3. Neo4j 2.0
  • 4. Why 2.0?
  • 5. (0.x) --> (1.x) --> (2.x) • 0.x was about embedded java • 1.x introduced indexes, the server and REST • 2.x ease of use, big data, cloud which means a focus on...
  • 6. This guy
  • 7. Focus on Cypher • Cypher, a carefully crafted language for working with graphs • Declarative, friendly, easy to read and write • One language, used everywhere • REST for management, Java for extensions
  • 8. What is new in 2.0?
  • 9. Introducing: Node Labels
  • 10. WORKS_WITH Person Employee Developer Husband NoSQL GraphDB Database Awesome! No Schema is good Some Structure is helpful
  • 11. • Simply: a label identifies a set of nodes • Nodes can have multiple labels • Find nodes by label • Constrain properties and values (lightweight, optional schema) • A simple idea, with powerful applications Introducing Node Labels NoSQL GraphDB Database Awesome!
  • 12. How to use labels?
  • 13. Labels - how to use? • To identify nodes • To categorize, tag • To represent types • To avoid confusion • For special nodes (domain specific reference nodes)
  • 14. Labels - rules of thumb • Use a label to make queries easier to read & write • And to improve performance through indexing • Start with anything you might've put in a legacy index • Use lightly, as few labels as needed
  • 15. Find friends who like cheese MATCH (p:Person)-[:FRIENDS]->(friend:Person), (friend) -[:LIKE]-> (thing:Thing) WHERE p.name = "Max De Marzi" AND thing:Food AND thing.name = "Cheese" RETURN thing, labels(thing);
  • 16. Schema Indexing • Indexes for labels, based on a property • Simple lookups for now • Unique indexing coming soon • Full-text, other special indexes in planning CREATE INDEX ON :Person(name) MATCH (p:Person) WHERE p.name = „Max“ RETURN p
  • 17. MERGE operation • a combination of MATCH + CREATE • replaces CREATE UNIQUE (currently still limited) • attempts to MATCH, with specified properties and labels • if match fails, new graph data is created • optional sub-clauses for handling ON CREATE, and ON MATCH MERGE (p:Person { name:'Charlie Sheen', age:10 }) ON CREATE p SET p.created = timestamp() RETURN p
  • 18. Hands-On Cypher • Migrate Cineasts dataset to use Labels • Show MATCH on Labels and Properties (+ profile) • Add an Index on :Person(name) :Movie(title) • Show MATCH on Labels and Properties (+ profile) • Show MERGE with a user https://gist.github.com/jexp/6193139#file-setup-start-sh https://gist.github.com/jexp/6193139#file-upgrade-movie-database-to-2-0-cql
  • 19. Demo
  • 20. Anything else? • Breaking changes to some APIs (read CHANGES.txt) • Migration of "legacy" indexes (stop STARTing) • Mandatory transactions for all DB interactions • Improving installers (in progress) • Changing everything to be "all Cypher, all the time"
  • 21. Cypher Changes: Properties • no schema -> what happens when properties don‘t exist • has(n.prop) AND n.prop=“Foobar“ • there was syntactic sugar n.prop! and n.prop? • now n.prop returns NULL covers n.prop! =“Foobar“ • explicit expression for n.prop? = „Foobar“ WHERE n.name = „Chris“ AND (not(m.name) OR m.name=“Andres“)
  • 22. Cypher Changes: REMOVE • consistent remove operations of labels and properties • you REMOVE attributes (properties, labels) • and DELETE elements (nodes, relationships) REMOVE n.name REMOVE n:People DELETE node DELETE relationship
  • 23. Cypher Changes: Separators • grammar has to be unambiguous • extract(n in nodes:Foo)??? • confuse colon from label and collection function separator • exchanged colon for pipe EXTRACT (n in nodes | n.name) FILTER (n in nodes | n.name =~ „And.*“) FOREACH (v in names | CREATE ( {name: v} ))
  • 24. Demo
  • 25. Mandatory Transactions • we had optional transactions for reads • Issues: • In which context do I read? • Do I read what I read? • Which changes do I see? • NOW: Mandatory Transactions for reads and writes! • only affects embedded API • Cypher and REST-API take care of their transactions
  • 26. • begin, commit, or rollback a transaction • transaction as RESTful resource • issue multiple statements per request • multiple requests per transaction • compact response format • some driver already support it (neography, jdbc) Transactional Cypher
  • 27. Hands-On 2.0 • Show Transactional HTTP-Endpoint • POST initial statements, look at result, check currently running tx in server-info • POST another create statement to the tx • POST a new read statement to a new tx that shows isolation • DELETE second transaction • POST to COMMIT resource https://gist.github.com/jexp/6193139#file-demo-transactional-endpoint-js
  • 28. What is new in 2.0? • It's all about Cypher, starting with • Labels, the first significant change in over 12 years • Mix in schema indexing • Then transactional REST, new clauses, functions • A fresh Web UI that is Cypher-focused
  • 29. Thanks :) MATCH (you)-[:HAVE]->(q:Question) RETURN q.text @neo4j or @mesirii to keep in touch

×