greskell
greskell copied to clipboard
Question on 'where' clause with incoming edges
Hi,
Thanks for making greskell available! I really enjoy using the DSL, and I appreciate the addition of Data.Greskell.GTraversal.Gen—it’s made working with it much more pleasant.
I’m currently struggling with replicating a where condition to test if a vertex has an incoming edge with a specific label. Here's the query I’m trying to translate:
g.V().has("person", "person_id", personId)
.out("lives")
.in("within")
.where(inE("about"))
.group()...
The full query can be found in this example:
Graph Databases in Action – Chapter 8 Example
What’s the best way to write this in greskell?
Thanks!
Hi! Here is the incomplete translation to greskell.
example :: GTraversal Transform () AVertex
example = source "g" & sV [] &. gHasLabel "person" &. gHas2 "person_id" personId
&. gOut ["lives"]
&. gIn ["within"]
&. gFilter (gInE ["about"])
Note:
- You might need some type annotations (to resolve type ambiguity) and
liftWalkcalls (to match the walk type). - greskell doesn't support
.has(label, key, value)step yet. It's equivalent to.hasLabel(label).has(key, value). - greskell doesn't support
.where(traversal)step yet. I think it's equivalent to.filter(traversal). - greskell doesn't support
.groupstep yet. For now, you need to useunsafeWalkto write it in greskell.