标签:
--1-- 注释:()为Node,ee为变量,Person为Label,{}为Property列表。 CREATE (ee:Person{name:”Emil”,from:”Sweden”,kclout:99}) --2-- 注释:MATCH为匹配,WHERE为条件,RETURN为返回。 MATCH (ee:Person) WHERE ee.name=“Emil” RETURN ee; --3-- 注释:-[:]->为Relationship的方向,KNOWS为Relationship的名字,{}为Property列表。 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) --4-- 注释:-[:]-为Relationship双向。 MATCH (ee:Person)-[:KNOWS]-(friends) WHERE ee.name="Emil" RETURN ee,friends --5-- 注释:()为忽略Node,DISTINCT防止more than one path matching。 MATCH (js:Person)-[:KNOWS]-()-[:KNOWS]-(surfer) WHERE js.name = "Johan" AND surfer.hobby = "surfing" RETURN DISTINCT surfer
标签:
原文地址:http://www.cnblogs.com/qushan/p/4774814.html