fix: 修正swag文档端口号
This commit is contained in:
@@ -332,7 +332,7 @@ const docTemplate = `{
|
|||||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||||
var SwaggerInfo = &swag.Spec{
|
var SwaggerInfo = &swag.Spec{
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
Host: "localhost:8080",
|
Host: "localhost:3001",
|
||||||
BasePath: "/",
|
BasePath: "/",
|
||||||
Schemes: []string{},
|
Schemes: []string{},
|
||||||
Title: "知识图谱 API",
|
Title: "知识图谱 API",
|
||||||
|
|||||||
+304
-314
@@ -1,324 +1,314 @@
|
|||||||
{
|
{
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"description": "知识图谱后端服务,提供图数据查询、节点搜索等功能",
|
"description": "知识图谱后端服务,提供图数据查询、节点搜索等功能",
|
||||||
"title": "知识图谱 API",
|
"title": "知识图谱 API",
|
||||||
"contact": {},
|
"contact": {},
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
},
|
},
|
||||||
"host": "localhost:8080",
|
"host": "localhost:3001",
|
||||||
"basePath": "/",
|
"basePath": "/",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/graph": {
|
"/api/graph": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "获取知识图谱的全部节点和边数据",
|
"description": "获取知识图谱的全部节点和边数据",
|
||||||
"produces": [
|
"produces": ["application/json"],
|
||||||
"application/json"
|
"summary": "获取图数据",
|
||||||
],
|
"responses": {
|
||||||
"summary": "获取图数据",
|
"200": {
|
||||||
"responses": {
|
"description": "成功",
|
||||||
"200": {
|
"schema": {
|
||||||
"description": "成功",
|
"$ref": "#/definitions/models.GraphData"
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/models.GraphData"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "内部错误",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/models.ErrorResponse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/graph/stats": {
|
"500": {
|
||||||
"get": {
|
"description": "内部错误",
|
||||||
"description": "获取知识图谱的节点数、边数等统计信息",
|
"schema": {
|
||||||
"produces": [
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
"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": {
|
"/api/graph/stats": {
|
||||||
"models.Edge": {
|
"get": {
|
||||||
"type": "object",
|
"description": "获取知识图谱的节点数、边数等统计信息",
|
||||||
"properties": {
|
"produces": ["application/json"],
|
||||||
"id": {
|
"summary": "获取图统计信息",
|
||||||
"type": "string"
|
"responses": {
|
||||||
},
|
"200": {
|
||||||
"label": {
|
"description": "成功",
|
||||||
"type": "string"
|
"schema": {
|
||||||
},
|
"type": "object",
|
||||||
"properties": {
|
"additionalProperties": true
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": true
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"style": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": true
|
|
||||||
},
|
|
||||||
"target": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"models.ErrorResponse": {
|
"500": {
|
||||||
"type": "object",
|
"description": "内部错误",
|
||||||
"properties": {
|
"schema": {
|
||||||
"error": {
|
"$ref": "#/definitions/models.ErrorResponse"
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+40
-40
@@ -30,22 +30,22 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
edges:
|
edges:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/models.Edge'
|
$ref: "#/definitions/models.Edge"
|
||||||
type: array
|
type: array
|
||||||
nodes:
|
nodes:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/models.Node'
|
$ref: "#/definitions/models.Node"
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
models.NeighborResponse:
|
models.NeighborResponse:
|
||||||
properties:
|
properties:
|
||||||
edges:
|
edges:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/models.Edge'
|
$ref: "#/definitions/models.Edge"
|
||||||
type: array
|
type: array
|
||||||
nodes:
|
nodes:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/models.Node'
|
$ref: "#/definitions/models.Node"
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
models.Node:
|
models.Node:
|
||||||
@@ -88,10 +88,10 @@ definitions:
|
|||||||
type: integer
|
type: integer
|
||||||
results:
|
results:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/models.Node'
|
$ref: "#/definitions/models.Node"
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
host: localhost:8080
|
host: localhost:3001
|
||||||
info:
|
info:
|
||||||
contact: {}
|
contact: {}
|
||||||
description: 知识图谱后端服务,提供图数据查询、节点搜索等功能
|
description: 知识图谱后端服务,提供图数据查询、节点搜索等功能
|
||||||
@@ -102,22 +102,22 @@ paths:
|
|||||||
get:
|
get:
|
||||||
description: 获取知识图谱的全部节点和边数据
|
description: 获取知识图谱的全部节点和边数据
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: 成功
|
description: 成功
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.GraphData'
|
$ref: "#/definitions/models.GraphData"
|
||||||
"500":
|
"500":
|
||||||
description: 内部错误
|
description: 内部错误
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
summary: 获取图数据
|
summary: 获取图数据
|
||||||
/api/graph/stats:
|
/api/graph/stats:
|
||||||
get:
|
get:
|
||||||
description: 获取知识图谱的节点数、边数等统计信息
|
description: 获取知识图谱的节点数、边数等统计信息
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: 成功
|
description: 成功
|
||||||
@@ -127,89 +127,89 @@ paths:
|
|||||||
"500":
|
"500":
|
||||||
description: 内部错误
|
description: 内部错误
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
summary: 获取图统计信息
|
summary: 获取图统计信息
|
||||||
/api/nodes/{id}:
|
/api/nodes/{id}:
|
||||||
get:
|
get:
|
||||||
description: 根据节点 ID 获取知识图谱中的节点详细信息
|
description: 根据节点 ID 获取知识图谱中的节点详细信息
|
||||||
parameters:
|
parameters:
|
||||||
- description: 节点 ID
|
- description: 节点 ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: 成功
|
description: 成功
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.NodeResponse'
|
$ref: "#/definitions/models.NodeResponse"
|
||||||
"400":
|
"400":
|
||||||
description: 请求错误
|
description: 请求错误
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
"404":
|
"404":
|
||||||
description: 节点未找到
|
description: 节点未找到
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
"500":
|
"500":
|
||||||
description: 内部错误
|
description: 内部错误
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
summary: 获取节点详情
|
summary: 获取节点详情
|
||||||
/api/nodes/{id}/neighbors:
|
/api/nodes/{id}/neighbors:
|
||||||
get:
|
get:
|
||||||
description: 根据节点 ID 获取其所有邻居节点及关联边
|
description: 根据节点 ID 获取其所有邻居节点及关联边
|
||||||
parameters:
|
parameters:
|
||||||
- description: 节点 ID
|
- description: 节点 ID
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: 成功
|
description: 成功
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.NeighborResponse'
|
$ref: "#/definitions/models.NeighborResponse"
|
||||||
"400":
|
"400":
|
||||||
description: 请求错误
|
description: 请求错误
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
"404":
|
"404":
|
||||||
description: 节点未找到
|
description: 节点未找到
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
"500":
|
"500":
|
||||||
description: 内部错误
|
description: 内部错误
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
summary: 获取节点邻居
|
summary: 获取节点邻居
|
||||||
/api/search:
|
/api/search:
|
||||||
get:
|
get:
|
||||||
description: 根据关键词搜索知识图谱中的节点
|
description: 根据关键词搜索知识图谱中的节点
|
||||||
parameters:
|
parameters:
|
||||||
- description: 搜索关键词
|
- description: 搜索关键词
|
||||||
in: query
|
in: query
|
||||||
name: q
|
name: q
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: 成功
|
description: 成功
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.SearchResponse'
|
$ref: "#/definitions/models.SearchResponse"
|
||||||
"400":
|
"400":
|
||||||
description: 请求错误
|
description: 请求错误
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
"500":
|
"500":
|
||||||
description: 内部错误
|
description: 内部错误
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.ErrorResponse'
|
$ref: "#/definitions/models.ErrorResponse"
|
||||||
summary: 搜索节点
|
summary: 搜索节点
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ import (
|
|||||||
// @title 知识图谱 API
|
// @title 知识图谱 API
|
||||||
// @version 1.0.0
|
// @version 1.0.0
|
||||||
// @description 知识图谱后端服务,提供图数据查询、节点搜索等功能
|
// @description 知识图谱后端服务,提供图数据查询、节点搜索等功能
|
||||||
// @host localhost:8080
|
// @host localhost:3001
|
||||||
// @BasePath /
|
// @BasePath /
|
||||||
func main() {
|
func main() {
|
||||||
cfg, err := config.Load()
|
cfg, err := config.Load()
|
||||||
|
|||||||
Reference in New Issue
Block a user