{"id":336035,"date":"2022-07-22T15:00:25","date_gmt":"2022-07-22T15:00:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336035"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336035","title":{"rendered":"<span>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a Neo4j<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0430\u044f \u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 Neo4j. \u041f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442: <a href=\"https:\/\/habr.com\/ru\/post\/677296\/\" rel=\"noopener noreferrer nofollow\">https:\/\/habr.com\/ru\/post\/677296\/<\/a><\/p>\n<p>\u0421\u0443\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u0432 Neo4j.<\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 <a href=\"https:\/\/neo4j.com\/download\/\" rel=\"noopener noreferrer nofollow\">\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e Neo4j \u0441 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 Movie DBMS.<\/p>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h2>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a Neo4j \u043f\u043e CRUD.<\/p>\n<h3>\u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043d\u0430\u0434\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>Nodes \u2014 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438;<\/p>\n<\/li>\n<li>\n<p>Labels \u2014 \u043c\u0435\u0442\u043a\u0438 \u043a \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c;<\/p>\n<\/li>\n<li>\n<p>Relationships \u2014 \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>Properties \u2014 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u043b\u0438 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>(&lt;var>:&lt;entity> [{&lt;property>: &lt;value>[, ...]}])&lt;direction>[:&lt;relationship>]&lt;direction>(&lt;var>:&lt;entity>[{&lt;property>: &lt;value>[, ...]}])<\/code><\/pre>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d, \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435 \ud83d\ude42<\/p>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043d\u0430\u0448\u0443 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u0438\u043b\u044c\u043c\u0430\u043c\u0438 \u0438 \u0430\u043a\u0442\u0435\u0440\u0430\u043c\u0438, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043d\u0435\u0439<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a33\/865\/853\/a338658533c0d4205f60754af51aa693.png\" width=\"437\" height=\"181\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a33\/865\/853\/a338658533c0d4205f60754af51aa693.png\"\/><figcaption><\/figcaption><\/figure>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u043c\u044b MATCH (m:Movie) RETURN m<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>MATCH<\/code> (\u0442\u043e\u0447\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f <code>SELECT<\/code> \u0438\u0437 RDBMS).<\/p>\n<p><code>m:Movie<\/code> \u2014 \u0442\u0443\u0442 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>m<\/code> \u0432\u0441\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 Movies \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c.<\/p>\n<p><code>RETURN p<\/code> \u2014 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c <em>\u0447\u0442\u043e<\/em> \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432:<\/p>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435\u0445 \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c Tom Hanks: MATCH (p:Person {name: 'Tom Hanks'}) RETURN p<\/code><\/pre>\n<p><code>{name: 'Tom Hanks'}<\/code> \u2014 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Person<\/p>\n<p>\u041d\u043e, \u0433\u0440\u0430\u0444\u043e\u0432\u0430\u044f \u0411\u0414 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0431\u044b \u0442\u0430\u043a\u043e\u0432\u043e\u0439, \u0435\u0441\u043b\u0438 \u0431\u044b \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0431\u044b\u043b\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438: \u0441\u0432\u044f\u0437\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0433\u0440\u0430\u043b Tom Hanks:<\/p>\n<pre><code>MATCH (p:Person {name: 'Tom Hanks'})-->(m) RETURN m.title<\/code><\/pre>\n<p><code>m<\/code> \u2014 \u0442\u0443\u0442 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>m<\/code> \u0432\u0441\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c.<\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \ud83d\ude42 \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c \u0432\u0441\u0435 \u0435\u0433\u043e \u0441\u0432\u044f\u0437\u0438 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u043e \u0432\u0441\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u044b\u0435 \u0431\u0443\u0434\u0443\u0442. \u041d\u0430\u043c \u044d\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d \u0438\u0433\u0440\u0430\u043b. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0438\u043f \u0441\u0432\u044f\u0437\u0438 <code>ACTED_IN<\/code>:<\/p>\n<pre><code>MATCH (p:Person {name: 'Tom Hanks'})-[:ACTED_IN]->(m) RETURN m.title<\/code><\/pre>\n<p>\u0423\u0436\u0435 \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0442\u043e\u0436\u0435 \u043d\u0435\u0442\u043e\u0447\u043d\u043e. \u042d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0435\u0440\u043d\u0435\u0442 <em>\u0432\u0441\u0435<\/em> \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d \u0438\u0433\u0440\u0430\u043b, \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043b\u044c\u043c\u044b. \u041e\u043d \u0436\u0435 \u043c\u043e\u0433 \u0438\u0433\u0440\u0430\u0442\u044c \u0438 \u0432 \u0442\u0435\u0430\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\u0445, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e?<\/p>\n<p>\u042d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u043c\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 <em>traverse<\/em>, \u0435\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 Neo4j.<\/p>\n<p>\u041d\u043e\u0434\u0430, \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u043e\u0434\u043e\u0439 (\u0434\u0430\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u0434\u0440\u0443\u0433\u0438\u0435 N \u043d\u043e\u0434), \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u2014 <em>traversable<\/em>-\u043d\u043e\u0434\u0430.<\/p>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0445\u0435\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e Movies. \u041d\u043e \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043a\u043e\u043f\u0438\u0442\u044c \u0442\u0435\u0445\u0434\u043e\u043b\u0433, \u0430 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043b\u044c\u043c\u044b:<\/p>\n<pre><code>MATCH (p:Person {name: 'Tom Hanks'})-[:ACTED_IN]->(m:Movie) RETURN m.title<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u043e!<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432:<\/p>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0438\u0437 \"\u041c\u0430\u0442\u0440\u0438\u0446\u044b\" MATCH (m:Movie {title: 'The Matrix'})&lt;-[:ACTED_IN]-(p:Person) RETURN p  \/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435\u0445 \u0440\u0435\u0436\u0438\u0441\u0441\u0435\u0440\u043e\u0432, \u0440\u043e\u0434\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0434\u043e 1970 \u0433\u043e\u0434\u0430 \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043d\u0430\u043c \u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u0427\u0422\u041e \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u0440\u0435\u0436\u0438\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \/\/ \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0438\u043f \u043d\u043e\u0434\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c: MATCH (p:Person)-[:DIRECTED]->() WHERE p.born &lt; 1970 RETURN p<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u0438:<\/p>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 Tom Hanks \/\/ \u0431\u044b\u043b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0430\u043a\u0442\u0435\u0440\u043e\u043c \u0418\u041b\u0418 \u0440\u0435\u0436\u0438\u0441\u0441\u0435\u043e\u0440\u043e\u043c: MATCH (m:Movie)&lt;-[:ACTED_IN|:DIRECTED]-(p:Person {name: 'Tom Hanks'}) RETURN m.title, p.name<\/code><\/pre>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>WHERE<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 \u0442\u0430\u043a-\u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 RDBMS, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u043d\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0432\u044f\u0437\u0435\u0439:<\/p>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435\u0445 \u0430\u043a\u0442\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0433\u0440\u0430\u043b\u0438 \u0432 \u0444\u0438\u043b\u044c\u043c\u0430\u0445, \/\/ \u043d\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u0441\u0441\u0435\u0440\u043e\u043c \u0444\u0438\u043b\u044c\u043c\u0430: MATCH (p:Person)-[:ACTED_IN]->(m:Movie) WHERE NOT exists( (p)-[:DIRECTED]->(m) ) RETURN p.name, m.title  \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0443 \u0441\u0432\u044f\u0437\u0438: \/\/ \u043d\u0430\u0439\u0442\u0438 \u0438\u043c\u044f \u0430\u043a\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0433\u0440\u0430\u043b \u041d\u0435\u043e \u0432 \u041c\u0430\u0442\u0440\u0438\u0446\u0435 MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE  'Neo' IN r.roles AND m.title='The Matrix' RETURN p.name, r.roles <\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Neo4j \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e <code>MERGE<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 <code>CREATE<\/code> \u0438\u043b\u0438 <code>INSERT<\/code> \u0438\u0437 RDBMS.<\/p>\n<p>\u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e <code>MERGE<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 <em>\u043f\u0430\u0442\u0442\u0435\u0440\u043d<\/em> \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0441\u0440\u0430\u0437\u0443 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438:<\/p>\n<pre><code>\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0434\u0443 Person \u0441 \u0438\u043c\u0435\u043d\u0435\u043c Michael Cain MERGE (p:Person {name: 'Michael Cain'})  \/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0435 \u043d\u043e\u0434\u044b (\u0434\u0430, \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438) MERGE (p:Person {name: 'Katie Holmes'}) MERGE (m:Movie {title: 'The Dark Knight'}) RETURN p, m<\/code><\/pre>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435: \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>CREATE<\/code> \u0441 \u0442\u043e\u0439 \u043b\u0438\u0448\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0435\u0439, \u0447\u0442\u043e <code>CREATE<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0443\u0436\u0435 \u0442\u0430\u043a\u0430\u044f \u043d\u043e\u0434\u0430 \u0432 \u0411\u0414 \u2014 \u044d\u0442\u043e \u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438. <code>CREATE<\/code> \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0434\u0430\u043c\u043f\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0445 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u0439 \u0431\u0430\u0437\u0435. <code>MERGE<\/code> \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043e\u043b\u0435\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u2014 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0432\u0441\u0435\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u043d\u043e \u0438 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0447\u0435\u0440\u0435\u0437 <code>MERGE<\/code>:<\/p>\n<pre><code>MATCH (p:Person {name: 'Michael Cain'}) MATCH (m:Movie {title: 'The Dark Knight'}) MERGE (p)-[:ACTED_IN]->(m)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1bf\/1d2\/a98\/1bf1d2a98c31d265b1f6166d43bfb852.png\" width=\"2400\" height=\"842\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1bf\/1d2\/a98\/1bf1d2a98c31d265b1f6166d43bfb852.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 <code>MATCH<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0439\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0438, \u0430 <code>MERGE<\/code> \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b, \u0442\u043e \u0441\u0432\u044f\u0437\u044c \u0438 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f. \u0414\u043b\u044f \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0441\u0432\u044f\u0437\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>MERGE<\/code> \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code>MERGE (p:Person {name: 'Michael Cain'}) MERGE (m:Movie {title: 'The Dark Knight'}) MERGE (p)-[:ACTED_IN]->(m)  \/\/ \u0438\u043b\u0438 \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443: MERGE (p:Person {name: 'Michael Cain'})-[:ACTED_IN]->(m:Movie {title: 'The Dark Knight'}) RETURN p, m<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/90b\/bb8\/106\/90bbb81060c6faeace6512023142d2b5.png\" width=\"2404\" height=\"840\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/90b\/bb8\/106\/90bbb81060c6faeace6512023142d2b5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e \u0442\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043b\u043e\u0433\u0438\u043a\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<ol>\n<li>\n<p>Neo4j \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c <code>Person<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c Michael Cain;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u0442\u043e Neo4j \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0432\u0441\u0435 \u0435\u0435 \u0441\u0432\u044f\u0437\u0438 <code>ACTED_IN<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u0440\u0435\u0434\u0438 \u044d\u0442\u0438\u0445 \u0441\u0432\u044f\u0437\u0435\u0439 Neo4j \u0438\u0449\u0435\u0442 <code>Movie<\/code> \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c The Dark Knight.<\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u044f-\u0431\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u044d\u0442\u0438\u0445 \u044d\u0442\u0430\u043f\u043e\u0432 \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d <strong>\u0432\u0435\u0441\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d<\/strong>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0434\u0430\u0436\u0435 \u0444\u0438\u043b\u044c\u043c The Dark Knight \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0430 \u0430\u043a\u0442\u0435\u0440 Michael Cain \u043d\u0435\u0442,  \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u043e\u0432\u044b\u0439 \u0444\u0438\u043b\u044c\u043c \u0441 \u0442\u0430\u043a\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u043e:<\/p>\n<pre><code>\/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0440\u0438\u0436\u0434\u044b \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0432 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442-\u0436\u0435 \u0444\u0438\u043b\u044c\u043c MERGE (p:Person {name: 'Yuri Nikulin'})-[:ACTED_IN]->(m:Movie {title: 'The Diamond Arm'}) RETURN p, m  MERGE (p:Person {name: 'Nina Grebeshkova'})-[:ACTED_IN]->(m:Movie {title: 'The Diamond Arm'}) RETURN p, m  MERGE (p:Person {name: 'Andrei Mironov'})-[:ACTED_IN]->(m:Movie {title: 'The Diamond Arm'}) RETURN p, m  \/\/ \u041d\u0430\u0439\u0434\u0435\u043c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u044d\u0442\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0438\u043b\u044c\u043c\u0430 MATCH (m:Movie {title:'The Diamond Arm'})&lt;-[:ACTED_IN]-(p:Person) RETURN m,p<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5de\/808\/b51\/5de808b511c4ef5c90f06a23e532de81.png\" alt=\"\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u044f\u0432\u043d\u043e \u043d\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438\" title=\"\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u044f\u0432\u043d\u043e \u043d\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438\" width=\"2398\" height=\"1104\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5de\/808\/b51\/5de808b511c4ef5c90f06a23e532de81.png\"\/><figcaption>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u044f\u0432\u043d\u043e \u043d\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438<\/figcaption><\/figure>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0438 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u0412\u0441\u0451 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432:<\/p>\n<pre><code>\/\/ \u0412 \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 Oliver Stone \u0438 Rob Reiner \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u0435, \/\/ \u0442\u043e \u0435\u0441\u0442\u044c \u0443 \u043d\u0438\u0445 \u043d\u0435\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0444\u0438\u043b\u044c\u043c\u0430. \/\/ \/\/ \u0412 \u044d\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043c\u044b \u0438\u0449\u0435\u043c \u043e\u0431\u043e\u0438\u0445 \/\/ \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u043c \u0434\u043b\u044f \u043d\u0438\u0445 :)  MATCH   (oliver:Person {name: 'Oliver Stone'}),   (reiner:Person {name: 'Rob Reiner'}) MERGE (oliver)-[:DIRECTED]->(movie:Movie)&lt;-[:ACTED_IN]-(reiner) RETURN movie<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>SET<\/code>:<\/p>\n<pre><code>MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE p.name = 'Michael Cain' AND m.title = 'The Dark Knight' SET r.roles = ['Alfred Penny'], r.year = 2008 RETURN p, r, m<\/code><\/pre>\n<h3>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u042d\u0442\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u0430\u0437\u0434\u0435\u043b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043b\u043e\u043c\u0430\u0442\u044c \u2014 \u043d\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \ud83d\ude42<\/p>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u0442\u0443\u0442 \u2014 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u043e\u0434\u0443, \u043f\u043e\u043a\u0430 \u0443 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044c \u043e\u0434\u043d\u0430 \u0441\u0432\u044f\u0437\u044c.<\/p>\n<p>\u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u043c\u044b \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c The Diamond Arm, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435:<\/p>\n<pre><code>MATCH (p:Person) WHERE p.name = 'Jane Doe' DELETE p<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d72\/597\/17a\/d7259717a84c1500fcb56ed4acd72dbd.png\" alt=\"Oops!\" title=\"Oops!\" width=\"2398\" height=\"706\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d72\/597\/17a\/d7259717a84c1500fcb56ed4acd72dbd.png\"\/><figcaption>Oops!<\/figcaption><\/figure>\n<p>\u041e\u043a\u0435\u0439, \u043d\u0435\u043b\u044c\u0437\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u043e\u043a\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u044f\u0437\u0438. \u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043f\u043e\u0447\u0438\u043d\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u043f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 <code>DETACH DELETE<\/code>. \u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0430\u043a\u043e\u0435 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u043c\u043e\u0432, \u0442\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0438\u0437 \u043d\u0438\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u043e\u0436\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0443\u0434\u0430\u043b\u0438\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0430\u043a\u0442\u0435\u0440\u043e\u0432, \u043f\u043e\u0442\u043e\u043c \u0441\u0430\u043c\u0438 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0444\u0438\u043b\u044c\u043c\u043e\u0432:<\/p>\n<pre><code>\/\/ \u041e\u0442\u0446\u0435\u043f\u0438\u043c (DETACH) \u0438 \u0443\u0434\u0430\u043b\u0438\u043c \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c The Diamond Arm MATCH (m:Movie {title:'The Diamond Arm'})&lt;-[:ACTED_IN]-(p:Person) DETACH DELETE p  \/\/ \u0423\u0434\u0430\u043b\u0438\u043c \u0441\u0430\u043c\u0438 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c The Diamond Arm. \/\/ \u041e\u0442\u0446\u0435\u043f\u043b\u044f\u0442\u044c (DETACH) \u0443\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0442.\u043a. \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e \u0441\u0432\u044f\u0437\u044f\u043c\u0438 \/\/ \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e MATCH (m:Movie {title:'The Diamond Arm'}) DELETE m<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>null<\/code> \u0438\u043b\u0438 \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>REMOVE<\/code>:<\/p>\n<pre><code>\/\/ \u0412\u043e\u0442 \u0442\u0430\u043a MATCH (p:Person) WHERE p.name = 'Gene Hackman' SET p.born = null RETURN p  \/\/ \u0418\u043b\u0438 \u0442\u0430\u043a MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE p.name = 'Michael Cain' AND m.title = 'The Dark Knight' REMOVE r.roles RETURN p, r, m<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u044b\u0448\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0440\u0430\u0444\u043e\u0432\u044b\u043c\u0438 \u0411\u0414 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442 \u0441 SQL, \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0410 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \ud83d\ude09<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/678382\/\"> https:\/\/habr.com\/ru\/post\/678382\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0430\u044f \u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 Neo4j. \u041f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442: <a href=\"https:\/\/habr.com\/ru\/post\/677296\/\" rel=\"noopener noreferrer nofollow\">https:\/\/habr.com\/ru\/post\/677296\/<\/a><\/p>\n<p>\u0421\u0443\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u0432 Neo4j.<\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 <a href=\"https:\/\/neo4j.com\/download\/\" rel=\"noopener noreferrer nofollow\">\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e Neo4j \u0441 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 Movie DBMS.<\/p>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h2>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a Neo4j \u043f\u043e CRUD.<\/p>\n<h3>\u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043d\u0430\u0434\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>Nodes \u2014 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438;<\/p>\n<\/li>\n<li>\n<p>Labels \u2014 \u043c\u0435\u0442\u043a\u0438 \u043a \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c;<\/p>\n<\/li>\n<li>\n<p>Relationships \u2014 \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>Properties \u2014 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u043b\u0438 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>(&lt;var>:&lt;entity> [{&lt;property>: &lt;value>[, ...]}])&lt;direction>[:&lt;relationship>]&lt;direction>(&lt;var>:&lt;entity>[{&lt;property>: &lt;value>[, ...]}])<\/code><\/pre>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d, \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435 \ud83d\ude42<\/p>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043d\u0430\u0448\u0443 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u0438\u043b\u044c\u043c\u0430\u043c\u0438 \u0438 \u0430\u043a\u0442\u0435\u0440\u0430\u043c\u0438, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043d\u0435\u0439<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u043c\u044b MATCH (m:Movie) RETURN m<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>MATCH<\/code> (\u0442\u043e\u0447\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f <code>SELECT<\/code> \u0438\u0437 RDBMS).<\/p>\n<p><code>m:Movie<\/code> \u2014 \u0442\u0443\u0442 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>m<\/code> \u0432\u0441\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 Movies \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c.<\/p>\n<p><code>RETURN p<\/code> \u2014 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c <em>\u0447\u0442\u043e<\/em> \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432:<\/p>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435\u0445 \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c Tom Hanks: MATCH (p:Person {name: 'Tom Hanks'}) RETURN p<\/code><\/pre>\n<p><code>{name: 'Tom Hanks'}<\/code> \u2014 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Person<\/p>\n<p>\u041d\u043e, \u0433\u0440\u0430\u0444\u043e\u0432\u0430\u044f \u0411\u0414 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0431\u044b \u0442\u0430\u043a\u043e\u0432\u043e\u0439, \u0435\u0441\u043b\u0438 \u0431\u044b \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0431\u044b\u043b\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438: \u0441\u0432\u044f\u0437\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0433\u0440\u0430\u043b Tom Hanks:<\/p>\n<pre><code>MATCH (p:Person {name: 'Tom Hanks'})-->(m) RETURN m.title<\/code><\/pre>\n<p><code>m<\/code> \u2014 \u0442\u0443\u0442 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>m<\/code> \u0432\u0441\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c.<\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \ud83d\ude42 \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c \u0432\u0441\u0435 \u0435\u0433\u043e \u0441\u0432\u044f\u0437\u0438 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u043e \u0432\u0441\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u044b\u0435 \u0431\u0443\u0434\u0443\u0442. \u041d\u0430\u043c \u044d\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d \u0438\u0433\u0440\u0430\u043b. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0438\u043f \u0441\u0432\u044f\u0437\u0438 <code>ACTED_IN<\/code>:<\/p>\n<pre><code>MATCH (p:Person {name: 'Tom Hanks'})-[:ACTED_IN]->(m) RETURN m.title<\/code><\/pre>\n<p>\u0423\u0436\u0435 \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u0442\u043e\u0436\u0435 \u043d\u0435\u0442\u043e\u0447\u043d\u043e. \u042d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0435\u0440\u043d\u0435\u0442 <em>\u0432\u0441\u0435<\/em> \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d \u0438\u0433\u0440\u0430\u043b, \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043b\u044c\u043c\u044b. \u041e\u043d \u0436\u0435 \u043c\u043e\u0433 \u0438\u0433\u0440\u0430\u0442\u044c \u0438 \u0432 \u0442\u0435\u0430\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\u0445, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e?<\/p>\n<p>\u042d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u043c\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 <em>traverse<\/em>, \u0435\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 Neo4j.<\/p>\n<p>\u041d\u043e\u0434\u0430, \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u043e\u0434\u043e\u0439 (\u0434\u0430\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u0434\u0440\u0443\u0433\u0438\u0435 N \u043d\u043e\u0434), \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u2014 <em>traversable<\/em>-\u043d\u043e\u0434\u0430.<\/p>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0445\u0435\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e Movies. \u041d\u043e \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043a\u043e\u043f\u0438\u0442\u044c \u0442\u0435\u0445\u0434\u043e\u043b\u0433, \u0430 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0438\u043b\u044c\u043c\u044b:<\/p>\n<pre><code>MATCH (p:Person {name: 'Tom Hanks'})-[:ACTED_IN]->(m:Movie) RETURN m.title<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u043e!<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432:<\/p>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0438\u0437 \"\u041c\u0430\u0442\u0440\u0438\u0446\u044b\" MATCH (m:Movie {title: 'The Matrix'})&lt;-[:ACTED_IN]-(p:Person) RETURN p  \/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435\u0445 \u0440\u0435\u0436\u0438\u0441\u0441\u0435\u0440\u043e\u0432, \u0440\u043e\u0434\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0434\u043e 1970 \u0433\u043e\u0434\u0430 \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043d\u0430\u043c \u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u0427\u0422\u041e \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u0440\u0435\u0436\u0438\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \/\/ \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0438\u043f \u043d\u043e\u0434\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c: MATCH (p:Person)-[:DIRECTED]->() WHERE p.born &lt; 1970 RETURN p<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u0438:<\/p>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 Tom Hanks \/\/ \u0431\u044b\u043b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0430\u043a\u0442\u0435\u0440\u043e\u043c \u0418\u041b\u0418 \u0440\u0435\u0436\u0438\u0441\u0441\u0435\u043e\u0440\u043e\u043c: MATCH (m:Movie)&lt;-[:ACTED_IN|:DIRECTED]-(p:Person {name: 'Tom Hanks'}) RETURN m.title, p.name<\/code><\/pre>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>WHERE<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 \u0442\u0430\u043a-\u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 RDBMS, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u043d\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0432\u044f\u0437\u0435\u0439:<\/p>\n<pre><code>\/\/ \u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435\u0445 \u0430\u043a\u0442\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0433\u0440\u0430\u043b\u0438 \u0432 \u0444\u0438\u043b\u044c\u043c\u0430\u0445, \/\/ \u043d\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u0441\u0441\u0435\u0440\u043e\u043c \u0444\u0438\u043b\u044c\u043c\u0430: MATCH (p:Person)-[:ACTED_IN]->(m:Movie) WHERE NOT exists( (p)-[:DIRECTED]->(m) ) RETURN p.name, m.title  \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0443 \u0441\u0432\u044f\u0437\u0438: \/\/ \u043d\u0430\u0439\u0442\u0438 \u0438\u043c\u044f \u0430\u043a\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0433\u0440\u0430\u043b \u041d\u0435\u043e \u0432 \u041c\u0430\u0442\u0440\u0438\u0446\u0435 MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE  'Neo' IN r.roles AND m.title='The Matrix' RETURN p.name, r.roles <\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Neo4j \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e <code>MERGE<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 <code>CREATE<\/code> \u0438\u043b\u0438 <code>INSERT<\/code> \u0438\u0437 RDBMS.<\/p>\n<p>\u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e <code>MERGE<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 <em>\u043f\u0430\u0442\u0442\u0435\u0440\u043d<\/em> \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0441\u0440\u0430\u0437\u0443 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438:<\/p>\n<pre><code>\/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0434\u0443 Person \u0441 \u0438\u043c\u0435\u043d\u0435\u043c Michael Cain MERGE (p:Person {name: 'Michael Cain'})  \/\/ \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0435 \u043d\u043e\u0434\u044b (\u0434\u0430, \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438) MERGE (p:Person {name: 'Katie Holmes'}) MERGE (m:Movie {title: 'The Dark Knight'}) RETURN p, m<\/code><\/pre>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435: \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>CREATE<\/code> \u0441 \u0442\u043e\u0439 \u043b\u0438\u0448\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0435\u0439, \u0447\u0442\u043e <code>CREATE<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0443\u0436\u0435 \u0442\u0430\u043a\u0430\u044f \u043d\u043e\u0434\u0430 \u0432 \u0411\u0414 \u2014 \u044d\u0442\u043e \u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438. <code>CREATE<\/code> \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0434\u0430\u043c\u043f\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0445 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u0439 \u0431\u0430\u0437\u0435. <code>MERGE<\/code> \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043e\u043b\u0435\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u2014 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0432\u0441\u0435\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u043d\u043e \u0438 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0447\u0435\u0440\u0435\u0437 <code>MERGE<\/code>:<\/p>\n<pre><code>MATCH (p:Person {name: 'Michael Cain'}) MATCH (m:Movie {title: 'The Dark Knight'}) MERGE (p)-[:ACTED_IN]->(m)<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 <code>MATCH<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0439\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0438, \u0430 <code>MERGE<\/code> \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b, \u0442\u043e \u0441\u0432\u044f\u0437\u044c \u0438 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f. \u0414\u043b\u044f \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0441\u0432\u044f\u0437\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>MERGE<\/code> \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code>MERGE (p:Person {name: 'Michael Cain'}) MERGE (m:Movie {title: 'The Dark Knight'}) MERGE (p)-[:ACTED_IN]->(m)  \/\/ \u0438\u043b\u0438 \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443: MERGE (p:Person {name: 'Michael Cain'})-[:ACTED_IN]->(m:Movie {title: 'The Dark Knight'}) RETURN p, m<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e \u0442\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043b\u043e\u0433\u0438\u043a\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<ol>\n<li>\n<p>Neo4j \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c <code>Person<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c Michael Cain;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u0442\u043e Neo4j \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0432\u0441\u0435 \u0435\u0435 \u0441\u0432\u044f\u0437\u0438 <code>ACTED_IN<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u0440\u0435\u0434\u0438 \u044d\u0442\u0438\u0445 \u0441\u0432\u044f\u0437\u0435\u0439 Neo4j \u0438\u0449\u0435\u0442 <code>Movie<\/code> \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c The Dark Knight.<\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u044f-\u0431\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u044d\u0442\u0438\u0445 \u044d\u0442\u0430\u043f\u043e\u0432 \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d <strong>\u0432\u0435\u0441\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d<\/strong>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0434\u0430\u0436\u0435 \u0444\u0438\u043b\u044c\u043c The Dark Knight \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0430 \u0430\u043a\u0442\u0435\u0440 Michael Cain \u043d\u0435\u0442,  \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u043e\u0432\u044b\u0439 \u0444\u0438\u043b\u044c\u043c \u0441 \u0442\u0430\u043a\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u043e:<\/p>\n<pre><code>\/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0440\u0438\u0436\u0434\u044b \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0432 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442-\u0436\u0435 \u0444\u0438\u043b\u044c\u043c MERGE (p:Person {name: 'Yuri Nikulin'})-[:ACTED_IN]->(m:Movie {title: 'The Diamond Arm'}) RETURN p, m  MERGE (p:Person {name: 'Nina Grebeshkova'})-[:ACTED_IN]->(m:Movie {title: 'The Diamond Arm'}) RETURN p, m  MERGE (p:Person {name: 'Andrei Mironov'})-[:ACTED_IN]->(m:Movie {title: 'The Diamond Arm'}) RETURN p, m  \/\/ \u041d\u0430\u0439\u0434\u0435\u043c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u044d\u0442\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0438\u043b\u044c\u043c\u0430 MATCH (m:Movie {title:'The Diamond Arm'})&lt;-[:ACTED_IN]-(p:Person) RETURN m,p<\/code><\/pre>\n<figure class=\"full-width\"><figcaption>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u044f\u0432\u043d\u043e \u043d\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438<\/figcaption><\/figure>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0438 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u0412\u0441\u0451 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432:<\/p>\n<pre><code>\/\/ \u0412 \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 Oliver Stone \u0438 Rob Reiner \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u0435, \/\/ \u0442\u043e \u0435\u0441\u0442\u044c \u0443 \u043d\u0438\u0445 \u043d\u0435\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0444\u0438\u043b\u044c\u043c\u0430. \/\/ \/\/ \u0412 \u044d\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043c\u044b \u0438\u0449\u0435\u043c \u043e\u0431\u043e\u0438\u0445 \/\/ \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0439 \u0444\u0438\u043b\u044c\u043c \u0434\u043b\u044f \u043d\u0438\u0445 :)  MATCH   (oliver:Person {name: 'Oliver Stone'}),   (reiner:Person {name: 'Rob Reiner'}) MERGE (oliver)-[:DIRECTED]->(movie:Movie)&lt;-[:ACTED_IN]-(reiner) RETURN movie<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>SET<\/code>:<\/p>\n<pre><code>MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE p.name = 'Michael Cain' AND m.title = 'The Dark Knight' SET r.roles = ['Alfred Penny'], r.year = 2008 RETURN p, r, m<\/code><\/pre>\n<h3>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u042d\u0442\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u0430\u0437\u0434\u0435\u043b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043b\u043e\u043c\u0430\u0442\u044c \u2014 \u043d\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \ud83d\ude42<\/p>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u0442\u0443\u0442 \u2014 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u043e\u0434\u0443, \u043f\u043e\u043a\u0430 \u0443 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044c \u043e\u0434\u043d\u0430 \u0441\u0432\u044f\u0437\u044c.<\/p>\n<p>\u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u043c\u044b \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c The Diamond Arm, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435:<\/p>\n<pre><code>MATCH (p:Person) WHERE p.name = 'Jane Doe' DELETE p<\/code><\/pre>\n<figure class=\"full-width\"><figcaption>Oops!<\/figcaption><\/figure>\n<p>\u041e\u043a\u0435\u0439, \u043d\u0435\u043b\u044c\u0437\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u043e\u043a\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u044f\u0437\u0438. \u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043f\u043e\u0447\u0438\u043d\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u043f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 <code>DETACH DELETE<\/code>. \u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0430\u043a\u043e\u0435 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u043c\u043e\u0432, \u0442\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0438\u0437 \u043d\u0438\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u043e\u0436\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0443\u0434\u0430\u043b\u0438\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0430\u043a\u0442\u0435\u0440\u043e\u0432, \u043f\u043e\u0442\u043e\u043c \u0441\u0430\u043c\u0438 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0444\u0438\u043b\u044c\u043c\u043e\u0432:<\/p>\n<pre><code>\/\/ \u041e\u0442\u0446\u0435\u043f\u0438\u043c (DETACH) \u0438 \u0443\u0434\u0430\u043b\u0438\u043c \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c The Diamond Arm MATCH (m:Movie {title:'The Diamond Arm'})&lt;-[:ACTED_IN]-(p:Person) DETACH DELETE p  \/\/ \u0423\u0434\u0430\u043b\u0438\u043c \u0441\u0430\u043c\u0438 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0444\u0438\u043b\u044c\u043c\u043e\u0432 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c The Diamond Arm. \/\/ \u041e\u0442\u0446\u0435\u043f\u043b\u044f\u0442\u044c (DETACH) \u0443\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0442.\u043a. \u0430\u043a\u0442\u0435\u0440\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e \u0441\u0432\u044f\u0437\u044f\u043c\u0438 \/\/ \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e MATCH (m:Movie {title:'The Diamond Arm'}) DELETE m<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>null<\/code> \u0438\u043b\u0438 \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>REMOVE<\/code>:<\/p>\n<pre><code>\/\/ \u0412\u043e\u0442 \u0442\u0430\u043a MATCH (p:Person) WHERE p.name = 'Gene Hackman' SET p.born = null RETURN p  \/\/ \u0418\u043b\u0438 \u0442\u0430\u043a MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE p.name = 'Michael Cain' AND m.title = 'The Dark Knight' REMOVE r.roles RETURN p, r, m<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u044b\u0448\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0440\u0430\u0444\u043e\u0432\u044b\u043c\u0438 \u0411\u0414 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442 \u0441 SQL, \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0410 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \ud83d\ude09<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/678382\/\"> https:\/\/habr.com\/ru\/post\/678382\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-336035","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=336035"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336035\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}