----Install neo4j----Install Oracle JDK 7, download neo4j-community, enter bin/neo4j start, open http://localhost:7474, and enter neo4j Browser. ----first knowledge of neo4j----
- neo4j Browser is a web-based shell environment that you can apply cypher to interact with graph database.
- Neo4j Browser is composed of editor, Stream and sidebar,editor for input, change behavior Shift&enter, execute as Ctrl&enter,stream for output, consisting of a result frame,Sidebar for Functional panels (function panel), providing configuration, templates, and help.
- There are three useful cypher instructions,: Help to assist,: history to view a list of histories,: Clear to empty the stream.
- Graph Database contains three concepts of node,relationship(relationship) and Property (attribute), in addition to a the concept of a label (label).
- Cypheris Neo4j's graph query Language, which provides sql-like clause, here is an example of friends:
--Note: () Node,ee is a variable, person is label,{} is the property list. CREATE(ee:person{name: "Emil", from: "Sweden", Kclout: About})--2--Note: Match matches, where is conditional, return is returned. MATCH (Ee:person)WHEREEe.name="Emil"RETURNee;--3--Comment:-[:]-> is the direction of relationship, knows is the name of relationship, {} is the property list. 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--Note:-[:]-is relationship bidirectional. MATCH (Ee:person)-[: KNOWS]-(Friends)WHEREEe.name="Emil"RETURNEe,friends--5--Note: () to ignore node,distinct to prevent more than one path matching. MATCH (Js:person)-[: KNOWS]-()-[: KNOWS]-(surfer)WHEREJs.name="Johan" andSurfer.hobby="Surfing"RETURN DISTINCTSurfer
----NEO4J Manual----
NEO4J Study Notes