-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #319 from n3A87/ORM2OGM
feat:support query directly by entity
- Loading branch information
Showing
23 changed files
with
1,872 additions
and
32 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
ngbatis-demo/src/main/java/ye/weicheng/ngbatis/demo/pojo/edge/Follow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package ye.weicheng.ngbatis.demo.pojo.edge; | ||
|
||
// Copyright (c) 2022 All project authors. All rights reserved. | ||
// | ||
// This source code is licensed under Apache 2.0 License. | ||
|
||
import javax.persistence.Id; | ||
import org.nebula.contrib.ngbatis.annotations.DstId; | ||
import org.nebula.contrib.ngbatis.annotations.SrcId; | ||
import org.nebula.contrib.ngbatis.annotations.base.EdgeType; | ||
import org.nebula.contrib.ngbatis.base.GraphBaseEdge; | ||
|
||
/** | ||
* Follow边实体示例 | ||
* @author xYLiuuuuuu | ||
* @since 2024/9/11 | ||
*/ | ||
|
||
@EdgeType(name = "follow") | ||
public class Follow extends GraphBaseEdge { | ||
|
||
@Id // 可选,如果两个节点之间同一类型边的唯一性由源节点id和目标节点id共同决定,可以不加当前属性 | ||
public Long rank; | ||
|
||
@SrcId // 可选,如果不需要获取关系的源节点id,可以不加当前属性 | ||
public String srcId; | ||
|
||
@DstId // 可选,如果不需要获取关系的目标节点id,可以不加当前属性 | ||
public String dstId; | ||
|
||
public int degree; | ||
|
||
public Long getRank() { | ||
return rank; | ||
} | ||
|
||
public void setRank(Long rank) { | ||
this.rank = rank; | ||
} | ||
|
||
public String getSrcId() { | ||
return srcId; | ||
} | ||
|
||
public void setSrcId(String srcId) { | ||
this.srcId = srcId; | ||
} | ||
|
||
public String getDstId() { | ||
return dstId; | ||
} | ||
|
||
public void setDstId(String dstId) { | ||
this.dstId = dstId; | ||
} | ||
|
||
public int getDegree() { | ||
return degree; | ||
} | ||
|
||
public void setDegree(int degree) { | ||
this.degree = degree; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Follow{" | ||
+ "rank=" + rank | ||
+ ", srcId='" + srcId + '\'' | ||
+ ", dstId='" + dstId + '\'' | ||
+ ", degree=" + degree | ||
+ '}'; | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
ngbatis-demo/src/main/java/ye/weicheng/ngbatis/demo/pojo/edge/Serve.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package ye.weicheng.ngbatis.demo.pojo.edge; | ||
|
||
// Copyright (c) 2022 All project authors. All rights reserved. | ||
// | ||
// This source code is licensed under Apache 2.0 License. | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Id; | ||
import org.nebula.contrib.ngbatis.annotations.DstId; | ||
import org.nebula.contrib.ngbatis.annotations.SrcId; | ||
import org.nebula.contrib.ngbatis.annotations.base.EdgeType; | ||
import org.nebula.contrib.ngbatis.base.GraphBaseEdge; | ||
|
||
/** | ||
* Serve边实体示例 | ||
* @author xYLiuuuuuu | ||
* @since 2024/9/11 | ||
*/ | ||
@EdgeType(name = "serve") | ||
public class Serve extends GraphBaseEdge { | ||
|
||
@Id // 可选,如果两个节点之间同一类型边的唯一性由源节点id和目标节点id共同决定,可以不加当前属性 | ||
private Long rank; | ||
|
||
@SrcId // 可选,如果不需要获取关系的源节点id,可以不加当前属性 | ||
private String srcId; | ||
|
||
@DstId // 可选,如果不需要获取关系的目标节点id,可以不加当前属性 | ||
private String dstId; | ||
|
||
@Column(name = "start_year") | ||
private Integer startYear; | ||
@Column(name = "end_year") | ||
private Integer endYear; | ||
|
||
public Long getRank() { | ||
return rank; | ||
} | ||
|
||
public void setRank(Long rank) { | ||
this.rank = rank; | ||
} | ||
|
||
public String getSrcId() { | ||
return srcId; | ||
} | ||
|
||
public void setSrcId(String srcId) { | ||
this.srcId = srcId; | ||
} | ||
|
||
public String getDstId() { | ||
return dstId; | ||
} | ||
|
||
public void setDstId(String dstId) { | ||
this.dstId = dstId; | ||
} | ||
|
||
public Integer getStartYear() { | ||
return startYear; | ||
} | ||
|
||
public void setStartYear(Integer startYear) { | ||
this.startYear = startYear; | ||
} | ||
|
||
public Integer getEndYear() { | ||
return endYear; | ||
} | ||
|
||
public void setEndYear(Integer endYear) { | ||
this.endYear = endYear; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Serve{" | ||
+ "rank=" + rank | ||
+ ", srcId='" + srcId + '\'' | ||
+ ", dstId='" + dstId + '\'' | ||
+ ", startYear=" + startYear | ||
+ ", endYear=" + endYear | ||
+ '}'; | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
ngbatis-demo/src/main/java/ye/weicheng/ngbatis/demo/pojo/vertex/Player.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package ye.weicheng.ngbatis.demo.pojo.vertex; | ||
|
||
// Copyright (c) 2022 All project authors. All rights reserved. | ||
// | ||
// This source code is licensed under Apache 2.0 License. | ||
|
||
import org.nebula.contrib.ngbatis.annotations.base.GraphId; | ||
import org.nebula.contrib.ngbatis.annotations.base.Tag; | ||
import org.nebula.contrib.ngbatis.base.GraphBaseVertex; | ||
import org.nebula.contrib.ngbatis.enums.IdType; | ||
|
||
|
||
/** | ||
* Player点实体示例 | ||
* @author xYLiuuuuuu | ||
* @since 2024/9/11 | ||
*/ | ||
|
||
@Tag(name = "player") | ||
public class Player extends GraphBaseVertex { | ||
|
||
@GraphId(type = IdType.STRING) | ||
private String id; | ||
|
||
private String name; | ||
|
||
private Integer age; | ||
|
||
String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
Integer getAge() { | ||
return age; | ||
} | ||
|
||
public void setAge(Integer age) { | ||
this.age = age; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Player{" | ||
+ "id='" + id + '\'' | ||
+ ", name='" + name + '\'' | ||
+ ", age=" + age | ||
+ '}'; | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
ngbatis-demo/src/main/java/ye/weicheng/ngbatis/demo/pojo/vertex/Team.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package ye.weicheng.ngbatis.demo.pojo.vertex; | ||
|
||
// Copyright (c) 2022 All project authors. All rights reserved. | ||
// | ||
// This source code is licensed under Apache 2.0 License. | ||
|
||
import org.nebula.contrib.ngbatis.annotations.base.GraphId; | ||
import org.nebula.contrib.ngbatis.annotations.base.Tag; | ||
import org.nebula.contrib.ngbatis.base.GraphBaseVertex; | ||
import org.nebula.contrib.ngbatis.enums.IdType; | ||
|
||
|
||
/** | ||
* Team点实体示例 | ||
* @author xYLiuuuuuu | ||
* @since 2024/9/11 | ||
*/ | ||
|
||
@Tag(name = "team") | ||
public class Team extends GraphBaseVertex { | ||
|
||
@GraphId(type = IdType.STRING) | ||
private String id; | ||
|
||
private String name; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Team{" + "name='" + name + '\'' + '}'; | ||
} | ||
} |
Oops, something went wrong.