Commit 3a606bdc authored by zhengfunan's avatar zhengfunan

stater版首次提交

parent 94a59521
......@@ -4,21 +4,12 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="67e936c8-2d55-4655-871e-e6e153e4d8e1" name="更改" comment="">
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/auto/Neo4jAutoConfiguration.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/config/Neo4jProperties.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/neo4j/Neo4jServer.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/service/TDGraphService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/tasks/SynchronizeMetadata.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/util/GraphUtil.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/META-INF/spring.factories" afterDir="false" />
<list default="true" id="67e936c8-2d55-4655-871e-e6e153e4d8e1" name="更改" comment="stater版首次提交">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/auto/Neo4jAutoConfiguration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/auto/Neo4jAutoConfiguration.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/neo4j/Neo4jServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/neo4j/Neo4jServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/service/TDGraphService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/tongda/tddopo/service/TDGraphService.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -51,21 +42,21 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"WebServerToolWindowFactoryState": "false",
"last_opened_file_path": "D:/ideawork/stater-tdtopo",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"spring.configuration.checksum": "35834eaec7657be6760ebdbe364857eb",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/ideawork/stater-tdtopo&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;spring.configuration.checksum&quot;: &quot;66a313bcaa5305b53f5d76da6e2b169a&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}]]></component>
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\ideawork\stater-tddopo\src\main\java\com\tongda\tddopo" />
......@@ -106,11 +97,25 @@
<updated>1693299583537</updated>
<workItem from="1693299584659" duration="7284000" />
<workItem from="1693363826067" duration="10263000" />
<workItem from="1693386223381" duration="1313000" />
<workItem from="1693386223381" duration="3004000" />
<workItem from="1693447950473" duration="11267000" />
<workItem from="1693536669710" duration="3343000" />
</task>
<task id="LOCAL-00001" summary="stater版首次提交">
<created>1693387558801</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1693387558801</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="stater版首次提交" />
<option name="LAST_COMMIT_MESSAGE" value="stater版首次提交" />
</component>
</project>
\ No newline at end of file
......@@ -36,6 +36,13 @@
<version>3.5.30</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.neo4j</groupId>-->
<!-- <artifactId>neo4j-bolt</artifactId>-->
<!-- &lt;!&ndash; <version>5.9.0</version>&ndash;&gt;-->
<!-- <version>3.5.30</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
......@@ -51,6 +58,4 @@
</dependencies>
</project>
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.tongda.tddopo.auto;
import com.tongda.tddopo.config.Neo4jProperties;
import com.tongda.tddopo.neo4j.Neo4jServer;
import com.tongda.tddopo.service.TDGraphService;
import org.neo4j.graphdb.GraphDatabaseService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
......@@ -23,6 +24,8 @@ public class Neo4jAutoConfiguration {
//初始化neo4j
GraphDatabaseService graphDatabaseService=new Neo4jServer().init(properties.getPath(),properties.getBolt());
System.out.println("neo4j-server启动成功");
TDGraphService tdGraphService=new TDGraphService();
System.out.println(tdGraphService.searchRelationType());
return graphDatabaseService;
}
......
package com.tongda.tddopo.neo4j;
import org.neo4j.graphdb.ConstraintViolationException;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.Transaction;
......@@ -28,7 +29,7 @@ public class Neo4jServer {
// @PostConstruct
public GraphDatabaseService init(String file,String bolt){
// GraphDatabaseSettings.BoltConnector boltConnector = GraphDatabaseSettings.boltConnector( "0" );
GraphDatabaseSettings.BoltConnector boltConnector = GraphDatabaseSettings.boltConnector( "0" );
graphDatabaseService = new GraphDatabaseFactory()
.newEmbeddedDatabaseBuilder(new File(file))
......@@ -42,14 +43,16 @@ public class Neo4jServer {
IndexDefinition indexDefinition;
try ( Transaction tx = graphDatabaseService.beginTx() )
{
// Schema schema = graphDatabaseService.schema();
// indexDefinition = schema.indexFor( Label.label( "MDE" ))
// .on( "id" )
// .create();
// indexDefinition = schema.indexFor( Label.label( "AST" ))
// .on( "id" )
// .create();
Schema schema = graphDatabaseService.schema();
indexDefinition = schema.indexFor( Label.label( "MDE" ))
.on( "id" )
.create();
indexDefinition = schema.indexFor( Label.label( "AST" ))
.on( "id" )
.create();
tx.success();
}catch (ConstraintViolationException e){
System.out.println("index 已经建立");
}
return graphDatabaseService;
}
......
......@@ -11,11 +11,13 @@ import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.neo4j.graphdb.*;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.*;
@Service
public class TDGraphService {
GraphDatabaseService graphDb= Neo4jServer.graphDatabaseService;
......@@ -42,6 +44,7 @@ public class TDGraphService {
long totalMilliSeconds1 = System.currentTimeMillis();
try(Transaction transaction = graphDb.beginTx()) {
//解析XML数据
SAXReader saxReader = new SAXReader();
Document document = saxReader.read(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
......@@ -232,6 +235,7 @@ public class TDGraphService {
return true;
}
/**
* 只更新节点node
* @param xml
......
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