1.2 Installation Steps for Other Languages
In general, to use the Machine Query Interface with any programming language:
- Install SWI Prolog itself on the machine the application will run on.
- Check if your SWI Prolog version includes the MQI by launching it
and typing
?- mqi_start([]).
If it can't find it, see below for how to install it. - Ensure that the system path includes a path to the
swipl
executable from that installation. - Make sure the application (really the user that launches the application) has permission to launch the SWI Prolog process. Unless your system is unusually locked down, this should be allowed by default. If not, you'll need to set the appropriate permissions to allow this.
- Install (or write!) the library you'll be using to access the MQI in your language of choice.
If your SWI Prolog version doesn't yet include the MQI:
- Download the
mqi.pl
file from the GitHub repository. - Open an operating system command prompt and go to the directory
where you downloaded
mqi.pl
. - Run the command below. On Windows the command prompt must be run
as an administrator. On Mac or Linux, start the command with
sudo
as insudo swipl -s ...
.
swipl -s mqi.pl -g "mqi:install_to_library('mqi.pl')" -t halt