Dgraph DQL Tour

Basic

Hello World

Note

For the following queries to run, you should have loaded data in the introduction.

Let’s have a look at a hello world query in DQL.

Every query has a name, and the result is labeled with the same name.

The search criteria func: ... matches nodes. Function eq does what you’d expect, matching nodes with a name equalling “Michael”. The result is the matched nodes and listed outgoing edges from those nodes.

Dgraph identifies each node with a unique internal id, its UID. A UID is not an edge, but can it be returned in a query with uid. If you already know a node’s UID, it can be retrieved with func: uid(<uid-number>).

Something to try : Change the query to select someone else. You can check the sample data again.

The tutorial will handle the running of the query for you, so just focus on the query text. You can also learn about posting queries or programming with Dgraph.

2.1 Hello World