-
Notifications
You must be signed in to change notification settings - Fork 615
[Question] 不同的顶点使用不同的边要怎么做 #2394
Answered
by
imbajin
liming1010
asked this question in
Q&A
-
Problem Type (问题类型)
configs (配置项 / 文档相关)
Before submit
- 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
Environment (环境信息)
server: 1.0
jdk: 11
Your Question (问题描述)
不同的顶点使用相同的边,比如 用图表示多个家庭:每个家庭有自己的父亲和自己的仔仔,他们有相同的边就是: 父子。创建相同的边的时候就会提示:The edge label '父子' has existed
String edge = "父子";
schema.edgeLabel(edge).sourceLabel("张三")
.targetLabel("张小明")
.properties(edge)
.ifNotExist()
.create();
schema.edgeLabel(edge).sourceLabel("李四")
.targetLabel("李二狗")
.properties(edge)
.ifNotExist()
.create();
创建第二个的时候就会出错,不知道描述清楚没有
Vertex/Edge example (问题点 / 边数据举例)
No response
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
No response
Beta Was this translation helpful? Give feedback.
All reactions
Answered by
imbajin
Dec 18, 2023
几个点:
- 例子里不应该使用人的具体实现作为 vertexLabel, 它们应该是一个 vertex 示例 (label 应该是"Person" 这样的抽象), 虽然只是举例, 也提醒一下
- 你说的类似的 VertexLabel 用相似的 EdgeLabel, 目前比较简单的做法是, 把 EdgeLabel 改个名字, 例如 `parent" 这样的 edgelabel, 替换为
- personParentDog
- dogParentCat
-
aParentB的 edgeLabel 命名方式 (a 和 b 代表两个 vertexLable, 这样可以唯一区分, 语义也清楚)
- 更好的设计是增加"父子边"的结构设计, 这个 feature 在下一个版本里会发布
Replies: 2 comments
-
几个点:
- 例子里不应该使用人的具体实现作为 vertexLabel, 它们应该是一个 vertex 示例 (label 应该是"Person" 这样的抽象), 虽然只是举例, 也提醒一下
- 你说的类似的 VertexLabel 用相似的 EdgeLabel, 目前比较简单的做法是, 把 EdgeLabel 改个名字, 例如 `parent" 这样的 edgelabel, 替换为
- personParentDog
- dogParentCat
aParentB的 edgeLabel 命名方式 (a 和 b 代表两个 vertexLable, 这样可以唯一区分, 语义也清楚)
- 更好的设计是增加"父子边"的结构设计, 这个 feature 在下一个版本里会发布
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Answer selected by
imbajin
-
谢谢
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment