Pengines is an HTTP service for evaluating Prolog build on the foundation of SWI-Prolog. A client creates a Pengine, which is a sandboxed Prolog environment, passes any Prolog facts and rules, then queries the facts and rules to obtain a list of solutions.
This client is designed with F# consumers in mind, and provides the following modules:
Pengines.Prolog
- F# discriminated unions for Prolog terms: this includes, atoms, numbers, lists, compound terms, operators, and the dictionary term supported by SWI-Prolog.Pengines.Serialization
- serialize these terms to Prolog, and deserialize them from JSON,Pengines.Pengine
- manage the lifetime of a Pengine instance - create, query, and destroyPengines.Operators
- helpful operators to make common Prolog operations more succinct from F#
- SWI-Prolog - there are distributions available for Linux, macOS, and Windows.
- Pengines - this is a small set of Prolog modules, available in a GitHub repo.
- .NET Core Runtime - to use this library. Or you can pull the single file into your F# 4.1 or greater project with Paket.
- Create a list of Prolog terms containing your facts and rules
- Create a Pengine instance with
Pengines.Pengine.createPengine
, passing the list of terms and another term for a query to ask. - Iterate through the results.
- Destroy the Pengine instance, which will delete the facts and rules. It will timeout and self-destruct after 5 minutes without use if you don't.
Please see the user guide for a walkthrough.
There are also tests that show usage of the complete API.