349 lines
11 KiB
Go
349 lines
11 KiB
Go
|
|
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||
|
|
package docs
|
||
|
|
|
||
|
|
import "github.com/swaggo/swag"
|
||
|
|
|
||
|
|
const docTemplate = `{
|
||
|
|
"schemes": {{ marshal .Schemes }},
|
||
|
|
"swagger": "2.0",
|
||
|
|
"info": {
|
||
|
|
"description": "{{escape .Description}}",
|
||
|
|
"title": "{{.Title}}",
|
||
|
|
"contact": {},
|
||
|
|
"version": "{{.Version}}"
|
||
|
|
},
|
||
|
|
"host": "{{.Host}}",
|
||
|
|
"basePath": "{{.BasePath}}",
|
||
|
|
"paths": {
|
||
|
|
"/api/graph": {
|
||
|
|
"get": {
|
||
|
|
"description": "获取知识图谱的全部节点和边数据",
|
||
|
|
"produces": [
|
||
|
|
"application/json"
|
||
|
|
],
|
||
|
|
"summary": "获取图数据",
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "成功",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.GraphData"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"500": {
|
||
|
|
"description": "内部错误",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"/api/graph/stats": {
|
||
|
|
"get": {
|
||
|
|
"description": "获取知识图谱的节点数、边数等统计信息",
|
||
|
|
"produces": [
|
||
|
|
"application/json"
|
||
|
|
],
|
||
|
|
"summary": "获取图统计信息",
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "成功",
|
||
|
|
"schema": {
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": true
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"500": {
|
||
|
|
"description": "内部错误",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"/api/nodes/{id}": {
|
||
|
|
"get": {
|
||
|
|
"description": "根据节点 ID 获取知识图谱中的节点详细信息",
|
||
|
|
"produces": [
|
||
|
|
"application/json"
|
||
|
|
],
|
||
|
|
"summary": "获取节点详情",
|
||
|
|
"parameters": [
|
||
|
|
{
|
||
|
|
"type": "string",
|
||
|
|
"description": "节点 ID",
|
||
|
|
"name": "id",
|
||
|
|
"in": "path",
|
||
|
|
"required": true
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "成功",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.NodeResponse"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"400": {
|
||
|
|
"description": "请求错误",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"404": {
|
||
|
|
"description": "节点未找到",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"500": {
|
||
|
|
"description": "内部错误",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"/api/nodes/{id}/neighbors": {
|
||
|
|
"get": {
|
||
|
|
"description": "根据节点 ID 获取其所有邻居节点及关联边",
|
||
|
|
"produces": [
|
||
|
|
"application/json"
|
||
|
|
],
|
||
|
|
"summary": "获取节点邻居",
|
||
|
|
"parameters": [
|
||
|
|
{
|
||
|
|
"type": "string",
|
||
|
|
"description": "节点 ID",
|
||
|
|
"name": "id",
|
||
|
|
"in": "path",
|
||
|
|
"required": true
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "成功",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.NeighborResponse"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"400": {
|
||
|
|
"description": "请求错误",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"404": {
|
||
|
|
"description": "节点未找到",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"500": {
|
||
|
|
"description": "内部错误",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"/api/search": {
|
||
|
|
"get": {
|
||
|
|
"description": "根据关键词搜索知识图谱中的节点",
|
||
|
|
"produces": [
|
||
|
|
"application/json"
|
||
|
|
],
|
||
|
|
"summary": "搜索节点",
|
||
|
|
"parameters": [
|
||
|
|
{
|
||
|
|
"type": "string",
|
||
|
|
"description": "搜索关键词",
|
||
|
|
"name": "q",
|
||
|
|
"in": "query",
|
||
|
|
"required": true
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"responses": {
|
||
|
|
"200": {
|
||
|
|
"description": "成功",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.SearchResponse"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"400": {
|
||
|
|
"description": "请求错误",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"500": {
|
||
|
|
"description": "内部错误",
|
||
|
|
"schema": {
|
||
|
|
"$ref": "#/definitions/models.ErrorResponse"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"definitions": {
|
||
|
|
"models.Edge": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"id": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"label": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"properties": {
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": true
|
||
|
|
},
|
||
|
|
"source": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"style": {
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": true
|
||
|
|
},
|
||
|
|
"target": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"type": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"models.ErrorResponse": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"error": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"message": {
|
||
|
|
"type": "string"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"models.GraphData": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"edges": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"$ref": "#/definitions/models.Edge"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"nodes": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"$ref": "#/definitions/models.Node"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"models.NeighborResponse": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"edges": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"$ref": "#/definitions/models.Edge"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"nodes": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"$ref": "#/definitions/models.Node"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"models.Node": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"id": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"label": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"properties": {
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": true
|
||
|
|
},
|
||
|
|
"style": {
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": true
|
||
|
|
},
|
||
|
|
"type": {
|
||
|
|
"type": "string"
|
||
|
|
},
|
||
|
|
"x": {
|
||
|
|
"type": "number"
|
||
|
|
},
|
||
|
|
"y": {
|
||
|
|
"type": "number"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"models.NodeResponse": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"id": {
|
||
|
|
"type": "string",
|
||
|
|
"example": "1"
|
||
|
|
},
|
||
|
|
"label": {
|
||
|
|
"type": "string",
|
||
|
|
"example": "人工智能"
|
||
|
|
},
|
||
|
|
"properties": {
|
||
|
|
"type": "object",
|
||
|
|
"additionalProperties": true
|
||
|
|
},
|
||
|
|
"type": {
|
||
|
|
"type": "string",
|
||
|
|
"example": "概念"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"models.SearchResponse": {
|
||
|
|
"type": "object",
|
||
|
|
"properties": {
|
||
|
|
"count": {
|
||
|
|
"type": "integer"
|
||
|
|
},
|
||
|
|
"results": {
|
||
|
|
"type": "array",
|
||
|
|
"items": {
|
||
|
|
"$ref": "#/definitions/models.Node"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}`
|
||
|
|
|
||
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||
|
|
var SwaggerInfo = &swag.Spec{
|
||
|
|
Version: "1.0.0",
|
||
|
|
Host: "localhost:8080",
|
||
|
|
BasePath: "/",
|
||
|
|
Schemes: []string{},
|
||
|
|
Title: "知识图谱 API",
|
||
|
|
Description: "知识图谱后端服务,提供图数据查询、节点搜索等功能",
|
||
|
|
InfoInstanceName: "swagger",
|
||
|
|
SwaggerTemplate: docTemplate,
|
||
|
|
LeftDelim: "{{",
|
||
|
|
RightDelim: "}}",
|
||
|
|
}
|
||
|
|
|
||
|
|
func init() {
|
||
|
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||
|
|
}
|