Hi,
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:
https://docs.datomic.com/on-prem/query.html
The only difference is I replaced the hardcoded value by v1
What is the right way to achieve this simple query (without using toString()) ?
benfle
April 24, 2018, 2:04pm
2
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)]]
Thanks,
Interesting, why do I not need to do this for equal:
[:find ?e :in $ :where [?e :name ?v1]]
benfle
April 24, 2018, 2:08pm
4
I think you do too. Don’t you also get a “Insufficient Binding” error on ?v1
in this case?
benfle
April 24, 2018, 2:19pm
6
Then I would take a risk and guess that there is a bug in your tests
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 thanks!