Dgraph DQL Tour

Schema

Adding Data - mutating data

Now that the schema has been updated we can add data as triples.

Dgraph creates its own internal id’s for nodes, but we need some way to refer to the same node many times in our input data. That’s what _:company1 does.

Technically, these are ‘blank nodes’. They tell Dgraph to create a node, give it an internal id and make sure it’s used consistently.

After the upload, the label _:company1 doesn’t exist in Dgraph and we can’t query for it. You’ll see in the result that Dgraph has replaced it with an internal id. You can query for this internal id — remember func: uid(<uid_number>).

Making changes to the graph stored in Dgraph is called mutating the data.

You can load the same example data using JSON format. You’re able to do that through our clients, cURL or Ratel UI.

See the JSON:

Tip

The JSON example may end up helping you better understand the format in RDF.

3.2 Adding Data - mutating data