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

Post on 31-Mar-2015

263 Views

Category:

Documents

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Neo4j

План

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

• Neo4j embedded in Java

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

Neo4j

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.

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.

Paths

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

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

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)

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

Node (9 bytes)

Native Graph Processing

• Index-free adjacency

O(log n)

O(1)

Источники

• 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

top related