My Introduction

Hey Everyone,

My name is Brandon W. I am a Founder, self-professed Dgraph noob, and lifelong learner.

I have a number of great user stories grounded in Dgraph and I have (attempted to) drink from the firehose that is Dgraph official and GitHub documentation. When it comes to implementation of nodes, I still have a few questions (that may prove basic…). My goal, ultimately, is to better understand Dgraph and learn how it can be implemented as a solution.

  • What tools exist to directly implement an HTTP (Maybe REST) API/HTTP Function?Ideally to interact directly with Dgraph – response time is critical
  • Is there a mechanism to copy a node? (Maybe a Mutation?)
  • Does Dgraph implement any tenets of object-oriented programming?
  • What mechanisms are there to implement function/method-like functionality within Dgraph?

Thank you for your guidance in advance!

1 Like

Dgraph has an HTTP endpoint that you can send operations.
Also, you can take a look at dgraph-js-http implementation GitHub - dgraph-io/dgraph-js-http: A JavaScript HTTP client for Dgraph

Yes, You can do use upsert block (in latest release, or master - it is a bit new) see this PR Fix bug, aggregate value var works with blank node in upsert by mangalaman93 · Pull Request #4767 · dgraph-io/dgraph · GitHub

Basically is something like this

upsert {
  query {
    v as var(func: has(age)) {
      a1 as age #You have to copy predicate by predicate

   me() {
      a as sum(val(a1))

  mutation {
    # we copy the values from the old predicate and add to the new node
    set {
      _:newNode <other> val(a) .

    # and optionally we delete the old predicate
    delete {
      uid(v) <age> * .

Check this docs

In the query language? I don’t think so.

If you are talking about the query language, there’s non. You can’t create your own methods or something. But with GraphQL you can do something like this.