How can I use dgraph as a time-series based graph database?

So a common way make time-series based graph data is to put the timestamp info in the “edge” between “nodes.”

For example, this is quite easy to do with neo4j and its easy to make time-series based queries via cyphersql (ie, return all nodes that have edges with timestamp between a min and max. )

How can I do the same thing with dgraph ?

As far as I can tell, an “edge” is a predicate in dgraph, and a “node” is a schema in dgraph.

So, this means i should put a timestamp in the predicate (?)

I see…looks like I can use “facets” via 0.74.

Hi,

Yes you can have facets on edges and model your time series exactly as you say. Dgraph admits lots of searching power over facets see here https://docs.dgraph.io/query-language/#facets-edge-attributes.

If you want to learn more about the query language, the best place to start is https://tour.dgraph.io - though it doesn’t include facets yet, but it will teach you how to use the query language in a way you can apply to facets.

Dgraph is currently at 0.7.7 release.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.