0
Map
を入力として、orientdb
groovy関数に渡そうとしています。しかしGroovy関数は、私のMap
入力パラメータをStringとみなしています。Javaからorientdb groovy関数にパラメータのMap型を渡す方法
入力パラメータのMap型をorientdb groovy関数に渡す方法を提案してください。
コード
public void MapInputTest() {
Map < String, Object > inputMap = new HashMap < String, Object >();
inputMap.put("serviceId", "ETHA12721205");
inputMap.put("serviceId1", "ETHA127212051");
inputMap.put("serviceId2", "ETHA127212052");
g.execute(Script.function("MapInputFunction", inputMap));
System.out.println("returnedString is : ");
}
グルーヴィーな機能:スクリプトで
def MapInputFunction(Map mapInput) {
println("class type of input parameter" + mapInput.getClass())
println("class type " + mapInput)
def tempMap = [: ]
tempMap = mapInput
return tempMap.get('serviceId')
}
エラー
com.orientechnologies.orient.core.exception.OCommandExecutionException: Failed to execute command: function.MapInputFunction Cause:No signature of method: Script1.MapInputFunction() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String) values: [ETHA127212051, ETHA12721205, ETHA127212052]
Possible solutions: MapInputFunction2(), MapInputFunction(java.lang.Object)
at platform.orientdb.storage.DataGridStorage.executeCommand(DataGridStorage.java:631)
at platform.orientdb.storage.DataGridStorage.command(DataGridStorage.java:601)
at platform.orientdb.storage.message.CommandMessage.processMessage(CommandMessage.java:27)
at platform.orientdb.storage.message.TxMessage.process(TxMessage.java:52)
at platform.orientdb.storage.actor.TransactionActor.processMessage(TransactionActor.java:71)
at platform.orientdb.storage.actor.ExternalStorageActor.onReceive(ExternalStorageActor.java:16)
at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:165)
at akka.actor.Actor$class.aroundReceive(Actor.scala:484)
at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:95)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
at akka.actor.ActorCell.invoke(ActorCell.scala:495)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)*emphasized text*
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
地図データ構造としてのInputMapを読み取ることができ 'G'と' Script'は何ですか。もう少しコードを追加すれば、助けが簡単になります。 – sbglasius
gはDBのグラフインスタンスを表します –