I have a DCG in Prolog that I can query like so:
q(Tree, [name, of, company], []).
and get a response that shows me the path taken to parse the query:
Tree = q(['company (Class)', 'name (Attribute)'])
Now I would like to pose a query such as:
q(Tree, [name, of, acme], []).
and failing to match the term acme
, I would like to create a variable Acme
so that I get something like:
Acme = company Tree = q(['company (Class)', 'name (Attribute)'])
I am using SWI-Prolog and am querying it from another language, that is why the query is all lowercase. My other option is creating a lexicon of all the valid terms and replacing all unknows in a query with a variable, but am hoping for a Prolog solution.
Thank you.