Does anyone have any experience declaring builtin Jena extensions in Clojure?
(def always-true (proxy [BaseBuiltin Builtin] []
(getName [] "alwaysTrue")
(getArgLength [] 1)
(bodyCall [args length context]
;; (throw (ex-info "asdf" {})) Whether this statement is included or not has no effect. (edit)
(def ^:dynamic *args* args)
(def ^:dynamic *context* context)
true)))
(.register BuiltinRegistry/theRegistry always-true)
I was hoping the code above would give me a little visibility into SWRL rules. It doesn't complain when I register it, but then when I insert alwaysTrue(?x) into the body of SWRL rule that already works, the code does not appear to be executed, i.e., the dynamic variables are not being bound. Am I missing something?
@eric.d.scott: it’s not because you’re first raising an exception that’s somehow being swallowed is it?
also pretty sure you can remove the ^:dynamic
there. That just makes the vars support rebinding thread locally with binding
. re def
ing should work without for debugging purposes should work without that.
Oh. Yeah, I actually added the exception later just to see if I could shake something loose. Forgot to take that out of the example. But even without the exception this code shows no signs of being visited.
The puzzle here for me is why isn't this method being called? Are there missing metadata tags that are causing some other bodyCall method to be dispatched instead?
Ah. Nevermind. I'm an idiot. I was passing in a non-existent variable. Jeesh.