neo4j. План cypher – Создание – Запросы neo4j embedded in java Немного...

17
Neo4j

Upload: marisol-urch

Post on 31-Mar-2015

263 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Neo4j

Page 2: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

План

• Cypher – Создание– Запросы

• Neo4j embedded in Java

• Немного о релизации (Neo4j Internals)– Native Graph Processing– Native Graph Storage

Page 3: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Neo4j

Page 4: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native
Page 5: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Cypher: Создание

CREATE: Creates nodes and relationships.MERGE: Creates nodes uniquely.CREATE UNIQUE: Creates relationships uniquely.DELETE: Removes nodes, relationships.SET: Updates properties and labels.REMOVE: Removes properties and labels.FOREACH: Performs updating actions once per element in a list.WITH: Divides a query into multiple, distinct parts and passes results from one to the next.

Page 6: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Cypher: запросы

MATCH: Matches the given graph pattern in the graph data.WHERE: Filters using predicates or anchors pattern elements.RETURN: Returns and projects result data, also handles aggregation.ORDER BY: Sorts the query result.SKIP/LIMIT: Paginates the query result.

Page 7: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Paths

• ()-[]->()• ()<-[]-()• ()-[:RelationshipType*N]->()• ()-[]->()<-[]-()

Page 8: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Aggregates

count(x) Count the number of occurrencesmin(x) Get the lowest valuemax(x) Get the highest valueavg(x) Get the average of a numeric valuesum(x) Sum up valuescollect(x) Collect all the values into an collection

Page 9: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native
Page 10: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native
Page 11: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Native Graph Storage

• Store files:– Nodes– Relationships– Properties– etc

• Fixed-sized records (node 9 bytes, rel 33 bytes,…) -> быстрый поиск по ID:– node {id:90} - > в store file его запись

начинается с 900 байта - > поиск нода за O(1)

Page 12: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Движение по store files

Node (9 bytes)

Page 13: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native
Page 14: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Native Graph Processing

• Index-free adjacency

Page 15: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

O(log n)

Page 16: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

O(1)

Page 17: Neo4j. План Cypher – Создание – Запросы Neo4j embedded in Java Немного о релизации (Neo4j Internals) – Native Graph Processing – Native

Источники

• http://www.neo4j.org/• http://docs.neo4j.org/chunked/milestone/• Ian Robinson, Jim Webber, and Emil Eifrém

Graph Databases The Definitive Book onGraph Databases