Upload
otavio-goncalves-de-santana
View
464
Download
1
Embed Size (px)
Citation preview
Graph
● Neo4j● InfoGrid● Sones● HyperGraphDB
Apollo Ares
Kratoswas killed by was killed by
Is brother
killed killed
SQL Key-value Document Column Graph
Table Bucket Collection Column Family
Vertex and Edge
Row Key/value pair
Document Column Vertex
Column Key/value pair
Key/value pair
Vertex and Edge property
Relationship Link Edge
Graph
Grace Hopper
label Person
id ada
name Ada Lovelace
occupation scientist
Ada Lovelace
label Person
id grace
name Grace Hopper
occupation scientist
Knows
Vertex Vertex
Edge
Graph
Radioactive
label Person
id marie_curie
name Marie Curie
occupation scientist
Marie Curie
label nature
id radioactive
name Radioactive
discovers
when 1867
where Europe
TinkerPop
Grace Hopper
label Person
id grace
name Grace Hopper
occupation scientist
Vertex
grace = graph.addVertex( T.label, "person", "id", "grace", "name", "Grace Hopper", "occupation", "scientist");
SQLId name Occupation Salary age gender
... ... ... ... ... ...
SELECT * FROM Person WHERE
occupation = "Engineer" AND
salary > 3000 and age BETWEEN 20
AND 25
TinkerPopGrace Hopper
Ada Lovelace
Knows
g.V().has("occupation","Engineer").has("salary", gt(3000)).has("age", between(20, 25));
SQLId name Occupation Salary age gender
... ... ... ... ... ...
SELECT name FROM Person WHERE
occupation = "Engineer" AND
salary > 3000 and age BETWEEN 20
AND 25
TinkerPopGrace Hopper
Ada Lovelace
Knows
g.V().has("occupation","Engineer").has("salary", gt(3000)).has("age", between(20, 25)).values("name");
SQLId name Occupation Salary age gender
... ... ... ... ... ...
SELECT count(*) FROM Person WHERE
occupation = "Engineer" AND
salary > 3000 and age BETWEEN 20
AND 25
TinkerPopGrace Hopper
Ada Lovelace
Knows
g.V().has("occupation","Engineer").has("salary", gt(3000)).has("age", between(20, 25)).count();
TinkerPopGrace Hopper
Ada Lovelace
Knows
g.V().has("occupation","Engineer").has("salary", gt(3000)).has("age", between(20, 25)).groupCount().by(“city”);
SQLId name Occupation Salary age gender
... ... ... ... ... ...
SELECT * FROM Person WHERE
occupation = "Engineer" AND
salary > 3000 and age BETWEEN 20
AND 25//...joins
Id know
... ...
TinkerPopGrace Hopper
Ada Lovelace
Knows
g.V().has("occupation","Engineer").has("salary", gt(3000)).has("age", between(20, 25)).out("knows");
SQLId name Occupation Salary age gender
... ... ... ... ... ...
SELECT * FROM Person WHERE
occupation = "Engineer" AND
salary > 3000 and age BETWEEN 20
AND 25//...joins
Id know
... ...
Id love
... ...
TinkerPopGrace Hopper
Ada Lovelace
Knows
g.V().has("occupation","Engineer").has("salary", gt(3000)).has("age", between(20, 25)).outE("knows").has("feel", "love").bothV();
g.V().repeat(out("eats")).times(3);
g.V().repeat(out("eats")).until(has("name", "grass"));
//path().by("name");