feat: 知识图谱测试api
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package models
|
||||
|
||||
type Node struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Properties map[string]interface{} `json:"properties,omitempty"`
|
||||
X float64 `json:"x,omitempty"`
|
||||
Y float64 `json:"y,omitempty"`
|
||||
Style map[string]interface{} `json:"style,omitempty"`
|
||||
}
|
||||
|
||||
type Edge struct {
|
||||
ID string `json:"id"`
|
||||
Source string `json:"source"`
|
||||
Target string `json:"target"`
|
||||
Label string `json:"label,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Properties map[string]interface{} `json:"properties,omitempty"`
|
||||
Style map[string]interface{} `json:"style,omitempty"`
|
||||
}
|
||||
|
||||
type GraphData struct {
|
||||
Nodes []Node `json:"nodes"`
|
||||
Edges []Edge `json:"edges"`
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package models
|
||||
|
||||
type NodeResponse struct {
|
||||
ID string `json:"id" example:"1"`
|
||||
Label string `json:"label" example:"人工智能"`
|
||||
Type string `json:"type,omitempty" example:"概念"`
|
||||
Properties map[string]interface{} `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
type NeighborResponse struct {
|
||||
Nodes []Node `json:"nodes"`
|
||||
Edges []Edge `json:"edges"`
|
||||
}
|
||||
|
||||
type SearchResponse struct {
|
||||
Results []Node `json:"results"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ErrorResponse struct {
|
||||
Error string `json:"error"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
Reference in New Issue
Block a user