insufficient bindings?


I have this datalog query:
String query = “[:find ?e :in $ :where [?e :name ?name][(> ?v1 ?name)]]”

which I call from Java as follows:

List inputs = Arrays.asList(cnx.db(), “King”);

QueryRequest request = QueryRequest.create(query, inputs.toArray());

return Peer.query(request);

I get:

db.error/insufficient-binding [?v1] not bound in expression clause: [(> ?v1 ?name)]

This is simply copied from the online doc:

The only difference is I replaced the hardcoded value by v1

What is the right way to achieve this simple query (without using toString()) ?

If you’re trying to find all entities whose name comes before “King”, you need to declare your input argument, ?v1, in the query. Like this:

[:find ?e :in $ ?v1 :where [?e :name ?name][(> ?v1 ?name)]]

Interesting, why do I not need to do this for equal:
[:find ?e :in $ :where [?e :name ?v1]]

I think you do too. Don’t you also get a “Insufficient Binding” error on ?v1 in this case?

No, all my tests pass

Then I would take a risk and guess that there is a bug in your tests :slight_smile:

Thanks, the tests were correct, but there was indeed a bug in my query builder, which was hidden until I bumped into the above
Adding args as inputs helps a lot :wink: thanks!