- Using the Prolog IDE
The Java-Prolog Connector Library is used in the PDT for implementing the connection of Java to Prolog. If you develop an Eclipse plugin and want to use the features listed below (which are also used by the PDT), you have to depend on the
org.cs3.pdt.connector plugin. You can retrieve the
org.cs3.pdt.connector plugin either from the update site or by installing the PDT. This allows using additional features which the Prolog Connector Library does not support:
If your plugin contains Prolog files which should be automatically loaded you can add a
fileContribution extension to your plugin.xml.
<extension point="org.cs3.pdt.connector.bootstrapContribution"> <fileContribution id="my.plugin.pl.fileContribution" path="pl/load.pl" key=""> <dependency contribution="org.cs3.pdt.common.fileContribution"> </dependency> </fileContribution> </extension>
If you want to add a path to the Prolog file search path (file_search_path/2) you can do this with a
<extension point="org.cs3.pdt.connector.bootstrapContribution"> <fileSearchPathContribution id="my.plugin.pl.fileSearchPathContribution" alias="my_plugin_pl" path="prolog_code/" key=""> </fileSearchPathContribution> </extension>
This extension creates the following file search path entry in every Prolog process:
file_search_path(my_plugin_pl, '$path to plugin$/prolog_code/').
An example can be found in the plugin.xml of the Prolog Console plugin.
A subscription can be used to get a PrologProcess and to make sure that certain Prolog code is loaded in this process.
A subscription has a name and a list of keys. If you ask for a process via a subscription, the process having the same name as the subscription is returned and it is ensured that all file and file search path contributions whose key is contained in the subscription's list of keys are loaded in this process.
To get the process via the subscription you can use:
An example can be found in the
getDefaultPrologProcess() method of the type PrologProcessService.