Commit 3a606bdc authored by zhengfunan's avatar zhengfunan

stater版首次提交

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