Commit c5d98f29 by qiuchaofei

1.修改同步节点的方法,2去掉system.out的打印。3.同步过程中在map中移除已经存在的节点。

parent 5f373286
......@@ -52,7 +52,18 @@
<artifactId>neo4j-ogm-http-driver</artifactId>
<version>3.0.0</version>
</dependency>
<!-- add this dependency if you want to use the embedded driver -->
<!-- add this dependency if you want to use the embedded driver
<dependency>
<groupId>com.steelbridgelabs.oss</groupId>
<artifactId>neo4j-gremlin-bolt</artifactId>
<version>0.3.1</version>
</dependency>
-->
<dependency> <!-- If you're using the Bolt driver -->
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-bolt-driver</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-embedded-driver</artifactId>
......@@ -99,11 +110,7 @@
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<dependency>
<groupId>com.steelbridgelabs.oss</groupId>
<artifactId>neo4j-gremlin-bolt</artifactId>
<version>0.3.1</version>
</dependency>
<dependency>
......
......@@ -305,7 +305,7 @@ public class RelationalGraphController {
@RequestMapping(path = "/getIp", method = RequestMethod.GET)
public String getIp(Integer numbers) {
String ip = getIp();
System.out.println("请求的ip是:"+ip);
// System.out.println("请求的ip是:"+ip);
return ip;
}
......
......@@ -93,7 +93,7 @@ public class AsyncDataFromMongoToNeo4j {
metadataService.deleteTempNodeByCatalogName(catalogName);
metadataService.createTempNode(catalogName);
long end = System.currentTimeMillis();
logger.info("同步数据完成,用时:"+(end-start));
logger.info("同步数据完成,总共用时:"+(end-start));
}
@Async
public void asyncJobFromMongo2Neo4j(String catalogName,String jobId) {
......@@ -101,7 +101,7 @@ public class AsyncDataFromMongoToNeo4j {
CompletableFuture<String> future = asyncRelation.asyncJobFromMongo2Neo4j(catalogName, jobId);
try {
String message = future.get();
System.out.println("message:"+message);
// System.out.println("message:"+message);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
......@@ -111,7 +111,7 @@ public class AsyncDataFromMongoToNeo4j {
//先按照环境id,作业id,删除关系,然后同步关系,
// 一般来说,关系的字段已经存在neo4j,但是sql不一定存在,
// 如果sql不存在,需要先同步sql ,srcipt,job,再建立关系。
// metadataRelationService.deleteRelationByJobId(catalogName,jobId);
// metadataRelationService.syschroRelationFromMongo(catalogName,jobId);
metadataRelationService.deleteRelationByJobId(catalogName,jobId);
metadataRelationService.syschroRelationFromMongo(catalogName,jobId);
}
}
......@@ -52,7 +52,7 @@ public class BaseRelationshipServiceImpl implements IBaseRelationshipService {
List<BaseRelationship> baseRelationshipList = new ArrayList<>();
for (CompositionRelation compositionRelation : compositionRelationList) {
System.out.println("compositionRelation:"+compositionRelation);
// System.out.println("compositionRelation:"+compositionRelation);
if(compositionRelation == null){
continue;
}
......
......@@ -400,7 +400,7 @@ public class MetadataRelationServiceImpl implements IMetadataRelationService {
// Driver neo4jConnection = neo4jConfig.getNeo4jConnection();
// Session session = neo4jConnection.session();
String cypher = "match (n)-[r:`流向`]-(m) where r.jobId ="+jobId +" delete r";
String cypher = "match (n)-[r:`流向`]-(m) where r.jobId =\""+jobId +"\" delete r";
logger.info("删除数据的语句:"+cypher);
StatementResult statementResult = session.run(cypher);
while (statementResult.hasNext()){
......
......@@ -382,7 +382,7 @@ public class MultiModelServiceImpl implements MultiModelService {
for(Object obj : objectMap.keySet()){
if(obj.equals("name")){
System.out.println("obj :"+ obj + " value :"+ objectMap.get("name"));
// System.out.println("obj :"+ obj + " value :"+ objectMap.get("name"));
}
}
}
......
......@@ -313,7 +313,7 @@ public class SchemaServiceImpl implements ISchemaService {
int pageSize = 100;
int page = jdcount/pageSize;
for(int i=0;i<page+1;i++){
detailCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jTable) return m.metadataId as id skip "+(page*pageSize ) +" limit "+ pageSize;
detailCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jTable) return m.metadataId as id skip "+(i*pageSize ) +" limit "+ pageSize;
StatementResult detailResult = session.run(detailCypher);
while (detailResult.hasNext()){
Record record = detailResult.next();
......
......@@ -596,12 +596,12 @@ public class TableServiceImpl implements ITableService {
ReturnEdge returnEdge = returnEdgeMap.get(obj);
returnReslult.getEdges().add(returnEdge);
}
System.out.println("查询run次数:"+runCypherCount +" , 时间:"+runCypherTime);
// System.out.println("查询run次数:"+runCypherCount +" , 时间:"+runCypherTime);
System.out.println("查询respossitory次数:"+respossitoryCount +" , 时间:"+respossitoryTime);
// System.out.println("查询respossitory次数:"+respossitoryCount +" , 时间:"+respossitoryTime);
long timeEnd = System.currentTimeMillis();
System.out.println("总耗时:"+(timeEnd-timeStart));
// System.out.println("总耗时:"+(timeEnd-timeStart));
return returnReslult;
}
......
......@@ -29,7 +29,7 @@ public class Neo4jTool {
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("transMap2Bean Error " + e);
// System.out.println("transMap2Bean Error " + e);
}
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment