Skip to content

Commit 0e417f0

Browse files
authored
Merge pull request #319 from n3A87/ORM2OGM
feat:support query directly by entity
2 parents 22ebd69 + 1d4e1cb commit 0e417f0

File tree

23 files changed

+1872
-32
lines changed

23 files changed

+1872
-32
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package ye.weicheng.ngbatis.demo.pojo.edge;
2+
3+
// Copyright (c) 2022 All project authors. All rights reserved.
4+
//
5+
// This source code is licensed under Apache 2.0 License.
6+
7+
import javax.persistence.Id;
8+
import org.nebula.contrib.ngbatis.annotations.DstId;
9+
import org.nebula.contrib.ngbatis.annotations.SrcId;
10+
import org.nebula.contrib.ngbatis.annotations.base.EdgeType;
11+
import org.nebula.contrib.ngbatis.base.GraphBaseEdge;
12+
13+
/**
14+
* Follow边实体示例
15+
* @author xYLiuuuuuu
16+
* @since 2024/9/11
17+
*/
18+
19+
@EdgeType(name = "follow")
20+
public class Follow extends GraphBaseEdge {
21+
22+
@Id // 可选,如果两个节点之间同一类型边的唯一性由源节点id和目标节点id共同决定,可以不加当前属性
23+
public Long rank;
24+
25+
@SrcId // 可选,如果不需要获取关系的源节点id,可以不加当前属性
26+
public String srcId;
27+
28+
@DstId // 可选,如果不需要获取关系的目标节点id,可以不加当前属性
29+
public String dstId;
30+
31+
public int degree;
32+
33+
public Long getRank() {
34+
return rank;
35+
}
36+
37+
public void setRank(Long rank) {
38+
this.rank = rank;
39+
}
40+
41+
public String getSrcId() {
42+
return srcId;
43+
}
44+
45+
public void setSrcId(String srcId) {
46+
this.srcId = srcId;
47+
}
48+
49+
public String getDstId() {
50+
return dstId;
51+
}
52+
53+
public void setDstId(String dstId) {
54+
this.dstId = dstId;
55+
}
56+
57+
public int getDegree() {
58+
return degree;
59+
}
60+
61+
public void setDegree(int degree) {
62+
this.degree = degree;
63+
}
64+
65+
@Override
66+
public String toString() {
67+
return "Follow{"
68+
+ "rank=" + rank
69+
+ ", srcId='" + srcId + '\''
70+
+ ", dstId='" + dstId + '\''
71+
+ ", degree=" + degree
72+
+ '}';
73+
}
74+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package ye.weicheng.ngbatis.demo.pojo.edge;
2+
3+
// Copyright (c) 2022 All project authors. All rights reserved.
4+
//
5+
// This source code is licensed under Apache 2.0 License.
6+
7+
import javax.persistence.Column;
8+
import javax.persistence.Id;
9+
import org.nebula.contrib.ngbatis.annotations.DstId;
10+
import org.nebula.contrib.ngbatis.annotations.SrcId;
11+
import org.nebula.contrib.ngbatis.annotations.base.EdgeType;
12+
import org.nebula.contrib.ngbatis.base.GraphBaseEdge;
13+
14+
/**
15+
* Serve边实体示例
16+
* @author xYLiuuuuuu
17+
* @since 2024/9/11
18+
*/
19+
@EdgeType(name = "serve")
20+
public class Serve extends GraphBaseEdge {
21+
22+
@Id // 可选,如果两个节点之间同一类型边的唯一性由源节点id和目标节点id共同决定,可以不加当前属性
23+
private Long rank;
24+
25+
@SrcId // 可选,如果不需要获取关系的源节点id,可以不加当前属性
26+
private String srcId;
27+
28+
@DstId // 可选,如果不需要获取关系的目标节点id,可以不加当前属性
29+
private String dstId;
30+
31+
@Column(name = "start_year")
32+
private Integer startYear;
33+
@Column(name = "end_year")
34+
private Integer endYear;
35+
36+
public Long getRank() {
37+
return rank;
38+
}
39+
40+
public void setRank(Long rank) {
41+
this.rank = rank;
42+
}
43+
44+
public String getSrcId() {
45+
return srcId;
46+
}
47+
48+
public void setSrcId(String srcId) {
49+
this.srcId = srcId;
50+
}
51+
52+
public String getDstId() {
53+
return dstId;
54+
}
55+
56+
public void setDstId(String dstId) {
57+
this.dstId = dstId;
58+
}
59+
60+
public Integer getStartYear() {
61+
return startYear;
62+
}
63+
64+
public void setStartYear(Integer startYear) {
65+
this.startYear = startYear;
66+
}
67+
68+
public Integer getEndYear() {
69+
return endYear;
70+
}
71+
72+
public void setEndYear(Integer endYear) {
73+
this.endYear = endYear;
74+
}
75+
76+
@Override
77+
public String toString() {
78+
return "Serve{"
79+
+ "rank=" + rank
80+
+ ", srcId='" + srcId + '\''
81+
+ ", dstId='" + dstId + '\''
82+
+ ", startYear=" + startYear
83+
+ ", endYear=" + endYear
84+
+ '}';
85+
}
86+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package ye.weicheng.ngbatis.demo.pojo.vertex;
2+
3+
// Copyright (c) 2022 All project authors. All rights reserved.
4+
//
5+
// This source code is licensed under Apache 2.0 License.
6+
7+
import org.nebula.contrib.ngbatis.annotations.base.GraphId;
8+
import org.nebula.contrib.ngbatis.annotations.base.Tag;
9+
import org.nebula.contrib.ngbatis.base.GraphBaseVertex;
10+
import org.nebula.contrib.ngbatis.enums.IdType;
11+
12+
13+
/**
14+
* Player点实体示例
15+
* @author xYLiuuuuuu
16+
* @since 2024/9/11
17+
*/
18+
19+
@Tag(name = "player")
20+
public class Player extends GraphBaseVertex {
21+
22+
@GraphId(type = IdType.STRING)
23+
private String id;
24+
25+
private String name;
26+
27+
private Integer age;
28+
29+
String getId() {
30+
return id;
31+
}
32+
33+
public void setId(String id) {
34+
this.id = id;
35+
}
36+
37+
String getName() {
38+
return name;
39+
}
40+
41+
public void setName(String name) {
42+
this.name = name;
43+
}
44+
45+
Integer getAge() {
46+
return age;
47+
}
48+
49+
public void setAge(Integer age) {
50+
this.age = age;
51+
}
52+
53+
@Override
54+
public String toString() {
55+
return "Player{"
56+
+ "id='" + id + '\''
57+
+ ", name='" + name + '\''
58+
+ ", age=" + age
59+
+ '}';
60+
}
61+
62+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package ye.weicheng.ngbatis.demo.pojo.vertex;
2+
3+
// Copyright (c) 2022 All project authors. All rights reserved.
4+
//
5+
// This source code is licensed under Apache 2.0 License.
6+
7+
import org.nebula.contrib.ngbatis.annotations.base.GraphId;
8+
import org.nebula.contrib.ngbatis.annotations.base.Tag;
9+
import org.nebula.contrib.ngbatis.base.GraphBaseVertex;
10+
import org.nebula.contrib.ngbatis.enums.IdType;
11+
12+
13+
/**
14+
* Team点实体示例
15+
* @author xYLiuuuuuu
16+
* @since 2024/9/11
17+
*/
18+
19+
@Tag(name = "team")
20+
public class Team extends GraphBaseVertex {
21+
22+
@GraphId(type = IdType.STRING)
23+
private String id;
24+
25+
private String name;
26+
27+
public String getId() {
28+
return id;
29+
}
30+
31+
public void setId(String id) {
32+
this.id = id;
33+
}
34+
35+
public String getName() {
36+
return name;
37+
}
38+
39+
public void setName(String name) {
40+
this.name = name;
41+
}
42+
43+
@Override
44+
public String toString() {
45+
return "Team{" + "name='" + name + '\'' + '}';
46+
}
47+
}

0 commit comments

Comments
 (0)