This is a rather complicated and non-trivial problem. However, if your domain is limited (querying a database of employees, etc.), and you expect only a limited set of statements as input, you can create a simple rule-based system.
The simplest solution is to develop a set of expression-based translation rules. For instance. suppose that the word that appeared after (was | was) is a verb. You can save the dictionary of all common verbs and their mappings in the fields of your database. Here "born" will be displayed in a field that can be called DATE_OF_BIRTH, for example.
A more complex rule-based solution will be to search or create a parser for your chosen language and perform a conversion based on the output of the parser and the rule base. For instance. The parser will infer what a predicate of a sentence, subject, etc. You will have a set of rules that will modify these parts of the sentences to create an imperative structure.
If you hate the idea of ββdeveloping a rule base manually, you can always try the machine learning approach and prepare a statistical system. Here you need to develop a database of questions that covers most types of questions that you might expect) and prepare a statistical model.
If I proposed one library / tool for experimenting with any of the above approaches, I would say OpenNLP.
Tomek source share