I have transacted custom function:
{
:db/id #db/id [:db.part/user]
:db/ident :search.fn/getLinksByValue
:db/doc "Used to get link values filtering on passed values for passed attributes"
:db/fn #db/fn {:lang "clojure"
:params [db valueAttributeIdents searchValue linkAttributeIdent]
:code [[(datomic.api/q
"[:find [?linkValue ...] :in $ [?valueAttributeIdents ...] ?searchValue ?linkAttributeIdent
:where
[?ex_e ?valueAttributeIdents ?searchValue]
[?ex_e ?linkAttributeIdent ?linkValue]
]"
db valueAttributeIdents searchValue linkAttributeIdent)]]}
}
I see it installed
Then in repl I’m getting function by:
(def myFuncEn (d/entity (d/db connInternal) :search.fn/getLinksByValue))
(def myFunc (.get myFuncEn :db/fn))
And the call is:
(d/q "[:find (pull ?Post [:db/id :model/type :Post/title :Post/uid])
:in $ $comment ?myFunc ?modelType_value_0 ?Comment_text_value_1
:where
[?Post :model/superTypes ?modelType_value_0]
(not-join [?Post ?Comment_text_value_1]
[(?myFunc $comment [:Comment/text] ?Comment_text_value_1 :Comment/uid) [?Comment_uid_3 ...]]
[?Post :Post/comments ?Comment_uid_3]
)
]"
(d/db connInternal), (d/db connComment) 'user/myFunc "Post" "Comment 1 on post-2")
But an error is returned:
Execution error at datomic.datalog/compile-expr-clause (datalog.clj:1143).
Unable to resolve symbol: ?myFunc in this context
Could you point me where I’m doing wrong things?
P.S. I’m wondering about such case when function is passed as input argument to be able to do similar steps in java