Predicate Functions in Dgraph


Since I’m completely new in Dgraph, I was wondering if there’s any equivalent for Neo4j’s “Predicate Function” in Dgraph ? We are thinking of moving from Neo4j to Dgraph & thus, we need something like “Neo4j’s Predicates” to rewrite some of the queries. I know that the term “Predicate” has a completely different meaning in Dgraph, so basically what I mean is having a functions (like ALL, ANY) to evaluate a condition & return a boolean value. Say, for every node in a path check if a condition (like having/not having a relation between the target node in the path to a set of other nodes (outside the path)) is true.


I don’t think we have a very precisely similar func to Neo4j’s one.

For the " all()". I think using cascade directive would fit.

For " any()" I think Dgraph queries are default like that.

Not sure about " exists(), none(), single()".

The main point is, Dgraph doesn’t have null or nullable. So some funcs like those won’t happen in Dgraph.

We can have a similar query to this

MATCH p =(a)-[*1..3]->(b)
WHERE = 'Alice' AND = 'Daniel' AND ALL (x IN nodes(p) WHERE x.age > 30)

But the return would be very different. And the params also would be very different. For example, we don’t have anything similar to the param [*1..3]. But we could use “has()” func to do it.

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