1
votes

I'm actually stuck on this for several hours..

My code is simple and just want to add several nodes using Labeled index. Without index stuff (Don't creating createDeferredSchemaIndex ) the code works without a problem.

My exception is:


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)

I know about the signature method that don't match with my parameters but, by the Neo4J code from here: https://github.com/neo4j/neo4j/blob/master/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/BatchInserterImpl.java
On line 578:
public long createNode( Map properties, Label... labels )

That's exactly what I send from my 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)
                    }

What I missing here? I'm using Groovy 2.3.7 + Neo4j 2.1.5

For instance -> My full code: http://pastebin.com/Z98tMDYi problem happen on line 110
My Json file is: http://pastebin.com/xSxZd4ke (as UTF-8 file)

1
Can you try batch.createNode(*macMorphoTagArray, tag: previousWordTag.macMorphoTag) - tim_yates
No luck with this, got groovy.lang.MissingMethodException: No signature of method: org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl.createNode() is applicable for argument types: (java.util.LinkedHashMap, org.neo4j.graphdb.DynamicLabel) 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) - Pablo Thiele

1 Answers

2
votes

In line 66 you're reassigning the batch variable. Replace

batch = batch.createDeferredSchemaIndex( macMorphoTagLabel ).on( 'tag' ).create();

with

batch.createDeferredSchemaIndex( macMorphoTagLabel ).on( 'tag' ).create();