Merge remote-tracking branch 'origin/dev_2.1.0' into dev_2.1.0
commit
c72e96f355
@ -0,0 +1,28 @@
|
||||
package com.supervision.nebula.config;
|
||||
|
||||
import com.vesoft.nebula.client.graph.net.Session;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
* 配置全局唯一session链接
|
||||
**/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class NebulaSession {
|
||||
|
||||
private final NebulaGraphProperties nebulaGraphProperties;
|
||||
|
||||
@Bean
|
||||
public Session session() throws Exception {
|
||||
SessionPool sessionPool = new SessionPool(nebulaGraphProperties.getMaxConnSize(),
|
||||
nebulaGraphProperties.getMinConnSize(),
|
||||
nebulaGraphProperties.getHostAddresses().get(0),
|
||||
nebulaGraphProperties.getUserName(),
|
||||
nebulaGraphProperties.getPassword());
|
||||
return sessionPool.borrow();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.supervision.nebula.config;
|
||||
|
||||
import com.vesoft.nebula.client.graph.NebulaPoolConfig;
|
||||
import com.vesoft.nebula.client.graph.data.HostAddress;
|
||||
import com.vesoft.nebula.client.graph.exception.AuthFailedException;
|
||||
import com.vesoft.nebula.client.graph.exception.ClientServerIncompatibleException;
|
||||
import com.vesoft.nebula.client.graph.exception.IOErrorException;
|
||||
import com.vesoft.nebula.client.graph.exception.NotValidConnectionException;
|
||||
import com.vesoft.nebula.client.graph.net.NebulaPool;
|
||||
import com.vesoft.nebula.client.graph.net.Session;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
* SessionPool
|
||||
*/
|
||||
@Slf4j
|
||||
public class SessionPool {
|
||||
|
||||
private final Queue<Session> queue;
|
||||
|
||||
private final String userName;
|
||||
|
||||
private final String passWord;
|
||||
|
||||
private final int minCountSession;
|
||||
|
||||
private final int maxCountSession;
|
||||
|
||||
private final NebulaPool pool;
|
||||
|
||||
|
||||
/**
|
||||
* 创建连接池
|
||||
*
|
||||
* @param maxCountSession 默认创建连接数
|
||||
* @param minCountSession 最大创建连接数
|
||||
* @param hostAndPort 机器端口列表
|
||||
* @param userName 用户名
|
||||
* @param passWord 密码
|
||||
* @throws UnknownHostException
|
||||
* @throws NotValidConnectionException
|
||||
* @throws IOErrorException
|
||||
* @throws AuthFailedException
|
||||
*/
|
||||
public SessionPool(int maxCountSession, int minCountSession, String hostAndPort, String userName, String passWord) throws UnknownHostException, NotValidConnectionException, IOErrorException, AuthFailedException, ClientServerIncompatibleException {
|
||||
this.minCountSession = minCountSession;
|
||||
this.maxCountSession = maxCountSession;
|
||||
this.userName = userName;
|
||||
this.passWord = passWord;
|
||||
this.queue = new LinkedBlockingQueue<>(minCountSession);
|
||||
this.pool = this.initGraphClient(hostAndPort, maxCountSession, minCountSession);
|
||||
initSession();
|
||||
}
|
||||
|
||||
public Session borrow() {
|
||||
Session se = queue.poll();
|
||||
if (se != null) {
|
||||
return se;
|
||||
}
|
||||
try {
|
||||
return this.pool.getSession(userName, passWord, true);
|
||||
} catch (Exception e) {
|
||||
log.error("execute borrow session fail, detail: ", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void release() {
|
||||
Queue<Session> queue = this.queue;
|
||||
for (Session se : queue) {
|
||||
if (se != null) {
|
||||
boolean success = this.queue.offer(se);
|
||||
if (!success) {
|
||||
se.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.pool.close();
|
||||
}
|
||||
|
||||
private void initSession() throws NotValidConnectionException, IOErrorException, AuthFailedException, ClientServerIncompatibleException {
|
||||
for (int i = 0; i < minCountSession; i++) {
|
||||
queue.offer(this.pool.getSession(userName, passWord, true));
|
||||
}
|
||||
}
|
||||
|
||||
private NebulaPool initGraphClient(String hostAndPort, int maxConnSize, int minCount) throws UnknownHostException {
|
||||
List<HostAddress> hostAndPorts = getGraphHostPort(hostAndPort);
|
||||
NebulaPool pool = new NebulaPool();
|
||||
NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
|
||||
nebulaPoolConfig = nebulaPoolConfig.setMaxConnSize(maxConnSize);
|
||||
nebulaPoolConfig = nebulaPoolConfig.setMinConnSize(minCount);
|
||||
nebulaPoolConfig = nebulaPoolConfig.setIdleTime(1000 * 600);
|
||||
pool.init(hostAndPorts, nebulaPoolConfig);
|
||||
return pool;
|
||||
}
|
||||
|
||||
private List<HostAddress> getGraphHostPort(String hostAndPort) {
|
||||
String[] split = hostAndPort.split(",");
|
||||
return Arrays.stream(split).map(item -> {
|
||||
String[] splitList = item.split(":");
|
||||
return new HostAddress(splitList[0], Integer.parseInt(splitList[1]));
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.supervision.nebula.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 属性枚举
|
||||
*
|
||||
* @author fulin
|
||||
*/
|
||||
@Getter
|
||||
public enum AttributeEnum {
|
||||
// 实体类型
|
||||
TAGS,
|
||||
// 关系类型
|
||||
EDGES,
|
||||
// 空间
|
||||
SPACES;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.supervision.nebula.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
*/
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ConditionEnum {
|
||||
|
||||
// 比较判断
|
||||
相等("EQUAL", "=="),
|
||||
包含("CONTAINS", "CONTAINS"),
|
||||
开始("STARTS", "STARTS WITH"),
|
||||
结束("ENDS", "ENDS WITH");
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
|
||||
public static String getCode(String name) {
|
||||
ConditionEnum[] values = ConditionEnum.values();
|
||||
for (ConditionEnum conditionEnum : values) {
|
||||
if (name.equalsIgnoreCase(conditionEnum.getName())) {
|
||||
return conditionEnum.getCode();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.supervision.nebula.constant;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum EdgeDirectionEnum {
|
||||
|
||||
// 边方向
|
||||
流出("OUTFLOW", "", ">", "OUT"),
|
||||
流入("INFLOW", "<", "", "IN"),
|
||||
双向("TWO-WAY", "", "", "BOTH");
|
||||
|
||||
private String name;
|
||||
private String left;
|
||||
private String right;
|
||||
private String direct;
|
||||
|
||||
|
||||
/**
|
||||
* @return java.util.List<java.lang.String>
|
||||
* @Description 获取方向
|
||||
* @Param [name]
|
||||
**/
|
||||
public static List<String> getLeftAndRight(String name) {
|
||||
EdgeDirectionEnum[] values = EdgeDirectionEnum.values();
|
||||
List<String> results = CollectionUtil.newArrayList();
|
||||
for (EdgeDirectionEnum edgeDirectionEnum : values) {
|
||||
if (name.equalsIgnoreCase(edgeDirectionEnum.getName())) {
|
||||
results.add(edgeDirectionEnum.getLeft());
|
||||
results.add(edgeDirectionEnum.getRight());
|
||||
return results;
|
||||
}
|
||||
}
|
||||
results.add("");
|
||||
results.add("");
|
||||
return results;
|
||||
}
|
||||
|
||||
public static String getDirection(String name) {
|
||||
EdgeDirectionEnum[] values = EdgeDirectionEnum.values();
|
||||
for (EdgeDirectionEnum edgeDirectionEnum : values) {
|
||||
if (name.equalsIgnoreCase(edgeDirectionEnum.getName())) {
|
||||
return edgeDirectionEnum.getDirect();
|
||||
}
|
||||
}
|
||||
return "BOTH";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.nebula.constant;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
/**
|
||||
* GQL 相关常量
|
||||
*
|
||||
* @author fulin by 2022/3/28
|
||||
*/
|
||||
public class GqlConstant {
|
||||
public static final String UNKNOWN = "unknown";
|
||||
public static final String ID = "id";
|
||||
public static final Joiner GQL_UNION_JOINER = Joiner.on(" UNION ");
|
||||
public static final Joiner GQL_UNION_COMMA = Joiner.on(",");
|
||||
|
||||
private GqlConstant() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.supervision.nebula.dto.graph.GraphPageAttribute;
|
||||
import com.supervision.nebula.dto.graph.GraphShowAttribute;
|
||||
import com.supervision.nebula.dto.graph.GraphShowInfo;
|
||||
import com.supervision.nebula.service.AttributeService;
|
||||
import com.supervision.nebula.service.GraphCommonService;
|
||||
import com.supervision.nebula.vo.AttributeVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@RestController
|
||||
@RequestMapping("/attribute")
|
||||
@Api(tags = "属性查询控制器")
|
||||
@RequiredArgsConstructor
|
||||
public class AttributeController {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
private final AttributeService attributeService;
|
||||
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("属性查询(spaces tags edges列表)")
|
||||
public List<AttributeVo> showAttribute(@RequestBody GraphShowAttribute graphShowAttribute) {
|
||||
return attributeService.showAttribute(graphShowAttribute);
|
||||
}
|
||||
|
||||
@PostMapping("/page")
|
||||
@ApiOperation("属性分页查询 tags edges 分页列表")
|
||||
public PageInfo<AttributeVo.DataBean> pageListAttribute(@RequestBody GraphPageAttribute graphPageAttribute) {
|
||||
return attributeService.pageListAttribute(graphPageAttribute);
|
||||
}
|
||||
|
||||
@PostMapping("/listProperty")
|
||||
@ApiOperation("属性的子属性列表查询 tag edge 的属性列表查询")
|
||||
public List<AttributeVo> showAttributeInfo(@RequestBody GraphShowInfo graphShowInfo) {
|
||||
return attributeService.showAttributeInfo(graphShowInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/propertyInfo")
|
||||
@ApiOperation("属性的详细信息")
|
||||
public List<AttributeVo> showCreateAttributeInfo(@RequestBody GraphShowInfo graphShowInfo) {
|
||||
return attributeService.showCreateAttributeInfo(graphShowInfo);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.graph.GraphAddAttribute;
|
||||
import com.supervision.nebula.dto.graph.GraphDelAttribute;
|
||||
import com.supervision.nebula.dto.graph.GraphDropAttribute;
|
||||
import com.supervision.nebula.service.AttributeService;
|
||||
import com.supervision.nebula.service.GraphCommonService;
|
||||
import com.supervision.nebula.util.NebulaUtil;
|
||||
import com.supervision.nebula.vo.CommonVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/attribute")
|
||||
@Api(tags = "属性编辑控制器")
|
||||
@RequiredArgsConstructor
|
||||
public class AttributeManageController {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
private final AttributeService attributeService;
|
||||
|
||||
@PostMapping("/dropAttribute")
|
||||
@ApiOperation("删除属性(删除 space空间 tag标签 edge边类型)")
|
||||
public List<CommonVo> dropAttribute(@RequestBody GraphDropAttribute graphDropAttribute) {
|
||||
return attributeService.dropAttribute(graphDropAttribute);
|
||||
}
|
||||
|
||||
@PostMapping("/addAttributeProperty")
|
||||
@ApiOperation("增加属性的子属性(tag标签的属性 edge边类型的属性)")
|
||||
public List<CommonVo> addAttributeProperty(@RequestBody GraphAddAttribute graphAddAttribute) {
|
||||
return attributeService.addAttributeProperty(graphAddAttribute);
|
||||
}
|
||||
|
||||
@PostMapping("/delAttributeProperty")
|
||||
@ApiOperation("删除属性的子属性(tag标签的属性 edge边类型的属性)")
|
||||
public List<CommonVo> delAttributeProperty(@RequestBody GraphDelAttribute graphDelAttribute) {
|
||||
return graphCommonService.executeJson(NebulaUtil.delAttributeProperty(graphDelAttribute), CommonVo.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.NebulaVertexJsonResult;
|
||||
import com.supervision.nebula.dto.graph.GraphSpace;
|
||||
import com.supervision.nebula.service.GraphCommonService;
|
||||
import com.supervision.nebula.util.NebulaUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
* @Descriptin: 边控制器
|
||||
* @ClassName: VertexController
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "边edge查询控制器")
|
||||
@RequestMapping("/edge")
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeController {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
@PostMapping("/listEdge")
|
||||
@ApiOperation("查询插入的边edge(绑定关系查询)")
|
||||
public List<NebulaVertexJsonResult> listEdge(@RequestBody GraphSpace graphSpace) {
|
||||
return graphCommonService.executeJson(NebulaUtil.listEdge(graphSpace), NebulaVertexJsonResult.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.graph.GraphDeleteEdge;
|
||||
import com.supervision.nebula.dto.graph.GraphInsertEdge;
|
||||
import com.supervision.nebula.service.GraphCommonService;
|
||||
import com.supervision.nebula.util.NebulaUtil;
|
||||
import com.supervision.nebula.vo.CommonVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
* @Descriptin: 边控制器
|
||||
* @ClassName: VertexController
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "边edge管理控制器")
|
||||
@RequestMapping("/edge")
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeManageController {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
@PostMapping("/insertEdge")
|
||||
@ApiOperation("插入边edge(关系编辑-绑定两个点的关系)")
|
||||
public List<CommonVo> insertEdge(@RequestBody GraphInsertEdge graphInsertEdge) {
|
||||
String vidType = graphCommonService.getVidType(graphInsertEdge.getSpace());
|
||||
return graphCommonService.executeJson(NebulaUtil.insertEdge(graphInsertEdge, vidType), CommonVo.class);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteEdge")
|
||||
@ApiOperation("删除边edge(解除关系编辑-解除两个点的关系)")
|
||||
public List<CommonVo> deleteEdge(@RequestBody GraphDeleteEdge graphDeleteEdge) {
|
||||
String vidType = graphCommonService.getVidType(graphDeleteEdge.getSpace());
|
||||
return graphCommonService.executeJson(NebulaUtil.deleteEdge(graphDeleteEdge, vidType), CommonVo.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.ImportBean;
|
||||
import com.supervision.nebula.entity.GraphFile;
|
||||
import com.supervision.nebula.service.GraphFileService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* (GraphFile)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-08-23 09:09:26
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "文件控制器")
|
||||
@RequestMapping("graphFile")
|
||||
public class GraphFileController {
|
||||
|
||||
@Resource
|
||||
private GraphFileService graphFileService;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 文件实例对象
|
||||
*/
|
||||
|
||||
@ApiOperation("文件上传--可以不做,这里为了预览数据")
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public GraphFile uploadFile(@RequestParam("file") MultipartFile file) {
|
||||
return this.graphFileService.uploadFile(file);
|
||||
}
|
||||
|
||||
@ApiOperation("文件导入--执行nebula import插件")
|
||||
@PostMapping("/import")
|
||||
public Boolean importFile(@RequestBody ImportBean importBean) throws IOException {
|
||||
return this.graphFileService.importFile(importBean);
|
||||
}
|
||||
|
||||
@ApiOperation("模板下载,可以填充数据")
|
||||
@GetMapping("/template")
|
||||
public void template(@RequestParam String space, HttpServletResponse response) {
|
||||
graphFileService.template(space, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.graph.GraphCreateSpace;
|
||||
import com.supervision.nebula.dto.graph.GraphShowAttribute;
|
||||
import com.supervision.nebula.dto.graph.GraphSpace;
|
||||
import com.supervision.nebula.service.GraphCommonService;
|
||||
import com.supervision.nebula.service.SpaceService;
|
||||
import com.supervision.nebula.util.NebulaUtil;
|
||||
import com.supervision.nebula.vo.AttributeVo;
|
||||
import com.supervision.nebula.vo.CommonVo;
|
||||
import com.supervision.nebula.vo.DetailSpace;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
* space控制器
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "图谱space控制器")
|
||||
@RequestMapping("/space")
|
||||
@RequiredArgsConstructor
|
||||
public class SpaceController {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
private final SpaceService spaceService;
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建图谱")
|
||||
public List<CommonVo> createSpace(@RequestBody GraphCreateSpace graphCreateSpace) {
|
||||
return spaceService.createSpace(graphCreateSpace);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/use")
|
||||
@ApiOperation("切换图谱")
|
||||
public List<CommonVo> useSpace(@RequestBody GraphCreateSpace graphCreateSpace) {
|
||||
return graphCommonService.executeJson(NebulaUtil.useSpace(graphCreateSpace.getSpace()), CommonVo.class);
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("卡片展示列表(图谱详情)")
|
||||
public List<DetailSpace> detailSpace(@RequestBody GraphShowAttribute graphShowAttribute) {
|
||||
return spaceService.detailSpace(graphShowAttribute);
|
||||
}
|
||||
|
||||
@PostMapping("/info")
|
||||
@ApiOperation("查询某个空间的信息")
|
||||
public List<AttributeVo> spaceInfo(@RequestBody GraphSpace graphSpace) {
|
||||
return spaceService.spaceInfo(graphSpace.getSpace());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.supervision.nebula.service.GraphCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "子图查询控制器")
|
||||
@RequestMapping("/subGraph")
|
||||
@RequiredArgsConstructor
|
||||
public class SubGraphController {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
@PostMapping("querySubGraph")
|
||||
@ApiOperation("子图查询")
|
||||
public JSONObject querySubGraph() {
|
||||
String subgraphQuery = "use subgraph;GET SUBGRAPH 100 STEPS FROM \"player101\" YIELD VERTICES AS `vertices_`, EDGES AS `edges_`;";
|
||||
String s = graphCommonService.executeJson(subgraphQuery);
|
||||
return JSONUtil.parseObj(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.graph.GraphCreateIndex;
|
||||
import com.supervision.nebula.dto.graph.GraphCreateTagEdge;
|
||||
import com.supervision.nebula.service.GraphCommonService;
|
||||
import com.supervision.nebula.util.NebulaUtil;
|
||||
import com.supervision.nebula.vo.CommonVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
* 点类型标签tag控制器
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "标签tag edge 新增控制器")
|
||||
@RequestMapping("/tagEdge")
|
||||
public class TagEdgeController {
|
||||
|
||||
@Autowired
|
||||
GraphCommonService graphCommonService;
|
||||
|
||||
@PostMapping("/createTagEdge")
|
||||
@ApiOperation("创建tag 或者 edge")
|
||||
public List<CommonVo> createTagEdge(@RequestBody GraphCreateTagEdge graphCreateTagEdge) {
|
||||
return graphCommonService.executeJson(NebulaUtil.createTagEdge(graphCreateTagEdge), CommonVo.class);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/createIndex")
|
||||
@ApiOperation("创建索引")
|
||||
public List<CommonVo> createIndex(@RequestBody GraphCreateIndex graphCreateIndex) {
|
||||
return graphCommonService.executeJson(NebulaUtil.createIndex(graphCreateIndex), CommonVo.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.supervision.nebula.dto.NebulaJsonConverter;
|
||||
import com.supervision.nebula.dto.NebulaVertexJsonResult;
|
||||
import com.supervision.nebula.dto.graph.*;
|
||||
import com.supervision.nebula.service.VertexService;
|
||||
import com.supervision.nebula.vo.AttributeVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 点控制器
|
||||
*
|
||||
* @author fulin
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "点查询(实体)控制器")
|
||||
@RequestMapping("/vertex")
|
||||
@RequiredArgsConstructor
|
||||
public class VertexController {
|
||||
|
||||
private final VertexService vertexService;
|
||||
|
||||
@PostMapping("/vertexList")
|
||||
@ApiOperation("查询创建的点列表")
|
||||
public List<NebulaVertexJsonResult> vertexList(@RequestBody GraphSpace graphSpace) {
|
||||
return vertexService.vertexList(graphSpace.getSpace());
|
||||
}
|
||||
|
||||
@PostMapping("/vertexTagsQuery")
|
||||
@ApiOperation("根据tag标签查询点")
|
||||
public List<NebulaVertexJsonResult> vertexTagsQuery(@RequestBody GraphVertexTatsQuery graphVertexTatsQuery) {
|
||||
return vertexService.vertexTagsQuery(graphVertexTatsQuery);
|
||||
}
|
||||
|
||||
@PostMapping("/vertexTagAttributeQuery")
|
||||
@ApiOperation("根据tag标签属性查询点(先要保证该标签属性已经建立索引)")
|
||||
public List<NebulaVertexJsonResult> vertexTagAttributeQuery(@RequestBody GraphVertexTatAttributeQuery graphVertexTatAttributeQuery) {
|
||||
return vertexService.vertexTagAttributeQuery(graphVertexTatAttributeQuery);
|
||||
}
|
||||
|
||||
@PostMapping("/expandQuery")
|
||||
@ApiOperation("根据点以及边信息扩展查询")
|
||||
public GraphData vertexExpandQuery(@RequestBody GraphExpand graphExpand) {
|
||||
List<NebulaVertexJsonResult> data = vertexService.vertexExpandQuery(graphExpand);
|
||||
JSONArray objects = JSONUtil.parseArray(JSONUtil.toJsonStr(data));
|
||||
return NebulaJsonConverter.toGraphDataMain(objects, new ArrayList<AttributeVo>());
|
||||
}
|
||||
|
||||
@PostMapping("/page")
|
||||
@ApiOperation("查询创建的点分页列表")
|
||||
public Map<String, Object> vertexPage(@RequestBody GraphVertexTatsQuery graphVertexTatsQuery) {
|
||||
return vertexService.vertexPage(graphVertexTatsQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.supervision.nebula.controller;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.graph.GraphCreateVertex;
|
||||
import com.supervision.nebula.dto.graph.GraphDeleteVertex;
|
||||
import com.supervision.nebula.service.GraphCommonService;
|
||||
import com.supervision.nebula.util.NebulaUtil;
|
||||
import com.supervision.nebula.vo.CommonVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
* 点控制器
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "点编辑(实体)控制器")
|
||||
@RequestMapping("/vertex")
|
||||
@RequiredArgsConstructor
|
||||
public class VertexManageController {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
@PostMapping("/createVertex")
|
||||
@ApiOperation("创建点(需要附加标签tag信息)")
|
||||
public List<CommonVo> createVertex(@RequestBody GraphCreateVertex graphCreateVertex) {
|
||||
String vidType = graphCommonService.getVidType(graphCreateVertex.getSpace());
|
||||
return graphCommonService.executeJson(NebulaUtil.createPoint(graphCreateVertex, vidType), CommonVo.class);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteVertex")
|
||||
@ApiOperation("删除点(根据点id删除)")
|
||||
public List<CommonVo> deleteVertex(@RequestBody GraphDeleteVertex graphDeleteVertex) {
|
||||
String vidType = graphCommonService.getVidType(graphDeleteVertex.getSpace());
|
||||
return graphCommonService.executeJson(NebulaUtil.deleteVertex(graphDeleteVertex, vidType), CommonVo.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EdgeCombo {
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private Integer fileId;
|
||||
/**
|
||||
* 元素属性
|
||||
*/
|
||||
private EdgeElement edgeElement;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EdgeElement {
|
||||
/**
|
||||
* 边名称
|
||||
*/
|
||||
private String elementName;
|
||||
/**
|
||||
* 起点对应的列号
|
||||
*/
|
||||
private Integer srcId;
|
||||
/**
|
||||
* 终点对应的列号
|
||||
*/
|
||||
private Integer dstId;
|
||||
|
||||
private Integer rank;
|
||||
/**
|
||||
* 属性集合
|
||||
*/
|
||||
private List<Property> properties;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 故障图谱归因分析-失效现象解析结果
|
||||
*
|
||||
* @author fulin by 2022/3/29
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@EqualsAndHashCode(of = "id")
|
||||
public class FailureTroubleshootingVo {
|
||||
private String id;
|
||||
private String tag;
|
||||
private Map<String, String> properties;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ImportBean {
|
||||
|
||||
/**
|
||||
* 图谱标识
|
||||
*/
|
||||
private String space;
|
||||
/**
|
||||
* 点集合
|
||||
*/
|
||||
private List<VertexCombo> vertices;
|
||||
/**
|
||||
* 边集合
|
||||
*/
|
||||
private List<EdgeCombo> edges;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName: ImportDto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("数据导入入参")
|
||||
public class ImportDto {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "attribute可选值: tag标签/edge边类型", example = "tag", required = true)
|
||||
private String attribute;
|
||||
|
||||
@ApiModelProperty(value = "属性名称", example = "t1", required = true)
|
||||
private String attributeName;
|
||||
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.supervision.nebula.constant.GqlConstant;
|
||||
import com.supervision.nebula.dto.graph.GraphData;
|
||||
import com.supervision.nebula.dto.graph.GraphEdge;
|
||||
import com.supervision.nebula.dto.graph.GraphNode;
|
||||
import com.supervision.nebula.dto.graph.NodeType;
|
||||
import com.supervision.nebula.vo.AttributeVo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author fulin by 2022/3/30
|
||||
*/
|
||||
public class NebulaJsonConverter {
|
||||
|
||||
/**
|
||||
* @param jsonArray
|
||||
* @param attributeVos
|
||||
* @return
|
||||
*/
|
||||
public static GraphData toGraphDataMain(JSONArray jsonArray, List<AttributeVo> attributeVos) {
|
||||
final JSONObject jsonObject = jsonArray.getJSONObject(0);
|
||||
final JSONArray data = jsonObject.getJSONArray("data");
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
return new GraphData();
|
||||
}
|
||||
final Set<GraphNode> nodes = Sets.newHashSet();
|
||||
final Set<GraphEdge> edges = Sets.newHashSet();
|
||||
final List<NodeType> nodeTypeList = CollectionUtil.newArrayList();
|
||||
final Set<String> tagSet = CollectionUtil.newHashSet();
|
||||
|
||||
//List<AttributeVo.DataBean> dataBeanList = attributeVos.get(0).getData();
|
||||
|
||||
for (int d = 0; d < data.size(); d++) {
|
||||
final JSONObject dataJSONObject = data.getJSONObject(d);
|
||||
|
||||
// meta 数据结构: [[]]
|
||||
final JSONArray meta = dataJSONObject.getJSONArray("meta");
|
||||
final JSONArray row = dataJSONObject.getJSONArray("row");
|
||||
|
||||
for (int i = 0; i < meta.size(); i++) {
|
||||
final JSONArray metaJSONArray = meta.getJSONArray(i);
|
||||
final JSONArray rowJSONArray = row.getJSONArray(i);
|
||||
|
||||
for (int i1 = 0; i1 < metaJSONArray.size(); i1++) {
|
||||
final JSONObject oneMeta = metaJSONArray.getJSONObject(i1);
|
||||
final JSONObject oneRow = rowJSONArray.getJSONObject(i1);
|
||||
final String type = oneMeta.getStr("type");
|
||||
Object tagInfo = null;
|
||||
Object edgeInfo = null;
|
||||
switch (type) {
|
||||
case "vertex":
|
||||
String tag = GqlConstant.UNKNOWN;
|
||||
String name = GqlConstant.UNKNOWN;
|
||||
String color = "#289D73";
|
||||
tagInfo = oneRow.entrySet();
|
||||
for (Map.Entry<String, Object> entry : oneRow.entrySet()) {
|
||||
final String key = entry.getKey();
|
||||
if (key.endsWith("name")) {
|
||||
final Object value = entry.getValue();
|
||||
final String[] split = key.split("\\.");
|
||||
tag = split[0];
|
||||
name = value.toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
String nodeTypes = GqlConstant.UNKNOWN;
|
||||
if (ObjectUtil.notEqual(GqlConstant.UNKNOWN, tag)) {
|
||||
nodeTypes = tag;
|
||||
}
|
||||
nodes.add(GraphNode.builder()
|
||||
.id(oneMeta.getStr("id"))
|
||||
.tag(tag)
|
||||
.label(name)
|
||||
.nodeTypes(nodeTypes)
|
||||
.tagInfo(tagInfo)
|
||||
.build());
|
||||
|
||||
HashMap<String, String> colorMap = MapUtil.newHashMap();
|
||||
colorMap.put("fill", color);
|
||||
colorMap.put("size", "50");
|
||||
|
||||
//for (AttributeVo.DataBean dataBean : dataBeanList) {
|
||||
// List<String> row1 = dataBean.getRow();
|
||||
// if (CollectionUtil.isNotEmpty(row1)) {
|
||||
// String tagName = row1.get(0);
|
||||
// if (StrUtil.isNotBlank(tagName)) {
|
||||
// if (tagName.equalsIgnoreCase(tag) && row1.size() > 1) {
|
||||
// colorMap.put("fill", row1.get(1));
|
||||
// colorMap.put("size", row1.get(2));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if (!tagSet.contains(tag)) {
|
||||
nodeTypeList.add(
|
||||
NodeType
|
||||
.builder()
|
||||
.id(oneMeta.getStr("id"))
|
||||
.label(tag)
|
||||
.style(colorMap)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
tagSet.add(tag);
|
||||
break;
|
||||
case "edge":
|
||||
final JSONObject id = oneMeta.getJSONObject("id");
|
||||
edgeInfo = oneRow.entrySet();
|
||||
int typeFX = Integer.parseInt(id.get("type").toString());
|
||||
if (typeFX > 0) {
|
||||
edges.add(
|
||||
GraphEdge.builder()
|
||||
.source(id.getStr("src"))
|
||||
.target(id.getStr("dst"))
|
||||
.label(id.getStr("name"))
|
||||
.edgeInfo(edgeInfo)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
if (typeFX < 0) {
|
||||
edges.add(
|
||||
GraphEdge.builder()
|
||||
.source(id.getStr("dst"))
|
||||
.target(id.getStr("src"))
|
||||
.label(id.getStr("name"))
|
||||
.edgeInfo(edgeInfo)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("type not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return GraphData.builder()
|
||||
.nodes(nodes)
|
||||
.edges(edges)
|
||||
.NodeTypes(nodeTypeList)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Descriptin: 分页参数入参
|
||||
* @ClassName: PageBeanDto
|
||||
*/
|
||||
@ApiModel("分页参数入参")
|
||||
@Data
|
||||
public class PageBeanDto {
|
||||
|
||||
@ApiModelProperty(value = "页码:从1开始", example = "1", required = false)
|
||||
private Integer pageNum = 1;
|
||||
|
||||
@ApiModelProperty(value = "分页条数", example = "10", required = false)
|
||||
private Integer pageSize = 10;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Property {
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
private String propName;
|
||||
/**
|
||||
* 对应CSV文件列号
|
||||
*/
|
||||
private Integer csvIndex;
|
||||
/**
|
||||
* 属性类型
|
||||
*/
|
||||
private String type;
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName= TemplateBean
|
||||
*/
|
||||
@Data
|
||||
public class TemplateBean {
|
||||
|
||||
private String version = "v3";
|
||||
private String description = "web console import";
|
||||
private Boolean removeTempFiles = false;
|
||||
private ClientSettings clientSettings;
|
||||
private String logPath;
|
||||
private List<File> files;
|
||||
|
||||
|
||||
@Data
|
||||
public static class File {
|
||||
private String path;
|
||||
private String failDataPath;
|
||||
private Integer batchSize = 60;
|
||||
private String limit;
|
||||
private String inOrder;
|
||||
private String type = "csv";
|
||||
private CSV csv;
|
||||
private Schema schema;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class CSV {
|
||||
private Boolean withHeader = true;
|
||||
private Boolean withLabel = false;
|
||||
private String delimiter;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Schema {
|
||||
private String type = "vertex";
|
||||
// private Vertex vertex;
|
||||
private Edge edge;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Edge {
|
||||
private String name = "order";
|
||||
private Boolean withRanking = false;
|
||||
// private List<Prop> props;
|
||||
// private SrcDst srcVID;
|
||||
// private SrcDst dstVID;
|
||||
// private Integer rank;
|
||||
}
|
||||
|
||||
|
||||
// @Data
|
||||
// public static class SrcDst {
|
||||
// private Integer index = 1;
|
||||
// private String function = "";
|
||||
// private String type = "string";
|
||||
// private String prefix = "";
|
||||
// }
|
||||
|
||||
|
||||
// @Data
|
||||
// public static class Vertex {
|
||||
// private Vid vid;
|
||||
// private List<Tag> tags;
|
||||
// }
|
||||
|
||||
|
||||
// @Data
|
||||
// public static class Vid {
|
||||
// private Integer index = 0;
|
||||
// private String function;
|
||||
// private String type = "string";
|
||||
// private String prefix;
|
||||
// }
|
||||
|
||||
|
||||
// @Data
|
||||
// public static class Tag {
|
||||
// private String name = "item";
|
||||
// private List<Prop> props;
|
||||
// }
|
||||
|
||||
// @Data
|
||||
// public static class Prop {
|
||||
// private String name = "id_single_item";
|
||||
// private String type = "string";
|
||||
// private Integer index = 0;
|
||||
// }
|
||||
|
||||
|
||||
@Data
|
||||
public static class ClientSettings {
|
||||
private Integer retry = 3;
|
||||
private Integer concurrency = 10;
|
||||
private Integer channelBufferSize = 128;
|
||||
private String space = "dataImport";
|
||||
private String postStart;
|
||||
private String preStop;
|
||||
private Connection connection;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Connection {
|
||||
private String user = "root";
|
||||
private String password = "nebula";
|
||||
private String address = "127.0.0.1:9669";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName: UserDto
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel("用户入参")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserDto {
|
||||
|
||||
@ApiModelProperty(value = "用户名", required = true, example = "test")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码", required = true, example = "test")
|
||||
private String password;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VertexCombo {
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private Integer fileId;
|
||||
/**
|
||||
* 点对应文件中的列号
|
||||
*/
|
||||
private Integer vertexId;
|
||||
/**
|
||||
* 元素属性
|
||||
*/
|
||||
private List<VertexElement> vertexElements;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.supervision.nebula.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VertexElement {
|
||||
/**
|
||||
* 元素名称
|
||||
*/
|
||||
private String elementName;
|
||||
/**
|
||||
* 属性集合
|
||||
*/
|
||||
private List<Property> properties;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Descriptin:
|
||||
* @ClassName: AttributeBean
|
||||
*/
|
||||
@ApiModel("属性入参")
|
||||
@Data
|
||||
public class AttributeBean {
|
||||
|
||||
/**
|
||||
* 属性名称
|
||||
**/
|
||||
@ApiModelProperty(value = "tag/edge的属性名称", example = "p3", required = true)
|
||||
private String propertyName;
|
||||
/**
|
||||
* 属性类型 (int bool string double .........)
|
||||
**/
|
||||
@ApiModelProperty(value = "索引长度:属性为string 必须有长度,其他类型不可传入 ", example = "30", required = true)
|
||||
private String indexLength;
|
||||
|
||||
public String getPropertyName() {
|
||||
return "`" + propertyName + "`" + getIndexLength();
|
||||
}
|
||||
|
||||
private String getIndexLength() {
|
||||
if (StrUtil.isNotBlank(indexLength)) {
|
||||
return "(" + indexLength + ")";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getIndexFull() {
|
||||
if (StrUtil.isNotBlank(indexLength)) {
|
||||
return "(" + indexLength + ")";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("修改属性实体")
|
||||
public class GraphAddAttribute {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "attribute可选值: tag标签/edge边类型", example = "tag", required = true)
|
||||
private String attribute;
|
||||
|
||||
@ApiModelProperty(value = "属性名称", example = "t1", required = true)
|
||||
private String attributeName;
|
||||
|
||||
@ApiModelProperty(value = "tag/edge的属性名称", example = "p5")
|
||||
private String propertyName;
|
||||
|
||||
@ApiModelProperty(value = "属性类型,add 必传该类型 可选值: int bool string double .........", example = "string", required = false)
|
||||
private String propertyType;
|
||||
|
||||
@ApiModelProperty(value = "是否可为空: NOT NULL 或者 NULL", example = "NULL")
|
||||
private String isNull;
|
||||
|
||||
@ApiModelProperty(value = "默认值")
|
||||
private Object defaultValue;
|
||||
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String common;
|
||||
|
||||
public Object getDefaultValue() {
|
||||
if (!ObjectUtil.isNull(defaultValue)) {
|
||||
if (defaultValue instanceof String) {
|
||||
return "DEFAULT '" + defaultValue + "'";
|
||||
}
|
||||
return "DEFAULT " + defaultValue;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public String getCommon() {
|
||||
if (StrUtil.isNotBlank(common)) {
|
||||
return "COMMENT '" + common + "'";
|
||||
}
|
||||
return common;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("创建索引入参")
|
||||
public class GraphCreateIndex {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "创建类型: tag/edge", example = "tag", required = true)
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "索引名称", example = "name_index", required = true)
|
||||
private String indexName;
|
||||
|
||||
@ApiModelProperty(value = "tag/edge名称", example = "t1", required = true)
|
||||
private String tagEdgeName;
|
||||
|
||||
@ApiModelProperty(value = "索引描述描述", example = "备注")
|
||||
private String comment;
|
||||
|
||||
@ApiModelProperty(value = "属性集合")
|
||||
private List<AttributeBean> attributeBeanList;
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("创建空间实体")
|
||||
public class GraphCreateSpace {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
/**
|
||||
* 空间中文名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间中文名称", example = "付琳测试", required = true)
|
||||
private String spaceChineseName;
|
||||
/**
|
||||
* 分片数量
|
||||
**/
|
||||
@ApiModelProperty(value = "分片数量", example = "1")
|
||||
private Integer partitionNum;
|
||||
|
||||
/**
|
||||
* 分片数量
|
||||
**/
|
||||
@ApiModelProperty(value = "副本数量", example = "1")
|
||||
private Integer replicaFactor;
|
||||
/**
|
||||
* 类型
|
||||
**/
|
||||
@ApiModelProperty(value = "点类型:INT64,FIXED_STRING", example = "INT64")
|
||||
private String fixedType = "INT64";
|
||||
/**
|
||||
* 类型大小
|
||||
**/
|
||||
@ApiModelProperty(value = "类型长度,FIXED_STRING 此字段必填 如32,64")
|
||||
private String size = "";
|
||||
/**
|
||||
* 描述
|
||||
**/
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String comment;
|
||||
|
||||
public String getSize() {
|
||||
if (StrUtil.isNotBlank(size)) {
|
||||
return "(" + size + ")";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("创建tag edge入参")
|
||||
public class GraphCreateTagEdge {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi")
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "创建类型: tag/edge", example = "tag")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "tag/edge名称", example = "demo")
|
||||
private String tagEdgeName;
|
||||
|
||||
@ApiModelProperty(value = "tag/edge描述", example = "备注")
|
||||
private String tagEdgeComment;
|
||||
|
||||
@ApiModelProperty(value = "属性集合")
|
||||
private List<PropertyBean> propertyList;
|
||||
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String color;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("创建点入参")
|
||||
public class GraphCreateVertex {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "标签tag名称", example = "t1", required = true)
|
||||
private String tagName;
|
||||
|
||||
@ApiModelProperty(value = "标签tag属性集合", required = false)
|
||||
private List<String> tagList;
|
||||
/**
|
||||
* point的key
|
||||
**/
|
||||
@ApiModelProperty(value = "点的VID", required = true)
|
||||
private Object pointKey;
|
||||
|
||||
@ApiModelProperty(value = "标签tag的属性值集合", required = false)
|
||||
private List<Object> tagValueList;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 图可视化展示数据结构
|
||||
*
|
||||
* @author fulin by 2022/3/30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GraphData {
|
||||
private Collection<GraphNode> nodes;
|
||||
private Collection<GraphEdge> edges;
|
||||
private Collection<NodeType> NodeTypes;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("删除属性实体")
|
||||
public class GraphDelAttribute {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "attribute可选值: tag标签/edge边类型", example = "tag", required = true)
|
||||
private String attribute;
|
||||
|
||||
@ApiModelProperty(value = "属性名称", example = "t1", required = true)
|
||||
private String attributeName;
|
||||
|
||||
@ApiModelProperty(value = "tag/edge的属性名称 支持批量")
|
||||
private List<String> propertyNameList;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("删除边入参")
|
||||
public class GraphDeleteEdge {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "边类型edge名称", example = "e1", required = true)
|
||||
private String edgeName;
|
||||
|
||||
@ApiModelProperty(value = "点的起始VID", example = "11", required = true)
|
||||
private Object srcVid;
|
||||
|
||||
@ApiModelProperty(value = "点的目的VID", example = "12", required = true)
|
||||
private Object dstVid;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("删除点入参")
|
||||
public class GraphDeleteVertex {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "vertex 点id", required = true)
|
||||
private Object vid;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("删除属性实体")
|
||||
public class GraphDropAttribute {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi1", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "属性名称", example = "flceshi1", required = true)
|
||||
private String attributeName;
|
||||
|
||||
@ApiModelProperty(value = "attribute可选值:space空间/tag标签/edge边类型", example = "space", required = true)
|
||||
private String attribute;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 图可视化-边
|
||||
*
|
||||
* @author fulin by 2022/3/30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@EqualsAndHashCode(of = {"source", "target"})
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GraphEdge {
|
||||
private String label;
|
||||
private String source;
|
||||
private String target;
|
||||
private Object edgeInfo;
|
||||
|
||||
public GraphEdge(String edge, String tagStart, String tagEnd) {
|
||||
this.label = edge;
|
||||
this.source = tagStart;
|
||||
this.target = tagEnd;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("扩展查询入参实体")
|
||||
public class GraphExpand {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "边类型集合", required = true)
|
||||
private List<String> edgeList;
|
||||
|
||||
@ApiModelProperty(value = "方向: OUTFLOW(流出);INFLOW(流入);TWO-WAY(双向);", example = "TWO-WAY", required = true)
|
||||
private String direction;
|
||||
|
||||
@ApiModelProperty(value = "步数开始(单步/范围的开始)", example = "1", required = true)
|
||||
private Integer stepStart;
|
||||
|
||||
@ApiModelProperty(value = "步数结束(范围的结束;可无)", example = "2")
|
||||
@Min(1)
|
||||
private Integer stepEnd;
|
||||
|
||||
@ApiModelProperty(value = "结果条数", example = "100", required = true)
|
||||
@Max(Integer.MAX_VALUE)
|
||||
@Min(1)
|
||||
private Integer resultSize = Integer.MAX_VALUE;
|
||||
|
||||
@ApiModelProperty(value = "扩展点id集合", required = true)
|
||||
private List<Object> vidList;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "条件(可为空)", example = " l.name CONTAINS '1' ", required = false)
|
||||
private String condition;
|
||||
|
||||
public String getStepEndResult() {
|
||||
if (stepEnd != null) {
|
||||
return ".." + stepEnd;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getVidList(String vidType) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < vidList.size(); i++) {
|
||||
Object vid = vidList.get(i);
|
||||
|
||||
if (vidType.contains("STRING")) {
|
||||
stringBuffer.append("\"").append(vid).append("\"");
|
||||
} else {
|
||||
stringBuffer.append(vid);
|
||||
}
|
||||
if (vidList.size() > 1 && (i + 1) != vidList.size()) {
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
// l.degree CONTAINS 1 AND l.min_level == 2
|
||||
public String getCondition() {
|
||||
if (StrUtil.isNotBlank(condition)) {
|
||||
return " AND ALL(l IN e WHERE " + condition + ")";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("插入边入参")
|
||||
public class GraphInsertEdge {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "边类型edge名称", example = "e1", required = true)
|
||||
private String edgeName;
|
||||
|
||||
@ApiModelProperty(value = "边类型edge属性集合", required = false)
|
||||
private List<String> edgeList;
|
||||
|
||||
@ApiModelProperty(value = "点的起始VID", example = "11", required = true)
|
||||
private String srcVid;
|
||||
|
||||
@ApiModelProperty(value = "点的目的VID", example = "12", required = true)
|
||||
private String dstVid;
|
||||
|
||||
@ApiModelProperty(value = "边edge的属性值集合", required = false)
|
||||
private List<Object> edgeValueList;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 图可视化-节点
|
||||
*
|
||||
* @author fulin by 2022/3/30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@EqualsAndHashCode(of = "id")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GraphNode {
|
||||
private String id;
|
||||
private String tag;
|
||||
private String label;
|
||||
private String nodeTypes;
|
||||
private Object tagInfo;
|
||||
|
||||
public GraphNode(String tag, String tagInfo) {
|
||||
this.id = tag;
|
||||
this.tag = tag;
|
||||
this.label = tag;
|
||||
this.nodeTypes = tag;
|
||||
this.tagInfo = tagInfo;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import com.supervision.nebula.dto.PageBeanDto;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("查询属性分页查询入参")
|
||||
public class GraphPageAttribute extends PageBeanDto {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "attribute可选值:tags标签/edges边类型", example = "tags", required = true)
|
||||
private String attribute;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import com.supervision.nebula.dto.PageBeanDto;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("查询边分页入参")
|
||||
public class GraphPageEdge extends PageBeanDto {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "边类型edge", required = false)
|
||||
private String edge;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "起点或者终点ID", required = false)
|
||||
private String vid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 关系绑定入参
|
||||
*
|
||||
* @ClassName: GraphRelationInsert
|
||||
*/
|
||||
@Data
|
||||
public class GraphRelationInsert {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "movies", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "开始标签", required = true)
|
||||
private String tagStart;
|
||||
|
||||
@ApiModelProperty(value = "边类型", required = true)
|
||||
private String edge;
|
||||
|
||||
@ApiModelProperty(value = "结束标签", required = true)
|
||||
private String tagEnd;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("查询相关属性入参")
|
||||
public class GraphShowAttribute {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = false)
|
||||
private String space;
|
||||
/**
|
||||
* attributes: spaces/tags/edges
|
||||
**/
|
||||
@ApiModelProperty(value = "attribute可选值:spaces空间/tags标签/edges边类型", example = "spaces", required = true)
|
||||
private String attribute;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import com.supervision.nebula.dto.PageBeanDto;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("查询索引入参")
|
||||
public class GraphShowIndex extends PageBeanDto {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
/**
|
||||
* attribute: tag/edge
|
||||
**/
|
||||
@ApiModelProperty(value = "属性可选: tag/edge/fulltext", example = "tag", required = true)
|
||||
private String attribute;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("属性详情查询入参")
|
||||
public class GraphShowInfo {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi")
|
||||
private String space;
|
||||
|
||||
/**
|
||||
* attribute: tag /edge
|
||||
**/
|
||||
@ApiModelProperty(value = "属性类型:tag/edge", example = "tag")
|
||||
private String attribute;
|
||||
|
||||
/**
|
||||
* attributeName: tag 名称/edge 名称
|
||||
**/
|
||||
@ApiModelProperty(value = "属性名称")
|
||||
private String attributeName;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.PageBeanDto;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("通用入参实体")
|
||||
public class GraphSpace extends PageBeanDto {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("修改边入参")
|
||||
public class GraphUpdateEdge {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "边类型edge名称", example = "e1", required = true)
|
||||
private String edgeName;
|
||||
|
||||
@ApiModelProperty(value = "边类型edge属性集合", required = false)
|
||||
private List<String> edgeList;
|
||||
|
||||
@ApiModelProperty(value = "点的起始VID", required = true)
|
||||
private Object srcVid;
|
||||
|
||||
@ApiModelProperty(value = "点的目的VID", required = true)
|
||||
private Object dstVid;
|
||||
|
||||
@ApiModelProperty(value = "边edge的属性值集合", required = false)
|
||||
private List<Object> edgeValueList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("修改空间备注入参实体")
|
||||
public class GraphUpdateSpace {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "空间中文名称", example = "空间中文名称", required = true)
|
||||
private String spaceChineseName;
|
||||
|
||||
@ApiModelProperty(value = "空间备注", example = "备注信息", required = true)
|
||||
private String spaceComment;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("修改tag颜色入参")
|
||||
public class GraphUpdateTagColor {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi")
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "类型: tag/edge", example = "tag")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "tag/edge名称", example = "demo")
|
||||
private String tagEdgeName;
|
||||
|
||||
@ApiModelProperty(value = "颜色")
|
||||
private String color;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("修改点入参")
|
||||
public class GraphUpdateVertex {
|
||||
|
||||
/**
|
||||
* 空间名称
|
||||
**/
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "标签tag名称", example = "t1", required = true)
|
||||
private String tagName;
|
||||
|
||||
@ApiModelProperty(value = "标签tag属性集合", required = true)
|
||||
private List<String> tagList;
|
||||
/**
|
||||
* point的key
|
||||
**/
|
||||
@ApiModelProperty(value = "点的VID", example = "11", required = true)
|
||||
private Object pointKey;
|
||||
|
||||
@ApiModelProperty(value = "标签tag的属性值集合", required = true)
|
||||
private List<Object> tagValueList;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("归因分析查询入参")
|
||||
public class GraphVertexAnalysisResult {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "查询关键字集合", required = true)
|
||||
private List<String> wordList;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("解析文字入参")
|
||||
public class GraphVertexAnalysisWord {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "查询关键字", required = true)
|
||||
private String word;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("全文检索")
|
||||
public class GraphVertexFullQuery {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "movies", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "查询关键字", required = true)
|
||||
private String word;
|
||||
|
||||
@ApiModelProperty(value = "标签集合", required = false)
|
||||
private List<String> tagList;
|
||||
|
||||
@ApiModelProperty(value = "查询最大条数", required = true)
|
||||
private Integer resultSize;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("路径检索")
|
||||
public class GraphVertexPathQuery {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "movies", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "路径查找类型: SHORTEST最短 | ALL所有 | NOLOOP非循环", example = "ALL", required = true)
|
||||
private String pathType;
|
||||
|
||||
@ApiModelProperty(value = "变类型集合", required = true)
|
||||
private List<String> edgeList;
|
||||
|
||||
@ApiModelProperty(value = "点的起始VID", required = true)
|
||||
private List<Object> srcVid;
|
||||
|
||||
@ApiModelProperty(value = "点的目的VID", required = true)
|
||||
private List<Object> dstVid;
|
||||
|
||||
@ApiModelProperty(value = "查询方向: REVERSELY反向 | BIDIRECT双向 | 空 正向", example = "BIDIRECT", required = true)
|
||||
private String direct;
|
||||
|
||||
@ApiModelProperty(value = "最大步数", example = "3", required = true)
|
||||
private Integer step;
|
||||
|
||||
@ApiModelProperty(value = "查询最大条数", required = true)
|
||||
private Integer resultSize;
|
||||
|
||||
@ApiModelProperty(value = "筛选条件", required = true)
|
||||
private String condition;
|
||||
|
||||
public String getEdgeList() {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < edgeList.size(); i++) {
|
||||
String edge = edgeList.get(i);
|
||||
stringBuffer.append("`").append(edge).append("`");
|
||||
if (edgeList.size() > 1 && (i + 1) != edgeList.size()) {
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public String getCondition() {
|
||||
if (StrUtil.isNotBlank(condition)) {
|
||||
return "WHERE " + condition;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("根据tag标签查询点入参实体")
|
||||
public class GraphVertexTatAttributeQuery {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty(value = "标签", example = "t1", required = true)
|
||||
private String tag;
|
||||
|
||||
@ApiModelProperty(value = "执行条件", required = true)
|
||||
private String condition;
|
||||
|
||||
@ApiModelProperty(value = "结果条数", example = "100", required = true)
|
||||
@Max(Integer.MAX_VALUE)
|
||||
@Min(1)
|
||||
private Integer resultSize = Integer.MAX_VALUE;
|
||||
|
||||
|
||||
public String getCondition() {
|
||||
if (StrUtil.isNotBlank(condition)) {
|
||||
return " where " + condition;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
|
||||
import com.supervision.nebula.dto.PageBeanDto;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@ApiModel("根据tag标签查询点入参实体")
|
||||
public class GraphVertexTatsQuery extends PageBeanDto {
|
||||
|
||||
@ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
|
||||
private String space;
|
||||
|
||||
//@ApiModelProperty(value = "标签集合", required = false)
|
||||
//private List<String> tagList;
|
||||
@ApiModelProperty(value = "标签", required = false)
|
||||
private String tag;
|
||||
|
||||
@ApiModelProperty(value = "点id", required = false)
|
||||
private Object pointKey;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 图可视化-展示样式
|
||||
*
|
||||
* @author fulin
|
||||
* @since 2022/5/9 15:44
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public class NodeType implements Serializable {
|
||||
private String id;
|
||||
private String label;
|
||||
private Map<String, String> style;
|
||||
|
||||
public NodeType() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NodeType(String tagStart, String color) {
|
||||
this.id = tagStart;
|
||||
this.label = tagStart;
|
||||
HashMap<String, String> style = MapUtil.newHashMap();
|
||||
style.put("size", "50");
|
||||
style.put("fill", color);
|
||||
this.style = style;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.supervision.nebula.dto.graph;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Descriptin:
|
||||
* @ClassName: PropertyBean
|
||||
*/
|
||||
@ApiModel("属性实体")
|
||||
@Data
|
||||
public class PropertyBean {
|
||||
|
||||
/**
|
||||
* 属性名称
|
||||
**/
|
||||
@ApiModelProperty(value = "tag/edge属性名称", example = "name", required = true)
|
||||
private String propertyName;
|
||||
/**
|
||||
* 属性类型 (int bool string double .........)
|
||||
**/
|
||||
@ApiModelProperty(value = "tag/edge属性类型可选:int bool string double", example = "string", required = true)
|
||||
private String propertyType;
|
||||
/**
|
||||
* 属性描述
|
||||
**/
|
||||
@ApiModelProperty(value = "属性描述", example = "名称")
|
||||
private String propertyComment;
|
||||
|
||||
/**
|
||||
* 是否可为空 (NOT NULL 或者 NULL)
|
||||
**/
|
||||
@ApiModelProperty(value = "是否可为空: NOT NULL 或者 NULL", example = "NULL")
|
||||
private String isNull;
|
||||
|
||||
/**
|
||||
* 默认值
|
||||
**/
|
||||
@ApiModelProperty(value = "默认值", example = "NULL")
|
||||
private Object defaultValue;
|
||||
|
||||
public Object getDefaultValue() {
|
||||
if (!ObjectUtil.isNull(defaultValue)) {
|
||||
if (defaultValue instanceof String) {
|
||||
return "DEFAULT '" + defaultValue + "'";
|
||||
}
|
||||
return "DEFAULT " + defaultValue;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.supervision.nebula.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* (GraphFile)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-08-23 09:09:27
|
||||
*/
|
||||
@Data
|
||||
public class GraphFile implements Serializable {
|
||||
private static final long serialVersionUID = -70939095818612018L;
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 上传用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String filePath;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private String fileSize;
|
||||
/**
|
||||
* 保留2
|
||||
*/
|
||||
private String extend;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.supervision.nebula.exception;
|
||||
|
||||
/**
|
||||
* @author fulin by 2022/3/25
|
||||
*/
|
||||
public class GraphExecuteException extends RuntimeException {
|
||||
public GraphExecuteException() {
|
||||
}
|
||||
|
||||
public GraphExecuteException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public GraphExecuteException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public GraphExecuteException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public GraphExecuteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.supervision.nebula.service;
|
||||
|
||||
import com.supervision.nebula.dto.ImportBean;
|
||||
import com.supervision.nebula.entity.GraphFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* (GraphFile)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-08-23 09:09:27
|
||||
*/
|
||||
public interface GraphFileService {
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param multipartFile 文件
|
||||
* @return 实例对象
|
||||
*/
|
||||
GraphFile uploadFile(MultipartFile multipartFile);
|
||||
|
||||
boolean importFile(ImportBean importBean) throws IOException;
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @return void
|
||||
* @Param [space]
|
||||
**/
|
||||
void template(String space, HttpServletResponse response);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.supervision.nebula.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.supervision.nebula.constant.AttributeEnum;
|
||||
import com.supervision.nebula.dto.graph.GraphCreateSpace;
|
||||
import com.supervision.nebula.dto.graph.GraphShowAttribute;
|
||||
import com.supervision.nebula.dto.graph.GraphShowInfo;
|
||||
import com.supervision.nebula.util.NebulaUtil;
|
||||
import com.supervision.nebula.vo.AttributeVo;
|
||||
import com.supervision.nebula.vo.CommonVo;
|
||||
import com.supervision.nebula.vo.DetailSpace;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Descriptin: 图空间
|
||||
* @ClassName: SpaceService
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SpaceService {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
public List<CommonVo> createSpace(GraphCreateSpace graphCreateSpace) {
|
||||
return graphCommonService.executeJson(NebulaUtil.createSpace(graphCreateSpace), CommonVo.class);
|
||||
}
|
||||
|
||||
public List<DetailSpace> detailSpace(GraphShowAttribute graphShowAttribute) {
|
||||
|
||||
// 所有图空间
|
||||
List<AttributeVo> spacesList = graphCommonService.executeJson(NebulaUtil.showAttributes(graphShowAttribute), AttributeVo.class);
|
||||
AttributeVo attributeVo1 = spacesList.get(0);
|
||||
|
||||
List<DetailSpace> detailSpaceList = CollectionUtil.newArrayList();
|
||||
|
||||
DetailSpace detailSpace = null;
|
||||
for (AttributeVo.DataBean datum : attributeVo1.getData()) {
|
||||
int tagsNum = 0;
|
||||
int edgesNum = 0;
|
||||
detailSpace = new DetailSpace();
|
||||
// 查询tags/edges
|
||||
String spaceName = datum.getRow().get(0);
|
||||
graphShowAttribute.setSpace(spaceName);
|
||||
graphShowAttribute.setAttribute(AttributeEnum.TAGS.name());
|
||||
List<AttributeVo> tagsList = graphCommonService.executeJson(NebulaUtil.showAttributes(graphShowAttribute), AttributeVo.class);
|
||||
|
||||
AttributeVo attributeVoTag = tagsList.get(0);
|
||||
for (AttributeVo.DataBean attributeVoTagDatum : attributeVoTag.getData()) {
|
||||
tagsNum += attributeVoTagDatum.getRow().size();
|
||||
}
|
||||
graphShowAttribute.setAttribute(AttributeEnum.EDGES.name());
|
||||
List<AttributeVo> edgesList = graphCommonService.executeJson(NebulaUtil.showAttributes(graphShowAttribute), AttributeVo.class);
|
||||
for (AttributeVo.DataBean dataBean : edgesList.get(0).getData()) {
|
||||
edgesNum += dataBean.getRow().size();
|
||||
}
|
||||
detailSpace.setSpace(spaceName);
|
||||
detailSpace.setTagsNum(tagsNum);
|
||||
detailSpace.setEdgesNum(edgesNum);
|
||||
detailSpaceList.add(detailSpace);
|
||||
}
|
||||
|
||||
return detailSpaceList;
|
||||
}
|
||||
|
||||
public List<AttributeVo> spaceInfo(String space) {
|
||||
return graphCommonService.executeJson(NebulaUtil.showAttributeInfo(GraphShowInfo.builder()
|
||||
.attribute("space").attributeName(space).space(space).build()), AttributeVo.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.supervision.nebula.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.supervision.nebula.vo.AttributeVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author fulin
|
||||
* @since 2023/1/29 16:14
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class TaskService {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
/**
|
||||
* 每天运行一次,保证session不过期
|
||||
*
|
||||
* @author fulin 2023/1/29 16:20
|
||||
*/
|
||||
@Scheduled(cron = "0 0 23 * * ?")
|
||||
public void nebulaNotExpired() {
|
||||
graphCommonService.executeJson("SHOW SPACES;", AttributeVo.class);
|
||||
log.info("延续session不过期:{}", DateUtil.now());
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.supervision.nebula.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.supervision.nebula.dto.NebulaVertexJsonResult;
|
||||
import com.supervision.nebula.dto.graph.GraphExpand;
|
||||
import com.supervision.nebula.dto.graph.GraphSpace;
|
||||
import com.supervision.nebula.dto.graph.GraphVertexTatAttributeQuery;
|
||||
import com.supervision.nebula.dto.graph.GraphVertexTatsQuery;
|
||||
import com.supervision.nebula.util.NebulaUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Descriptin: 点实现类
|
||||
* @ClassName: VertexService
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class VertexService {
|
||||
|
||||
private final GraphCommonService graphCommonService;
|
||||
|
||||
public List<NebulaVertexJsonResult> vertexList(String space) {
|
||||
return graphCommonService.executeJson(NebulaUtil.queryMatch(space), NebulaVertexJsonResult.class);
|
||||
}
|
||||
|
||||
public List<NebulaVertexJsonResult> vertexExpandQuery(GraphExpand graphExpand) {
|
||||
String vidType = graphCommonService.getVidType(graphExpand.getSpace());
|
||||
return graphCommonService.executeJson(NebulaUtil.expandQuery(graphExpand, vidType), NebulaVertexJsonResult.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* tag查询
|
||||
*/
|
||||
public List<NebulaVertexJsonResult> vertexTagsQuery(GraphVertexTatsQuery graphVertexTatsQuery) {
|
||||
String vidType = graphCommonService.getVidType(graphVertexTatsQuery.getSpace());
|
||||
return graphCommonService.executeJson(NebulaUtil.vertexTagsQuery(graphVertexTatsQuery, vidType), NebulaVertexJsonResult.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* tag根据属性查询
|
||||
*/
|
||||
public List<NebulaVertexJsonResult> vertexTagAttributeQuery(GraphVertexTatAttributeQuery graphVertexTatAttributeQuery) {
|
||||
return graphCommonService.executeJson(NebulaUtil.vertexTagAttributeQuery(graphVertexTatAttributeQuery), NebulaVertexJsonResult.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 点分页查询
|
||||
*/
|
||||
public Map<String, Object> vertexPage(GraphVertexTatsQuery graphVertexTatsQuery) {
|
||||
List<NebulaVertexJsonResult> list;
|
||||
List<NebulaVertexJsonResult> countList;
|
||||
if (StrUtil.isNotBlank(graphVertexTatsQuery.getTag()) || ObjectUtil.isNotNull(graphVertexTatsQuery.getPointKey())) {
|
||||
String vidType = graphCommonService.getVidType(graphVertexTatsQuery.getSpace());
|
||||
list = graphCommonService.executeJson(NebulaUtil.vertexTagsQueryPage(graphVertexTatsQuery, vidType), NebulaVertexJsonResult.class);
|
||||
countList = graphCommonService.executeJson(NebulaUtil.vertexTagsQuery(graphVertexTatsQuery, vidType), NebulaVertexJsonResult.class);
|
||||
} else {
|
||||
GraphSpace graphSpace = new GraphSpace();
|
||||
BeanUtil.copyProperties(graphVertexTatsQuery, graphSpace);
|
||||
list = graphCommonService.executeJson(NebulaUtil.vertexPage(graphSpace), NebulaVertexJsonResult.class);
|
||||
countList = graphCommonService.executeJson(NebulaUtil.queryMatch(graphVertexTatsQuery.getSpace()), NebulaVertexJsonResult.class);
|
||||
}
|
||||
|
||||
int size = countList.get(0).getData().size();
|
||||
Map<String, Object> result = MapUtil.newHashMap();
|
||||
result.put("list", list);
|
||||
result.put("count", size);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机点列表
|
||||
*/
|
||||
public List<NebulaVertexJsonResult> randomList(GraphSpace graphSpace) {
|
||||
|
||||
String space = graphSpace.getSpace();
|
||||
List<NebulaVertexJsonResult> list = graphCommonService.executeJson(NebulaUtil.queryMatchLimit(space), NebulaVertexJsonResult.class);
|
||||
NebulaVertexJsonResult nebulaVertexJsonResult = list.get(0);
|
||||
List<NebulaVertexJsonResult.OneData> nebulaVertexJsonResultData = nebulaVertexJsonResult.getData();
|
||||
|
||||
nebulaVertexJsonResultData = RandomUtil.randomEleList(nebulaVertexJsonResultData, 10);
|
||||
nebulaVertexJsonResult.setData(nebulaVertexJsonResultData);
|
||||
return list;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.supervision.nebula.util;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 通用返回类
|
||||
*/
|
||||
@Data
|
||||
public class R<T> {
|
||||
// 返回体
|
||||
private Integer code;
|
||||
private String msg;
|
||||
private T data;
|
||||
|
||||
/**
|
||||
* 成功
|
||||
**/
|
||||
public static R success(Object object) {
|
||||
R result = new R();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setMsg(ResultCode.SUCCESS.getMsg());
|
||||
result.setData(object);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> R<T> data(Object object) {
|
||||
R result = new R();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setMsg(ResultCode.SUCCESS.getMsg());
|
||||
result.setData(object);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败
|
||||
**/
|
||||
public R fail(Object object) {
|
||||
R result = new R();
|
||||
result.setCode(ResultCode.FAIL.getCode());
|
||||
result.setMsg(ResultCode.FAIL.getMsg());
|
||||
result.setData(object);
|
||||
return result;
|
||||
}
|
||||
|
||||
public R result(Integer code, String msg, Object object) {
|
||||
R result = new R();
|
||||
result.setCode(code);
|
||||
result.setMsg(msg);
|
||||
result.setData(object);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.supervision.nebula.util;
|
||||
|
||||
/**
|
||||
* @Descriptin:
|
||||
* @ClassName: ResultCode
|
||||
*/
|
||||
|
||||
/**
|
||||
* 通用返回状态码
|
||||
*/
|
||||
public enum ResultCode {
|
||||
SUCCESS(10000, "成功"),
|
||||
FAIL(1, "失败"),
|
||||
UNKNOWN_ERROR(-1, "未知错误"),
|
||||
NO_DATA(10001, "暂无数据");
|
||||
|
||||
private final Integer code;
|
||||
private final String msg;
|
||||
|
||||
ResultCode(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.supervision.nebula.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Descriptin: 11
|
||||
* @ClassName: aaa
|
||||
*/
|
||||
@ApiModel("属性查询返回类")
|
||||
public class AttributeVo {
|
||||
|
||||
/**
|
||||
* spaceName : flceshi
|
||||
* latencyInUs : 1986
|
||||
* data : [{"meta":[""],"row":["basketballplayer"]},{"meta":[""],"row":["demo_lw"]},{"meta":[""],"row":["flceshi"]},{"meta":[""],"row":["lubrication_faultId_detection"]},{"meta":[""],"row":["lubrication_faultId_detection_sample"]},{"meta":[""],"row":["wentao_teatSpace"]},{"meta":[""],"row":["电影"]}]
|
||||
* columns : ["Name"]
|
||||
* errors : {"code":0}
|
||||
*/
|
||||
|
||||
@ApiModelProperty("空间名称")
|
||||
private String spaceName;
|
||||
@ApiModelProperty()
|
||||
private int latencyInUs;
|
||||
private ErrorsBean errors;
|
||||
@ApiModelProperty("查询返回属性集合")
|
||||
private List<DataBean> data;
|
||||
@ApiModelProperty("返回字段名集合")
|
||||
private List<String> columns;
|
||||
private Map<String, List<String>> fieldMap;
|
||||
|
||||
public String getSpaceName() {
|
||||
return spaceName;
|
||||
}
|
||||
|
||||
public void setSpaceName(String spaceName) {
|
||||
this.spaceName = spaceName;
|
||||
}
|
||||
|
||||
public int getLatencyInUs() {
|
||||
return latencyInUs;
|
||||
}
|
||||
|
||||
public void setLatencyInUs(int latencyInUs) {
|
||||
this.latencyInUs = latencyInUs;
|
||||
}
|
||||
|
||||
public ErrorsBean getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
public void setErrors(ErrorsBean errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public List<String> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public void setColumns(List<String> columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getFieldMap() {
|
||||
return fieldMap;
|
||||
}
|
||||
|
||||
public void setFieldMap(Map<String, List<String>> fieldMap) {
|
||||
this.fieldMap = fieldMap;
|
||||
}
|
||||
|
||||
public static class ErrorsBean {
|
||||
/**
|
||||
* code : 0
|
||||
*/
|
||||
@ApiModelProperty("错误码0正常")
|
||||
private int code;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
@ApiModelProperty("元数据")
|
||||
private List<String> meta;
|
||||
@ApiModelProperty("字段值集合")
|
||||
private List<String> row;
|
||||
|
||||
public List<String> getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setMeta(List<String> meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public List<String> getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public void setRow(List<String> row) {
|
||||
this.row = row;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.supervision.nebula.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Descriptin: 通用返回类
|
||||
* @ClassName: CommonVo
|
||||
*/
|
||||
@ApiModel("操作通用返回类")
|
||||
public class CommonVo {
|
||||
|
||||
/**
|
||||
* spaceName : flceshi
|
||||
* latencyInUs : 2305
|
||||
* errors : {"code":0}
|
||||
*/
|
||||
|
||||
@ApiModelProperty("空间名称")
|
||||
private String spaceName;
|
||||
@ApiModelProperty()
|
||||
private int latencyInUs;
|
||||
private ErrorsBean errors;
|
||||
|
||||
public String getSpaceName() {
|
||||
return spaceName;
|
||||
}
|
||||
|
||||
public void setSpaceName(String spaceName) {
|
||||
this.spaceName = spaceName;
|
||||
}
|
||||
|
||||
public int getLatencyInUs() {
|
||||
return latencyInUs;
|
||||
}
|
||||
|
||||
public void setLatencyInUs(int latencyInUs) {
|
||||
this.latencyInUs = latencyInUs;
|
||||
}
|
||||
|
||||
public ErrorsBean getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
public void setErrors(ErrorsBean errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
public static class ErrorsBean {
|
||||
/**
|
||||
* code : 0
|
||||
*/
|
||||
@ApiModelProperty("错误码0正常")
|
||||
private int code;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.supervision.nebula.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Descriptin: 图空间详情
|
||||
* @ClassName: DetailSpace
|
||||
*/
|
||||
@ApiModel("图空间详情实体")
|
||||
@Data
|
||||
public class DetailSpace {
|
||||
|
||||
@ApiModelProperty("空间名称")
|
||||
private String space;
|
||||
|
||||
@ApiModelProperty("标签个数")
|
||||
private Integer tagsNum;
|
||||
|
||||
@ApiModelProperty("边类型个数")
|
||||
private Integer edgesNum;
|
||||
|
||||
//@ApiModelProperty("空间备注")
|
||||
//private String spaceComment;
|
||||
|
||||
}
|
@ -1,10 +1,8 @@
|
||||
package com.supervision.config;
|
||||
package com.supervision.neo4j.config;
|
||||
|
||||
import org.neo4j.driver.AuthTokens;
|
||||
import org.neo4j.driver.Driver;
|
||||
import org.neo4j.driver.GraphDatabase;
|
||||
|
||||
import org.neo4j.ogm.session.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
@ -1,9 +1,7 @@
|
||||
package com.supervision.controller;
|
||||
package com.supervision.neo4j.controller;
|
||||
|
||||
|
||||
import com.supervision.node.DiseaseNode;
|
||||
import com.supervision.repo.DiseaseRepository;
|
||||
import com.supervision.service.GraphService;
|
||||
import com.supervision.neo4j.service.GraphService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
@ -1,4 +1,4 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
import org.neo4j.ogm.annotation.*;
|
@ -1,9 +1,10 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
import org.neo4j.ogm.annotation.*;
|
||||
|
||||
import java.util.Set;
|
||||
import org.neo4j.ogm.annotation.GeneratedValue;
|
||||
import org.neo4j.ogm.annotation.Id;
|
||||
import org.neo4j.ogm.annotation.NodeEntity;
|
||||
import org.neo4j.ogm.annotation.Property;
|
||||
|
||||
@Data
|
||||
@NodeEntity("疾病分类名称")
|
@ -1,7 +1,6 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
import org.neo4j.ogm.annotation.NodeEntity;
|
||||
import org.neo4j.ogm.annotation.*;
|
||||
|
||||
import java.util.HashSet;
|
@ -1,7 +1,10 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
import org.neo4j.ogm.annotation.*;
|
||||
import org.neo4j.ogm.annotation.GeneratedValue;
|
||||
import org.neo4j.ogm.annotation.Id;
|
||||
import org.neo4j.ogm.annotation.NodeEntity;
|
||||
import org.neo4j.ogm.annotation.Property;
|
||||
|
||||
|
||||
@NodeEntity("药品")
|
@ -1,7 +1,10 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
import org.neo4j.ogm.annotation.*;
|
||||
import org.neo4j.ogm.annotation.GeneratedValue;
|
||||
import org.neo4j.ogm.annotation.Id;
|
||||
import org.neo4j.ogm.annotation.NodeEntity;
|
||||
import org.neo4j.ogm.annotation.Property;
|
||||
|
||||
@NodeEntity("知识库")
|
||||
@Data
|
@ -1,9 +1,8 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
import org.neo4j.ogm.annotation.*;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.neo4j.ogm.annotation.*;
|
||||
import org.neo4j.ogm.annotation.GeneratedValue;
|
||||
import org.neo4j.ogm.annotation.Id;
|
||||
import org.neo4j.ogm.annotation.NodeEntity;
|
||||
import org.neo4j.ogm.annotation.Property;
|
||||
|
||||
@Data
|
||||
@NodeEntity("体格检查工具")
|
@ -1,4 +1,4 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
import org.neo4j.ogm.annotation.*;
|
@ -1,4 +1,4 @@
|
||||
package com.supervision.node;
|
||||
package com.supervision.neo4j.node;
|
||||
|
||||
import lombok.Data;
|
||||
import org.neo4j.ogm.annotation.*;
|
@ -1,6 +1,6 @@
|
||||
package com.supervision.repo;
|
||||
package com.supervision.neo4j.repo;
|
||||
|
||||
import com.supervision.node.AncillaryNode;
|
||||
import com.supervision.neo4j.node.AncillaryNode;
|
||||
import org.springframework.data.neo4j.repository.Neo4jRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.supervision.repo;
|
||||
package com.supervision.neo4j.repo;
|
||||
|
||||
import com.supervision.node.DiseaseNode;
|
||||
import com.supervision.neo4j.node.DiseaseNode;
|
||||
import org.springframework.data.neo4j.repository.Neo4jRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.supervision.repo;
|
||||
package com.supervision.neo4j.repo;
|
||||
|
||||
import com.supervision.node.DiseaseNode;
|
||||
import com.supervision.node.KnowledgeBaseNode;
|
||||
import com.supervision.neo4j.node.KnowledgeBaseNode;
|
||||
import org.springframework.data.neo4j.repository.Neo4jRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.supervision.repo;
|
||||
package com.supervision.neo4j.repo;
|
||||
|
||||
import com.supervision.node.AncillaryNode;
|
||||
import com.supervision.node.PhysicalNode;
|
||||
import com.supervision.neo4j.node.PhysicalNode;
|
||||
import org.springframework.data.neo4j.repository.Neo4jRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.supervision.repo;
|
||||
package com.supervision.neo4j.repo;
|
||||
|
||||
import com.supervision.node.KnowledgeBaseNode;
|
||||
import com.supervision.node.PhysicalToolNode;
|
||||
import com.supervision.neo4j.node.PhysicalToolNode;
|
||||
import org.springframework.data.neo4j.repository.Neo4jRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.supervision.repo;
|
||||
package com.supervision.neo4j.repo;
|
||||
|
||||
import com.supervision.node.ProcessNode;
|
||||
import com.supervision.neo4j.node.ProcessNode;
|
||||
import org.springframework.data.neo4j.repository.Neo4jRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.supervision.repo;
|
||||
package com.supervision.neo4j.repo;
|
||||
|
||||
import com.supervision.node.ProcessNode;
|
||||
import com.supervision.node.TreatmentPlanNode;
|
||||
import com.supervision.neo4j.node.TreatmentPlanNode;
|
||||
import org.springframework.data.neo4j.repository.Neo4jRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.supervision.service;
|
||||
package com.supervision.neo4j.service;
|
||||
|
||||
public interface GraphService {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue