Dgraph Model

Learn about the mutations, schema, and queries in the Dgraph data model.

Dgraph vs. RDF

The Dgraph data model is a little curious. Superficially, it resembles RDF in that nodes connect to both nodes and literal values via edges. But critically, it does away with a key feature of RDF—external IDs. This is the very feature that allows for web-scale data integration. As such, it corresponds to an RDF that uses blank nodes.

Dgraph uses an RDF-like N-Triples syntax for data mutations. Note that this is not strict RDF as properties are typically expressed using local names, whereas RDF requires properties to be identified using absolute URI names. Be warned that this RDF mutation format will not validate with an RDF parser. It does, however, provide a simple means of expressing edges.

Mutation

In order to update data in Dgraph or to add new data, we need to perform a mutation. Dgraph has two mutation formats—RDF and JSON. We’ll show the RDF format here because it’s more compact.

Get hands-on with 1400+ tech skills courses.