forked from neo4j-contrib/neo4j-guides
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote.html
143 lines (143 loc) · 6.41 KB
/
remote.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<article class="guide">
<script>alert('hello')</script>
<carousel class="deck container-fluid">
<slide class="row-fluid">
<div class="col-sm-3">
<h3 ng-click="alert('hello')">REMOTE Cypher</h3>
<p ng-show="false" class="lead">Neo4j's graph query language</p>
</div>
<div class="col-sm-9">
<p data-ng-show="false">Neo4j's Cypher language is purpose built for working with graph data.</p>
<ul class="big">
<li x-ng-show="false">uses patterns to describe graph data</li>
<li ng:show="false">familiar SQL-like clauses</li>
<li data-ng_show="false">declarative, describing what to find, not how to find it</li>
<li ng_show="false">declarative, describing what to find, not how to find it 2</li>
<li data_ng_show="false">declarative, describing what to find, not how to find it 2</li>
</ul>
</div>
</slide>
<slide class="row-fluid">
<div class="col-sm-3">
<h3>CREATE</h3>
<p class="lead">Create a node</p>
</div>
<div class="col-sm-9">
<p onclick="alert(1)">Let's use Cypher to generate a small social graph.</p>
<figure>
<pre mode="cypher" class="pre-scrollable code runnable">CREATE (ee:Person { name: "Emil", from: "Sweden", klout: 99 })</pre>
</figure>
<ul>
<li><code>CREATE</code> clause to create data</li>
<li><code>()</code> parenthesis to indicate a node</li>
<li><code>ee:Person</code> a variable 'ee' and label 'Person' for the new node</li>
<li><code>{}</code> brackets to add properties to the node</li>
</ul>
</div>
</slide>
<slide class="row-fluid">
<div class="col-sm-3">
<h3>MATCH</h3>
<p class="lead">Finding nodes</p>
</div>
<div class="col-sm-9">
<p>Now find the node representing Emil:</p>
<figure>
<pre mode="cypher" class="pre-scrollable code runnable">MATCH (ee:Person) WHERE ee.name = "Emil" RETURN ee;</pre>
</figure>
<ul>
<li><code>MATCH</code> clause to specify a pattern of nodes and relationships</li>
<li><code>(ee:Person)</code> a single node pattern with label 'Person' which will assign matches to the variable 'ee'</li>
<li><code>WHERE</code> clause to constrain the results</li>
<li><code>ee.name = "Emil"</code> compares name property to the value "Emil"</li>
<li><code>RETURN</code> clause used to request particular results</li>
</ul>
</div>
</slide>
<slide class="row-fluid">
<div class="col-sm-3">
<h3>CREATE more</h3>
<p class="lead">Nodes and relationships</p>
</div>
<div class="col-sm-9">
<p><code>CREATE</code>clauses can create many nodes and relationships at once.</p>
<figure>
<pre mode="cypher" class="pre-scrollable code runnable">MATCH (ee:Person) WHERE ee.name = "Emil"
CREATE (js:Person { name: "Johan", from: "Sweden", learn: "surfing" }),
(ir:Person { name: "Ian", from: "England", title: "author" }),
(rvb:Person { name: "Rik", from: "Belgium", pet: "Orval" }),
(ally:Person { name: "Allison", from: "California", hobby: "surfing" }),
(ee)-[:KNOWS {since: 2001}]->(js),(ee)-[:KNOWS {rating: 5}]->(ir),
(js)-[:KNOWS]->(ir),(js)-[:KNOWS]->(rvb),
(ir)-[:KNOWS]->(js),(ir)-[:KNOWS]->(ally),
(rvb)-[:KNOWS]->(ally)</pre>
</figure>
</div>
</slide>
<slide class="row-fluid">
<div class="col-sm-3">
<h3>Pattern matching</h3>
<p class="lead">Describe what to find in the graph</p>
</div>
<div class="col-sm-9">
<p class="summary">For instance, a pattern can be used to find Emil's friends:</p>
<figure>
<pre mode="cypher" class="pre-scrollable code runnable">MATCH (ee:Person)-[:KNOWS]-(friends)
WHERE ee.name = "Emil" RETURN ee, friends</pre>
</figure>
<ul>
<li><code>MATCH</code>clause to describe the pattern from known Nodes to found Nodes</li>
<li><code>(ee)</code>starts the pattern with a Person (qualified by WHERE)</li>
<li><code>-[:KNOWS]-</code>matches "KNOWS" relationships (in either direction)</li>
<li><code>(friends)</code>will be bound to Emil's friends</li>
</ul>
</div>
</slide>
<slide class="row-fluid">
<div class="col-sm-3">
<h3>Recommend</h3>
<p class="lead">Using patterns</p>
</div>
<div class="col-sm-9">
<p class="summary">
Pattern matching can be used to make recommendations. Johan is learning to surf, so he may want to find
a new friend who already does:
</p>
<figure>
<pre mode="cypher" class="pre-scrollable code runnable">MATCH (js:Person)-[:KNOWS]-()-[:KNOWS]-(surfer)
WHERE js.name = "Johan" AND surfer.hobby = "surfing"
RETURN DISTINCT surfer</pre>
</figure>
<ul>
<li><code>()</code>empty parenthesis to ignore these nodes</li>
<li><code>DISTINCT</code>because more than one path will match the pattern</li>
<li><code>surfer</code>will contain Allison, a friend of a friend who surfs</li>
</ul>
</div>
</slide>
<slide class="row-fluid">
<div class="col-sm-4">
<h3>Next steps</h3>
<p>
Start your application using Cypher to create and query graph data. Use the REST API
to monitor the database. In special cases, consider a plugin.
</p>
</div>
<div class="col-sm-4">
<h3>Keep getting started</h3>
<ul class="undecorated">
<li><a play-topic="intro">Intro</a> - a guided tour</li>
<li><a play-topic="https://oskarhane-dropshare-eu.s3-eu-central-1.amazonaws.com/remote-pwgAB8d32V/remote.html">Intro</a> - a guided tour</li>
<li><a play-topic="concepts">Concepts</a> - GraphDB 101</li>
<li><a href="http://neo4j.com/docs/{{neo4j.version | neo4jdoc}}/cypher-query-lang.html">Neo4j Manual</a> - section about Cypher</li>
</ul>
</div>
<div class="col-sm-4">
<h3>Jump into code</h3>
<ul class="undecorated">
<li><a play-topic="movie-graph">The Movie Graph</a></li>
</ul>
</div>
</slide>
</carousel>
</article>