Aplicatii
Aplicatii
Click New button and select Create project option from the
project window.
Click the edit icon to provide a valid project name.
Start the project by clicking on the Start button in the DBMS list.
Click the Open button to switch to the Neo4j browser window.
CREATE (a:Institution {name:'XYZ College', location: "Kochi"}) RETURN a
MATCH (a {name: 'Vishnu'}) RETURN a
Now, I can create relationship between the nodes as shown in the figure
(fig: person management).
MATCH (n {name: 'Ajith'})-[r:PLAYS]->() DELETE r
Delete a node with property name as Ajith.
To switch to the current database, you should use the following command:
1 :use system
The next step is to add Nodes (entities). If we look at the code shown in the second slide. We
can see that there are two types of commands:
1. Creating Nodes
2. Creating Edges
In the previous code lines, the first line is to add a movie node, and the others are for persons.
From those lines, we can see that the node creation command syntax is:
1 CREATE
2 (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix),
3 (Carrie)-[:ACTED_IN {roles:['Trinity']}]->(TheMatrix),
4 (Laurence)-[:ACTED_IN {roles:['Morpheus']}]->(TheMatrix),
6 (LillyW)-[:DIRECTED]->(TheMatrix),
7 (LanaW)-[:DIRECTED]->(TheMatrix),
8 (JoelS)-[:PRODUCED]->(TheMatrix)
From those lines, we can see that the node creation command syntax is:
After running this command we the created graph will be visualized as shown below:
Querying graphs
The rest of the Movie database tutorial contains different examples of data retrieval operations
using GraphQL. Note that the MATCH command is used to query data. As an example, to get
all movies that Tom Hanks acted in:
2 RETURN tom,tomHanksMovies