I'm seeing a version mismatch when I attempt this.
The most recent of the jar that contains apoc.custom.asProcedure is
2022-06-11 18:32:25.708+0000 WARN [neo4j/cf363efa] The apoc version (22.214.171.124) and the Neo4j DBMS versions [4.4.6] are incompatible. See the compatibility matrix in https://neo4j.com/labs/apoc/4.4/installation/ to see the correct version
It appears to me that I need to revert the version of Neo4J that I'm running all the way back to v4.4.0 in order to use anything in apoc.custom.
Hi @tms !
1. You may like to use https://neo4j.com/labs/apoc/4.2/overview/apoc.custom/apoc.custom.declareProcedure/ instead.
2. It's a incorrect warning that will be solved soon. If you are planning on use this custom procedures you may like to use APOC 126.96.36.199 (Compatible with 4.4.6)
The only plugin I have for APOC-188.8.131.52 is "apoc-184.108.40.206-core.jar". This is the "core" plugin, and does not include any apoc.custom methods. So far as I know, there is no "apoc-220.127.116.11-full.jar".
I'm under the perhaps incorrect impression that the "full" jar for 4.2 that you reference in your documentation URL is incompatible with neo4j enterprise v4.4.6.
So far as I know, this apoc.custom behavior is not currently available for neo4j enterprise 4.4.6.
1. There's a full version of 18.104.22.168 here https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases
2. Also there, you can find the fresh out the oven 22.214.171.124
I checked with the same version.
Neo4j Enterprise 4.4.6
APOC 126.96.36.199 (Good for 4.4.6 now)
And I created the procedure.
CALL apoc.custom.asProcedure( 'powers', 'UNWIND range(0, $power) AS power RETURN $input ^ power AS answer', 'read', [['answer', 'long']], [['input','long'], ['power', 'long']] );
CALL custom.powers(9, 3);
The result is here.
Thanks @koji for that. I think this will work.
And also thanks to @Henrique for that article.
But now I wonder When should we use the Java implementation over the apoc custom procedure. Coz I feel former one is bit longer process. But I am sure there should be some advantage with the longer process.
would love to know what it is.
Consider APOC as wrapper of your eventual implementation. At the end, it's a Java implementation on his own. In your use case, if the logic you want to wrap can be transform into Cypher predicates, you will be fine with APOC.
Some other cases may require a complex logic. In those scenarios you may need an implementation of your own. Learning how to do so will do no harm 😏