0
Graph Data
Linked Data and
Property Graphs
Contents
● Example
● LD/RDF
● PG
● SPARQL
● Gremlin/Cypher
● BIG data
– Apache Giraph / Bulk Synchronous Processing
● Idea...
Graphs
● A set of vertices (nodes) and edges (arcs)
● Except the useful kind have labels on edges
● … and the nodes are ju...
Graphs
G = ( V , E )
V – Vertexes (Nodes)
E – Edges (Arcs, Links)
Graphs
Graphs For Information
Alice
Bob
Eve
listensTo
knows
Graphs For Information
Alice
... has a name “Alice Hacker”
... has an employee number
Linked Data / RDF
● Standards
– What it means
– Syntaxes for exchanging data
– Query language
● URI name things globally
●...
Linked Data
★ make your stuff available on the Web (whatever
format) under an open license
★★ make it available as structu...
Linked Data / RDF
http://example/alice
"Alice Hacker"
foaf:name
http://example/bob
foaf:knows
prefix person: <http://examp...
JSON-LD
● Links and semantics for the JSON ecosystem
{
"@context" : "http://example/person.jsonld",
"@graph" : [ {
"@id" :...
SPARQL Query
prefix person: <http://example/person/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
<http://example/alice> foaf...
Property Graphs
● Separates Links and Attributes
● Nodes have attributes
– … and so do edges
● Different definitions
– htt...
Build
Graph graph = new TinkerGraph();
Vertex a = graph.addVertex("alice");
Vertex b = graph.addVertex("bob");
a.setProper...
GSON
{
"edges" : [
{
"_id" : "k1" ,
"_inV" : "bob" ,
"_label" : "knows" ,
"_outV" : "alice" ,
"_type" : "edge"
} ,
{
"_id"...
Gremlin
// Groovy to Java
@SuppressWarnings("unchecked")
Pipe<Vertex,Vertex> pipe = Gremlin.compile("g.v('alice').out('kno...
Cypher Query
● Neo4J specific
● Property Graph + “labels” (= types) – node names
CREATE (alice { name: 'Alice Hacker'} ) ,...
Upcoming SlideShare
Loading in...5
×

Graph Data -- RDF and Property Graphs

2,859

Published on

A comparison of two graph data models - RDF and Property Graphs.

Published in: Internet, Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,859
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
36
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • &amp;lt;number&amp;gt;
  • Transcript of "Graph Data -- RDF and Property Graphs"

    1. 1. Graph Data Linked Data and Property Graphs
    2. 2. Contents ● Example ● LD/RDF ● PG ● SPARQL ● Gremlin/Cypher ● BIG data – Apache Giraph / Bulk Synchronous Processing ● Ideally? – +arrays+URIs+attributes
    3. 3. Graphs ● A set of vertices (nodes) and edges (arcs) ● Except the useful kind have labels on edges ● … and the nodes are just dots.
    4. 4. Graphs G = ( V , E ) V – Vertexes (Nodes) E – Edges (Arcs, Links)
    5. 5. Graphs
    6. 6. Graphs For Information Alice Bob Eve listensTo knows
    7. 7. Graphs For Information Alice ... has a name “Alice Hacker” ... has an employee number
    8. 8. Linked Data / RDF ● Standards – What it means – Syntaxes for exchanging data – Query language ● URI name things globally ● Uniform representation – Link to another thing is same as link to a value ● Complex structures encoded in the basic mechanism ● “Schemaless” data integration
    9. 9. Linked Data ★ make your stuff available on the Web (whatever format) under an open license ★★ make it available as structured data (e.g., Excel instead of image scan of a table) ★★★ use non-proprietary formats (e.g., CSV instead of Excel) ★★★★ use URIs to denote things, so that people can point at your stuff ★★★★★ link your data to other data to provide context http://5stardata.info/
    10. 10. Linked Data / RDF http://example/alice "Alice Hacker" foaf:name http://example/bob foaf:knows prefix person: <http://example/person/> prefix foaf: <http://xmlns.com/foaf/0.1/> <http://example/alice> foaf:name "Alice Hacker" ; foaf:knows <http://example/bob> . <http://example/bob> foaf:name "Bob Tester" ; foaf:knows <http://example/alice> . foaf:name Bob Tester foaf:knows
    11. 11. JSON-LD ● Links and semantics for the JSON ecosystem { "@context" : "http://example/person.jsonld", "@graph" : [ { "@id" : "http://example/alice", "knows" : "http://example/bob", "name" : "Alice Hacker" }, { "@id" : "http://example/bob", "knows" : "http://example/alice", "name" : "Bob Tester" } ] }
    12. 12. SPARQL Query prefix person: <http://example/person/> prefix foaf: <http://xmlns.com/foaf/0.1/> <http://example/alice> foaf:name "Alice Hacker" ; foaf:knows <http://example/bob> . <http://example/bob> foaf:name "Bob Tester" ; foaf:knows <http://example/alice> . PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?person foaf:name "Alice Hacker" ; ?person foaf:knows ?name . } ---------------- | name | ================ | "Bob Tester" | ----------------
    13. 13. Property Graphs ● Separates Links and Attributes ● Nodes have attributes – … and so do edges ● Different definitions – https://github.com/tinkerpop/ is the de facto standard – Not universal ● Data exchange (web publishing) is not an objective ● Analysis and schema-less data applications
    14. 14. Build Graph graph = new TinkerGraph(); Vertex a = graph.addVertex("alice"); Vertex b = graph.addVertex("bob"); a.setProperty("name","Alice Hacker"); b.setProperty("name","Bob Coder"); Edge e1 = graph.addEdge("k1", a, b, "knows"); Edge e2 = graph.addEdge("k2", b, a, "knows") ;
    15. 15. GSON { "edges" : [ { "_id" : "k1" , "_inV" : "bob" , "_label" : "knows" , "_outV" : "alice" , "_type" : "edge" } , { "_id" : "k2" , "_inV" : "alice" , "_label" : "knows" , "_outV" : "bob" , "_type" : "edge" } ] , "mode" : "NORMAL" , "vertices" : [ { "_id" : "bob" , "_type" : "vertex" , "name" : "Bob Coder" } , { "_id" : "alice" , "_type" : "vertex" , "name" : "Alice Hacker" }
    16. 16. Gremlin // Groovy to Java @SuppressWarnings("unchecked") Pipe<Vertex,Vertex> pipe = Gremlin.compile("g.v('alice').out('knows').name"); for(Object name : pipe) { System.out.println((String) name); } g.v('alice').out('knows').name
    17. 17. Cypher Query ● Neo4J specific ● Property Graph + “labels” (= types) – node names CREATE (alice { name: 'Alice Hacker'} ) , (bob { name: 'Bob Tester'} ) , (alice) -[:knows]-> (bob) , (bob) -[:knows]-> (alice) MATCH (a)-[:knows]->x WHERE a.name = 'Alice Hacker' RETURN x.name
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×