我实际上已经坚持了几个小时..
我的代码很简单,只想使用Labeled索引添加几个节点。 没有索引的东西(不要创建createDeferredSchemaIndex)代码可以正常运行。
我的例外是:
groovy.lang.MissingMethodException: No signature of method: org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl.createNode() is applicable for argument types: (java.util.LinkedHashMap, [Lorg.neo4j.graphdb.Label;) values: [[tag:START], [MacMorphoTag]]
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at NextGenBatchInserterWithId$_run_closure1.doCall(NextGenBatchInserterWithId.groovy:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:278)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.Closure.call(Closure.java:423)
at groovy.lang.Closure.call(Closure.java:439)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForLine(DefaultGroovyMethods.java:4281)
at org.codehaus.groovy.runtime.IOGroovyMethods.eachLine(IOGroovyMethods.java:466)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.eachLine(ResourceGroovyMethods.java:288)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.eachLine(ResourceGroovyMethods.java:253)
at org.codehaus.groovy.runtime.dgm$797.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at NextGenBatchInserterWithId.run(NextGenBatchInserterWithId.groovy:71)
at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:258)
at groovy.lang.GroovyShell.run(GroovyShell.java:502)
at groovy.lang.GroovyShell.run(GroovyShell.java:491)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:650)
at groovy.ui.GroovyMain.run(GroovyMain.java:381)
at groovy.ui.GroovyMain.process(GroovyMain.java:367)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:126)
at groovy.ui.GroovyMain.main(GroovyMain.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:106)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:128)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caught: groovy.lang.MissingMethodException: No signature of method: org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl.shutdown() is applicable for argument types: () values: []
groovy.lang.MissingMethodException: No signature of method: org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl.shutdown() is applicable for argument types: () values: []
at NextGenBatchInserterWithId.run(NextGenBatchInserterWithId.groovy:182)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
我知道签名方法与我的参数不符,但是,通过这里的Neo4J代码:https://github.com/neo4j/neo4j/blob/master/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/BatchInserterImpl.java
在第578行:
public long createNode(Map properties,Label ... labels)
这正是我从我的groovy发出的。
batch = org.neo4j.unsafe.batchinsert.BatchInserters.inserter(store,config)
batch = batch.createDeferredSchemaIndex( macMorphoTagLabel ).on( 'tag' ).create();
...
Label macMorphoTagLabel = DynamicLabel.label( 'MacMorphoTag' );
def Label[] macMorphoTagArray = [macMorphoTagLabel]
if (!tags[previousWordTag.macMorphoTag]) {
tags[previousWordTag.macMorphoTag] = batch.createNode([tag: previousWordTag.macMorphoTag], macMorphoTagArray)
}
我在这里错过了什么?我正在使用Groovy 2.3.7 + Neo4j 2.1.5
例如 - >我的完整代码:http://pastebin.com/Z98tMDYi问题发生在第110行
我的Json文件是:http://pastebin.com/xSxZd4ke(作为UTF-8文件)
答案 0 :(得分:2)
在第66行,您重新分配batch
变量。取代
batch = batch.createDeferredSchemaIndex( macMorphoTagLabel ).on( 'tag' ).create();
带
batch.createDeferredSchemaIndex( macMorphoTagLabel ).on( 'tag' ).create();