pkb contents > neo4j | just under 281 words | updated 06/08/2017
The editor accepts input:
:help
ctrl+enter
shift+enter
The stream displays output:
:clear
:play sysinfo
This makes a node named "ee" with label "Person" and attributes "name", "from", and "klout":
CREATE (ee:Person { name: "Emil", from: "Sweden", klout: 99 })
This makes two nodes with different names, the same label ("Person"), and differing attributes:
CREATE (js:Person { name: "Johan", from: "Sweden", learn: "surfing" }),
(ir:Person { name: "Ian", from: "England", title: "author" })
CREATE (node_name)-[:RELATIONSHIP_NAME {relationship_attribute: value}] -> (node_name)
CREATE (ee)-[:KNOWS {since: 2001}]->(js), (ee)-[:KNOWS {rating: 5}]->(ir)
Find a nodel labeled "Person" and named "Emil":
MATCH (ee:Person) WHERE ee.name = "Emil" RETURN ee;
Find all Emil's friends by:
MATCH (ee:Person)-[:KNOWS]-(friends) WHERE ee.name = "Emil" RETURN ee, friends
Recommend a similar friend of friend by:
MATCH (js:Person)-[:KNOWS]-()-[:KNOWS]-(surfer)
WHERE js.name = "Johan" AND surfer.hobby = "surfing"
RETURN DISTINCT surfer
PROFILE MATCH ...
EXPLAIN MATCH ...
Delete everything:
MATCH (n)
DETACH DELETE n