gRPC API
OWLGraph supports gRPC connections on port 9080 (configurable) for high-performance client access.
Connection
Section titled “Connection”import "github.com/dgraph-io/dgo/v250"import "google.golang.org/grpc"
conn, err := grpc.Dial("localhost:9080", grpc.WithInsecure())client := dgo.NewDgraphClient(api.NewDgraphClient(conn))Transactions
Section titled “Transactions”gRPC supports full ACID transactions:
txn := client.NewTxn()defer txn.Discard(ctx)
// Queryresp, err := txn.Query(ctx, `{ q(func: type(Dog)) { name } }`)
// Mutatemu := &api.Mutation{ SetJson: []byte(`{"dgraph.type": "Dog", "name": "Rex"}`),}resp, err = txn.Mutate(ctx, mu)
// Commiterr = txn.Commit(ctx)When to Use gRPC vs HTTP
Section titled “When to Use gRPC vs HTTP”| Feature | gRPC (9080) | HTTP (8080) |
|---|---|---|
| Transactions | Full ACID | CommitNow only |
| Performance | Lower latency | Slightly higher overhead |
| Streaming | Supported | Not supported |
| Language support | Go, Java, Python, JS | Any HTTP client |
| Ontology management | Not supported | /ontology endpoint |
Use gRPC when you need transactions or maximum performance. Use HTTP for ontology management, quick queries, and when simplicity matters.
Client Libraries
Section titled “Client Libraries”- Go:
github.com/dgraph-io/dgo(official) - Java:
io.dgraph:dgraph4j(official) - Python:
pydgraph(official) - JavaScript:
dgraph-js(official)
All existing Dgraph client libraries work with OWLGraph. The OWL reasoning layer is transparent to clients — materialization happens server-side.