I'm using JPL to do some SWI-Prolog queries in a Java program. When I want to create a new Query, I would like to be able to use jpl.Util.textToTerm
to directly instanciate Terms from a user input, without parsing it myself.
The problem is that this method seems to always parse variable identifiers (i.e. something that starts with a capital letter) as anonymous variables (i.e. something that starts with _
).
For example, jpl.Util.textToTerm("X")
returns a jpl.Variable
that has name _1
instead of X
, which is obviously a problem since that means I won't be able to access any bindings after querying.
Creating a jpl.Query
directly from a string, like new Query("reverse([1,2],X)")
has the exact same problem.