neo4j - Getting "unknown function" for inhouse developed user defined function -


i'm trying test user defined functions in neo4j 3.1. wrote this:

public class udf {     @context     public graphdatabaseservice db;      @context     public log log;      @userfunction("test.id")     public long id(@name("node") node node)     {         return node.getid();     } } 

and test function this:

public class udftest {     @rule     public neo4jrule neo4j = new neo4jrule()         .withprocedure(udf.class);      @test     public void shouldbeabletoextractidproperty() throws throwable     {         try (driver driver = graphdatabase.driver(neo4j.bolturi() , config.build().withencryptionlevel(config.encryptionlevel.none).toconfig()))         {             session session = driver.session();              long nodeid = session.run("create (p) return test.id(p)")                     .single()                     .get(0).aslong();              assertequals(nodeid, 0);         }     } } 

and when run test prompts:

org.neo4j.driver.v1.exceptions.clientexception: unknown function 'test.id' (line 1, column 19 (offset: 18)) "create (p) return test.id(p)"                    ^ 

when change @userfunction @procedure , bunch of other changes, can call exact same method using call .. yield clause.

can please tell me i'm doing wrong?

you using withprodcedure method instead of withfunction method on neo4jrule in test. change line to:

@rule public neo4jrule neo4j = new neo4jrule()     .withfunction(udf.class); 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -