소스 검색

图谱关系增加字段

yuchengwei 5 달 전
부모
커밋
16a70c6003

+ 2 - 2
src/main/java/com/qizhen/healsphere/facade/KgFacade.java

@@ -69,7 +69,7 @@ public class KgFacade extends KgServiceImpl {
                     GNodeDTO nNodeDTO
                             = new GNodeDTO("", 1, "", nodeId, "diamond", 10,graphDTO.getProperties(),graphDTO.getId());
                     node.add(nNodeDTO);
-                    links.add(new LinkDTO(gNodeDTO.getName(), nNodeDTO.getName(), baseNodeRSDTO.getRType()));
+                    links.add(new LinkDTO(gNodeDTO.getName(), nNodeDTO.getName(), baseNodeRSDTO.getRType(),baseNodeRSDTO.getRType()));
                     nodeId++;
                     if (CollUtil.isNotEmpty(baseNodeRSDTO.getENodeDTOS())) {
                         for (NextNodeDTO baseNodeDTO : baseNodeRSDTO.getENodeDTOS()) {
@@ -82,7 +82,7 @@ public class KgFacade extends KgServiceImpl {
                                     baseNodeDTO.getName(), nodeId, symbol, 28, baseNodeDTO.getProperties(),baseNodeDTO.getId());
                             nodeId++;
                             node.add(eNodeDTO);
-                            links.add(new LinkDTO(nNodeDTO.getName(), eNodeDTO.getName(), ""));
+                            links.add(new LinkDTO(nNodeDTO.getName(), eNodeDTO.getName(), "",baseNodeRSDTO.getRType()));
                         }
                     }
                 }

+ 3 - 1
src/main/java/com/qizhen/healsphere/web/dto/LinkDTO.java

@@ -14,10 +14,12 @@ public class LinkDTO {
     private Long source;
     private Long target;
     private String value;
+    private String relationShipType;
 
-    public LinkDTO(Long source, Long target, String value) {
+    public LinkDTO(Long source, Long target, String value,String relationShipType) {
         this.source = source;
         this.target = target;
         this.value = value;
+        this.relationShipType = relationShipType;
     }
 }

+ 2 - 2
src/test/java/com/qizhen/healsphere/DiseaseTests.java

@@ -81,11 +81,11 @@ public class DiseaseTests {
         map.put("描述","这是疾病和症状的关系");
 
 
-        baseRelationshipRepository.createRelationship(startLabel,startId,endLabel,endId,relationShipType,map);
+//        baseRelationshipRepository.createRelationship(startLabel,startId,endLabel,endId,relationShipType,map);
 
 
 //        baseRelationshipRepository.deleteRelationship(startLabel,startId,endLabel,endId,relationShipType);
-        List<String> relationshipNames = baseRelationshipRepository.findRelationshipNames("主要");
+        List<String> relationshipNames = baseRelationshipRepository.findRelationshipNames("疾病");
         System.out.println(JSONUtil.toJsonStr(relationshipNames));
 
 //        baseRelationshipRepository.updateRelationship("疾病症状之间的关系111","疾病症状之间的关系222333");