rdf

2020-11-20T03:04:58.225500Z

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)

2020-11-20T03:10:24.230100Z

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?

2020-11-20T11:04:06.232300Z

@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.

2020-11-20T12:24:54.234300Z

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.

2020-11-20T12:33:42.236200Z

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?

2020-11-20T13:36:45.236900Z

Ah. Nevermind. I'm an idiot. I was passing in a non-existent variable. Jeesh.

2020-11-20T13:41:18.237100Z

https://comb.io/XCdcbj