我正在尝试探索wordnet,并希望将其导入neo4j,因为:
我的问题是我是一名javascript开发人员,并且没有看到如何使用node.js做任何建议。我已经找到了一些java资源,但是我对java的经验非常生疏,而且非常缺乏,所以我发现的一些指南和论文在实现方面已经超出了我的想法。我确实找到了这个piece of code,它旨在从文件here加载。我加载了eclipse并从maven导入了正确的依赖项(我认为)并尝试运行它,但是继续得到NoClassDefFoundError,我无法根源。
有没有人尝试使用此代码并且最近取得了成功,或者有人可以推荐另一种方法将Word加载到neo4j中?
11:08:52.835 [main] WARN o.neo4j.kernel.EmbeddedGraphDatabase - You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.
java.lang.NoClassDefFoundError: org/openrdf/model/impl/SimpleValueFactory
at org.openrdf.rio.RDFFormat.<clinit>(RDFFormat.java:97)
at com.tinkerpop.blueprints.oupls.sail.GraphSail.<init>(GraphSail.java:109)
at WordnetLoader.load(WordnetLoader.java:42)
at WordnetLoader.main(WordnetLoader.java:30)
Caused by: java.lang.ClassNotFoundException: org.openrdf.model.impl.SimpleValueFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
编辑:Jan建议我添加sesame运行时依赖项(请参阅注释)。显示新错误(下次编辑时删除了错误)
编辑:我收到了其他错误,Jan建议尝试使用lucene 3.6而不是我运行的新版本。在更新我的依赖项后,似乎应用程序能够运行,但它确实错误地说它无法正确访问rdf文件中的数据。loading file: C:\Users\Dhirj\Documents\Neo4j\wordnet\basic-partial.ttl.gz
org.openrdf.rio.RDFHandlerException: org.openrdf.sail.SailException: No active transaction
finished in 10ms
loading file: C:\Users\Dhirj\Documents\Neo4j\wordnet\Manifest.ttl
at org.example.WordnetLoader$SailConnectionAdder.handleNamespace(WordnetLoader.java:116)
at org.openrdf.rio.turtle.TurtleParser.parsePrefixID(TurtleParser.java:361)
at org.openrdf.rio.turtle.TurtleParser.parseDirective(TurtleParser.java:272)
at org.openrdf.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:250)
at org.openrdf.rio.turtle.TurtleParser.parse(TurtleParser.java:214)
at org.openrdf.rio.turtle.TurtleParser.parse(TurtleParser.java:158)
at org.example.WordnetLoader.load(WordnetLoader.java:70)
at org.example.WordnetLoader.main(WordnetLoader.java:32)
Caused by: org.openrdf.sail.SailException: No active transaction
at org.openrdf.sail.helpers.SailConnectionBase.verifyIsActive(SailConnectionBase.java:162)
at org.openrdf.sail.helpers.SailConnectionBase.setNamespace(SailConnectionBase.java:709)
at org.example.WordnetLoader$SailConnectionAdder.handleNamespace(WordnetLoader.java:114)
... 7 more
org.openrdf.rio.RDFParseException: Expected ':', found 'h' [line 1]
at org.openrdf.rio.helpers.RDFParserHelper.reportFatalError(RDFParserHelper.java:440)
at org.openrdf.rio.helpers.RDFParserBase.reportFatalError(RDFParserBase.java:685)
at org.openrdf.rio.turtle.TurtleParser.reportFatalError(TurtleParser.java:1405)
at org.openrdf.rio.turtle.TurtleParser.verifyCharacterOrFail(TurtleParser.java:1227)
at org.openrdf.rio.turtle.TurtleParser.parsePrefixID(TurtleParser.java:347)
at org.openrdf.rio.turtle.TurtleParser.parseDirective(TurtleParser.java:272)
at org.openrdf.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:250)
at org.openrdf.rio.turtle.TurtleParser.parse(TurtleParser.java:214)
at org.openrdf.rio.turtle.TurtleParser.parse(TurtleParser.java:158)
at org.example.WordnetLoader.load(WordnetLoader.java:70)
at org.example.WordnetLoader.main(WordnetLoader.java:32)
finished in 2ms
loading file: C:\Users\Dhirj\Documents\Neo4j\wordnet\neo
loading file: C:\Users\Dhirj\Documents\Neo4j\wordnet\void.ttl
org.openrdf.rio.RDFHandlerException: org.openrdf.sail.SailException: No active transaction
at org.example.WordnetLoader$SailConnectionAdder.handleNamespace(WordnetLoader.java:116)
at org.openrdf.rio.turtle.TurtleParser.parsePrefixID(TurtleParser.java:361)
at org.openrdf.rio.turtle.TurtleParser.parseDirective(TurtleParser.java:272)
at org.openrdf.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:250)
at org.openrdf.rio.turtle.TurtleParser.parse(TurtleParser.java:214)
at org.openrdf.rio.turtle.TurtleParser.parse(TurtleParser.java:158)
at org.example.WordnetLoader.load(WordnetLoader.java:70)
at org.example.WordnetLoader.main(WordnetLoader.java:32)
Caused by: org.openrdf.sail.SailException: No active transaction
at org.openrdf.sail.helpers.SailConnectionBase.verifyIsActive(SailConnectionBase.java:162)
at org.openrdf.sail.helpers.SailConnectionBase.setNamespace(SailConnectionBase.java:709)
at org.example.WordnetLoader$SailConnectionAdder.handleNamespace(WordnetLoader.java:114)
... 7 more
finished in 1ms
loading file: C:\Users\Dhirj\Documents\Neo4j\wordnet\wn31.nt.gz
loading file: C:\Users\Dhirj\Documents\Neo4j\wordnet\wnbasic-schema.ttl.gz
org.openrdf.rio.RDFHandlerException: org.openrdf.sail.SailException: No active transaction
at org.example.WordnetLoader$SailConnectionAdder.handleNamespace(WordnetLoader.java:116)
at org.openrdf.rio.turtle.TurtleParser.parsePrefixID(TurtleParser.java:361)
at org.openrdf.rio.turtle.TurtleParser.parseDirective(TurtleParser.java:272)
at org.openrdf.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:250)
at org.openrdf.rio.turtle.TurtleParser.parse(TurtleParser.java:214)
at org.openrdf.rio.turtle.TurtleParser.parse(TurtleParser.java:158)
at org.example.WordnetLoader.load(WordnetLoader.java:70)
at org.example.WordnetLoader.main(WordnetLoader.java:32)
Caused by: org.openrdf.sail.SailException: No active transaction
at org.openrdf.sail.helpers.SailConnectionBase.verifyIsActive(SailConnectionBase.java:162)
at org.openrdf.sail.helpers.SailConnectionBase.setNamespace(SailConnectionBase.java:709)
at org.example.WordnetLoader$SailConnectionAdder.handleNamespace(WordnetLoader.java:114)
... 7 more
finished in 1ms
我目前的maven版本如下所示:
C:\...\.m2\repository\org\openrdf\sesame\sesame-runtime\2.8.6\sesame-runtime-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-model\2.8.6\sesame-model-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-repository-api\2.8.6\sesame-repository-api-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-query\2.8.6\sesame-query-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-repository-manager\2.8.6\sesame-repository-manager-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-repository-event\2.8.6\sesame-repository-event-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-repository-http\2.8.6\sesame-repository-http-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-repository-sparql\2.8.6\sesame-repository-sparql-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-repository-contextaware\2.8.6\sesame-repository-contextaware-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-repository-sail\2.8.6\sesame-repository-sail-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryalgebra-model\2.8.6\sesame-queryalgebra-model-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-http-client\2.8.6\sesame-http-client-2.8.6.jar
C:\...\.m2\repository\org\apache\httpcomponents\httpclient\4.4\httpclient-4.4.jar
C:\...\.m2\repository\org\apache\httpcomponents\httpcore\4.4\httpcore-4.4.jar
C:\...\.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-api\2.8.6\sesame-sail-api-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-federation\2.8.6\sesame-sail-federation-2.8.6.jar
C:\...\.m2\repository\org\slf4j\slf4j-api\1.7.10\slf4j-api-1.7.10.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryparser-api\2.8.6\sesame-queryparser-api-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryparser-serql\2.8.6\sesame-queryparser-serql-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryparser-sparql\2.8.6\sesame-queryparser-sparql-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryresultio-api\2.8.6\sesame-queryresultio-api-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryresultio-binary\2.8.6\sesame-queryresultio-binary-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryresultio-sparqljson\2.8.6\sesame-queryresultio-sparqljson-2.8.6.jar
C:\...\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.4.4\jackson-core-2.4.4.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryresultio-sparqlxml\2.8.6\sesame-queryresultio-sparqlxml-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryresultio-text\2.8.6\sesame-queryresultio-text-2.8.6.jar
C:\...\.m2\repository\com\opencsv\opencsv\3.2\opencsv-3.2.jar
C:\...\.m2\repository\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-repository-dataset\2.8.6\sesame-repository-dataset-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-http-protocol\2.8.6\sesame-http-protocol-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-api\2.8.6\sesame-rio-api-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-datatypes\2.8.6\sesame-rio-datatypes-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-languages\2.8.6\sesame-rio-languages-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-binary\2.8.6\sesame-rio-binary-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-jsonld\2.8.6\sesame-rio-jsonld-2.8.6.jar
C:\...\.m2\repository\com\github\jsonld-java\jsonld-java\0.5.1\jsonld-java-0.5.1.jar
C:\...\.m2\repository\org\apache\httpcomponents\httpclient-cache\4.2.5\httpclient-cache-4.2.5.jar
C:\...\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.7\jcl-over-slf4j-1.7.7.jar
C:\...\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-ntriples\2.8.6\sesame-rio-ntriples-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-nquads\2.8.6\sesame-rio-nquads-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-n3\2.8.6\sesame-rio-n3-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-rdfjson\2.8.6\sesame-rio-rdfjson-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-rdfxml\2.8.6\sesame-rio-rdfxml-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-trix\2.8.6\sesame-rio-trix-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-turtle\2.8.6\sesame-rio-turtle-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-rio-trig\2.8.6\sesame-rio-trig-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-inferencer\2.8.6\sesame-sail-inferencer-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-model\2.8.6\sesame-sail-model-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-lucene\2.8.6\sesame-sail-lucene-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-lucene-api\2.8.6\sesame-sail-lucene-api-2.8.6.jar
C:\...\.m2\repository\com\google\guava\guava\18.0\guava-18.0.jar
C:\...\.m2\repository\com\spatial4j\spatial4j\0.4.1\spatial4j-0.4.1.jar
C:\...\.m2\repository\org\apache\lucene\lucene-analyzers-common\5.1.0\lucene-analyzers-common-5.1.0.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-memory\2.8.6\sesame-sail-memory-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-base\2.8.6\sesame-sail-base-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-nativerdf\2.8.6\sesame-sail-nativerdf-2.8.6.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-sail-rdbms\2.8.6\sesame-sail-rdbms-2.8.6.jar
C:\...\.m2\repository\commons-dbcp\commons-dbcp\1.4\commons-dbcp-1.4.jar
C:\...\.m2\repository\commons-pool\commons-pool\1.5.4\commons-pool-1.5.4.jar
C:\...\.m2\repository\ch\qos\logback\logback-classic\1.0.13\logback-classic-1.0.13.jar
C:\...\.m2\repository\ch\qos\logback\logback-core\1.0.13\logback-core-1.0.13.jar
C:\...\.m2\repository\com\tinkerpop\blueprints\blueprints-neo4j-graph\2.6.0\blueprints-neo4j-graph-2.6.0.jar
C:\...\.m2\repository\com\tinkerpop\blueprints\blueprints-core\2.6.0\blueprints-core-2.6.0.jar
C:\...\.m2\repository\org\codehaus\jettison\jettison\1.3.3\jettison-1.3.3.jar
C:\...\.m2\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar
C:\...\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.2.3\jackson-databind-2.2.3.jar
C:\...\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.2.3\jackson-annotations-2.2.3.jar
C:\...\.m2\repository\com\carrotsearch\hppc\0.6.0\hppc-0.6.0.jar
C:\...\.m2\repository\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar
C:\...\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar
C:\...\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar
C:\...\.m2\repository\commons-digester\commons-digester\1.8\commons-digester-1.8.jar
C:\...\.m2\repository\commons-beanutils\commons-beanutils\1.7.0\commons-beanutils-1.7.0.jar
C:\...\.m2\repository\commons-beanutils\commons-beanutils-core\1.8.0\commons-beanutils-core-1.8.0.jar
C:\...\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar
C:\...\.m2\repository\org\neo4j\neo4j-kernel\1.9.6\neo4j-kernel-1.9.6.jar
C:\...\.m2\repository\org\apache\geronimo\specs\geronimo-jta_1.1_spec\1.1.1\geronimo-jta_1.1_spec-1.1.1.jar
C:\...\.m2\repository\org\neo4j\neo4j-lucene-index\1.9.6\neo4j-lucene-index-1.9.6.jar
C:\...\.m2\repository\org\neo4j\neo4j-graph-algo\1.9.6\neo4j-graph-algo-1.9.6.jar
C:\...\.m2\repository\org\neo4j\neo4j-udc\1.9.6\neo4j-udc-1.9.6.jar
C:\...\.m2\repository\org\neo4j\neo4j-graph-matching\1.9.6\neo4j-graph-matching-1.9.6.jar
C:\...\.m2\repository\org\neo4j\neo4j-cypher\1.9.6\neo4j-cypher-1.9.6.jar
C:\...\.m2\repository\org\scala-lang\scala-library\2.10.0\scala-library-2.10.0.jar
C:\...\.m2\repository\com\googlecode\concurrentlinkedhashmap\concurrentlinkedhashmap-lru\1.3.1\concurrentlinkedhashmap-lru-1.3.1.jar
C:\...\.m2\repository\org\neo4j\neo4j-jmx\1.9.6\neo4j-jmx-1.9.6.jar
C:\...\.m2\repository\org\neo4j\neo4j-ha\1.9.6\neo4j-ha-1.9.6.jar
C:\...\.m2\repository\org\neo4j\neo4j-backup\1.9.6\neo4j-backup-1.9.6.jar
C:\...\.m2\repository\org\neo4j\neo4j-consistency-check\1.9.6\neo4j-consistency-check-1.9.6.jar
C:\...\.m2\repository\org\neo4j\neo4j-com\1.9.6\neo4j-com-1.9.6.jar
C:\...\.m2\repository\io\netty\netty\3.6.3.Final\netty-3.6.3.Final.jar
C:\...\.m2\repository\org\neo4j\neo4j-cluster\1.9.6\neo4j-cluster-1.9.6.jar
C:\...\.m2\repository\org\apache\zookeeper\zookeeper\3.3.2\zookeeper-3.3.2.jar
C:\...\.m2\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar
C:\...\.m2\repository\org\neo4j\neo4j-management\1.9.6\neo4j-management-1.9.6.jar
C:\...\.m2\repository\org\allenai\tinkerpop\blueprints\blueprints-graph-sail\2.7.1\blueprints-graph-sail-2.7.1.jar
C:\...\.m2\repository\org\allenai\tinkerpop\blueprints\blueprints-core\2.7.1\blueprints-core-2.7.1.jar
C:\...\.m2\repository\net\fortytwo\sesametools\common\1.8\common-1.8.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-queryalgebra-evaluation\2.7.10\sesame-queryalgebra-evaluation-2.7.10.jar
C:\...\.m2\repository\org\openrdf\sesame\sesame-util\2.7.10\sesame-util-2.7.10.jar
C:\...\.m2\repository\org\apache\lucene\lucene-core\3.6.2\lucene-core-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-queries\3.6.2\lucene-queries-3.6.2.jar
C:\...\.m2\repository\jakarta-regexp\jakarta-regexp\1.4\jakarta-regexp-1.4.jar
C:\...\.m2\repository\org\apache\lucene\lucene-highlighter\3.6.2\lucene-highlighter-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-join\3.6.2\lucene-join-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-grouping\3.6.2\lucene-grouping-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-memory\3.6.2\lucene-memory-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-analyzers\3.6.2\lucene-analyzers-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-queryparser\3.6.2\lucene-queryparser-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-spatial\3.6.2\lucene-spatial-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-misc\3.6.2\lucene-misc-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-spellchecker\3.6.2\lucene-spellchecker-3.6.2.jar
C:\...\.m2\repository\org\apache\lucene\lucene-icu\3.6.2\lucene-icu-3.6.2.jar
C:\...\.m2\repository\com\ibm\icu\icu4j\4.8.1.1\icu4j-4.8.1.1.jar
C:\...\.m2\repository\org\apache\lucene\lucene-stempel\3.6.2\lucene-stempel-3.6.2.jar
答案 0 :(得分:1)
所以没有人发布答案,但我们可以尝试复制它。当我尝试使用SimpleValueFactory
中的org.openrdf.sesame
而没有链接maven pom.xml中的依赖项时,我得到了同样的错误,所以这可能会帮助你:
将此添加到您的maven依赖项:
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-runtime</artifactId>
<version>2.8.6</version>
我不确定正确的版本,但他们展示了如何在这里包含芝麻框架:http://rdf4j.org/sesame/tutorials/getting-started.docbook?view
这可能不是Java 8的问题。看到这个问题有多个答案告诉我,neo4j对Java 8没有问题:Neo4j 2 and Java 8
您的项目是否使用 Lucence 4 ?尝试使用 Lucence 3.x 。
在github上似乎也有一个自定义修复,哪个可能集成在一个项目中。见这里:https://github.com/neo4j/neo4j/issues/6