【发布时间】:2021-12-28 01:02:00
【问题描述】:
我有一个传统的社交媒体图表,其中用户发布帖子,其他用户评论该帖子,用户可以阻止其他用户。我正在尝试创建一个排除 cmets 的遍历,其中评论用户与发布用户具有 block 边缘(发布用户已阻止评论用户,排除他们的 cmets)。
g.addV("user").as("poster")
.addV("post")
.addV("user").as("commenter")
.addV("comment")
.addE("post").from("poster").to("post")
.addE("comment").from("commenter").to("comment")
.addE("comment").from("comment").to("post")
.addE("block").from("poster").to("commenter")
这是我得到的,但没有编译:
g.V()
.hasLabel("comment")
.as("comment")
.not(
__.in_("comment")
.as("commenter")
.select("comment")
.where(
__.out("comment")
.in_("post")
.out("block")
.hasId(__.select("commentOwner").id()) // the poster is blocking the commenter
)
)
这不起作用,但这是一般的想法。排除帖子所有者阻止评论者的 cmets。我该如何构造这个遍历?
【问题讨论】: