集成知识图谱到项目中

dev_2.1.0
liu 1 year ago
parent f568a6acfc
commit a053f31c92

@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication @SpringBootApplication
@MapperScan(basePackages = {"com.supervision.**.mapper"}) @MapperScan(basePackages = {"com.supervision.**.mapper"})
@EnableNeo4jRepositories("com.**.repo") @EnableNeo4jRepositories("com.**.repo")

@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -19,7 +20,6 @@ import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Descriptin: * @Descriptin:
@ -161,9 +161,9 @@ public class AttributeService {
if (StrUtil.isNotBlank(substring)) { if (StrUtil.isNotBlank(substring)) {
String replaceAll = substring.replace("=", ":"); String replaceAll = substring.replace("=", ":");
String result = "{" + replaceAll + "}"; String result = "{" + replaceAll + "}";
Map map = JSONUtil.toBean(JSONUtil.toJsonStr(result), Map.class); JSONObject entries = JSONUtil.parseObj(JSONUtil.toJsonStr(result));
if (map.containsKey("comment")) { if (entries.containsKey("comment")) {
Object comment = map.get("comment"); Object comment = entries.get("comment");
datum.getRow().add(comment.toString()); datum.getRow().add(comment.toString());
} else { } else {
datum.getRow().add(""); datum.getRow().add("");

@ -9,7 +9,7 @@ import com.supervision.nebula.util.NebulaUtil;
import com.supervision.nebula.vo.AttributeVo; import com.supervision.nebula.vo.AttributeVo;
import com.supervision.nebula.vo.CommonVo; import com.supervision.nebula.vo.CommonVo;
import com.supervision.nebula.vo.DetailSpace; import com.supervision.nebula.vo.DetailSpace;
import org.springframework.beans.factory.annotation.Autowired; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -19,14 +19,13 @@ import java.util.List;
* @ClassName: SpaceService * @ClassName: SpaceService
*/ */
@Service @Service
@RequiredArgsConstructor
public class SpaceService { public class SpaceService {
@Autowired private final GraphCommonService graphCommonService;
GraphCommonService graphCommonService;
public List<CommonVo> createSpace(GraphCreateSpace graphCreateSpace) { public List<CommonVo> createSpace(GraphCreateSpace graphCreateSpace) {
List list = graphCommonService.executeJson(NebulaUtil.createSpace(graphCreateSpace), CommonVo.class); return graphCommonService.executeJson(NebulaUtil.createSpace(graphCreateSpace), CommonVo.class);
return list;
} }
public List<DetailSpace> detailSpace(GraphShowAttribute graphShowAttribute) { public List<DetailSpace> detailSpace(GraphShowAttribute graphShowAttribute) {
@ -41,9 +40,8 @@ public class SpaceService {
for (AttributeVo.DataBean datum : attributeVo1.getData()) { for (AttributeVo.DataBean datum : attributeVo1.getData()) {
int tagsNum = 0; int tagsNum = 0;
int edgesNum = 0; int edgesNum = 0;
int tag = 0;
detailSpace = new DetailSpace(); detailSpace = new DetailSpace();
// 查询tgas/edges // 查询tags/edges
String spaceName = datum.getRow().get(0); String spaceName = datum.getRow().get(0);
graphShowAttribute.setSpace(spaceName); graphShowAttribute.setSpace(spaceName);
graphShowAttribute.setAttribute(AttributeEnum.TAGS.name()); graphShowAttribute.setAttribute(AttributeEnum.TAGS.name());

@ -2,9 +2,8 @@ package com.supervision.nebula.service;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.supervision.nebula.vo.AttributeVo; import com.supervision.nebula.vo.AttributeVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -13,12 +12,11 @@ import org.springframework.stereotype.Component;
* @since 2023/1/29 16:14 * @since 2023/1/29 16:14
*/ */
@Component @Component
@EnableScheduling
@Slf4j @Slf4j
@RequiredArgsConstructor
public class TaskService { public class TaskService {
@Autowired private final GraphCommonService graphCommonService;
GraphCommonService graphCommonService;
/** /**
* ,session * ,session

@ -11,8 +11,8 @@ import com.supervision.nebula.dto.graph.GraphSpace;
import com.supervision.nebula.dto.graph.GraphVertexTatAttributeQuery; import com.supervision.nebula.dto.graph.GraphVertexTatAttributeQuery;
import com.supervision.nebula.dto.graph.GraphVertexTatsQuery; import com.supervision.nebula.dto.graph.GraphVertexTatsQuery;
import com.supervision.nebula.util.NebulaUtil; import com.supervision.nebula.util.NebulaUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -24,10 +24,10 @@ import java.util.Map;
*/ */
@Service @Service
@Slf4j @Slf4j
@RequiredArgsConstructor
public class VertexService { public class VertexService {
@Autowired private final GraphCommonService graphCommonService;
GraphCommonService graphCommonService;
public List<NebulaVertexJsonResult> vertexList(String space) { public List<NebulaVertexJsonResult> vertexList(String space) {
return graphCommonService.executeJson(NebulaUtil.queryMatch(space), NebulaVertexJsonResult.class); return graphCommonService.executeJson(NebulaUtil.queryMatch(space), NebulaVertexJsonResult.class);
@ -40,9 +40,6 @@ public class VertexService {
/** /**
* tag * tag
*
* @param graphVertexTatsQuery
* @return
*/ */
public List<NebulaVertexJsonResult> vertexTagsQuery(GraphVertexTatsQuery graphVertexTatsQuery) { public List<NebulaVertexJsonResult> vertexTagsQuery(GraphVertexTatsQuery graphVertexTatsQuery) {
String vidType = graphCommonService.getVidType(graphVertexTatsQuery.getSpace()); String vidType = graphCommonService.getVidType(graphVertexTatsQuery.getSpace());
@ -51,9 +48,6 @@ public class VertexService {
/** /**
* tag * tag
*
* @param graphVertexTatAttributeQuery
* @return
*/ */
public List<NebulaVertexJsonResult> vertexTagAttributeQuery(GraphVertexTatAttributeQuery graphVertexTatAttributeQuery) { public List<NebulaVertexJsonResult> vertexTagAttributeQuery(GraphVertexTatAttributeQuery graphVertexTatAttributeQuery) {
return graphCommonService.executeJson(NebulaUtil.vertexTagAttributeQuery(graphVertexTatAttributeQuery), NebulaVertexJsonResult.class); return graphCommonService.executeJson(NebulaUtil.vertexTagAttributeQuery(graphVertexTatAttributeQuery), NebulaVertexJsonResult.class);
@ -61,9 +55,6 @@ public class VertexService {
/** /**
* *
*
* @param graphVertexTatsQuery
* @return
*/ */
public Map<String, Object> vertexPage(GraphVertexTatsQuery graphVertexTatsQuery) { public Map<String, Object> vertexPage(GraphVertexTatsQuery graphVertexTatsQuery) {
List<NebulaVertexJsonResult> list; List<NebulaVertexJsonResult> list;
@ -88,9 +79,6 @@ public class VertexService {
/** /**
* *
*
* @param graphSpace
* @return
*/ */
public List<NebulaVertexJsonResult> randomList(GraphSpace graphSpace) { public List<NebulaVertexJsonResult> randomList(GraphSpace graphSpace) {

Loading…
Cancel
Save