DEV Community

Cover image for About graph databases
Anja
Anja

Posted on

2

About graph databases

Hi, lets talk about graph databases.😊 A graph database is composed of two elements: nodes (vertices) and relationships (edges). A node is comparable to an entity in relational databases, the relationships connect the nodes. Properties are similar to attributes of a relational database, they are key-value pairs that can be stored on both nodes and relationships.

You can add labels to the nodes and relationships to specify their type. The data model of graph databases is called the labeled property graph model. Cypher is the query language for graphs. Here is an example for creating two nodes with a relationship:

CREATE (ee:Person { name: "Emil", from: "Sweden"})–[:WORKS_FOR]->(:Company {name: ”Google”})

It is a CREATE clause to create data.

  • () parenthesis to indicate a node
  • ee:Person: a variable 'ee' and label 'Person' for the new node
  • {} brackets to add properties to the node
  • [:WORKS_FOR]β†’ specifies the relationship to the Company node.

If you now want to retrieve these nodes with their relationship write:

MATCH (ee:Person{name:’Emil’}) –[:WORKS_FOR]->(m) RETURN *;

Neo4J is the most popular graph database managament system at the moment. On their website you can use a sandbox with predefined datasets to play around, on the picture I queried the β€œCrime Investigation Dataset”. :) They also have a lot of info for beginners, find the link at the end.

What do you know about graph databases? Have a nice evening! :)
Reference: www.neo4j.com

πŸ’‘ One last tip before you go

Tired of spending so much on your side projects? πŸ€”

We have created a membership program that helps cap your costs so you can build and experiment for less. And we currently have early-bird pricing which makes it an even better value! πŸ₯

Check out DEV++

Top comments (0)

Image of Bright Data

Feed Your Models Real-Time Data – Enhance your AI with up-to-the-minute data.

Utilize our live data feeds for dynamic model training, ensuring your AI systems are always ahead.

Access Real-Time Data

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay