3 ms·
While there are solutions based on foreign function interfaces and host calling conventions for particular Prologs, you'd basically integrate the kind of apps e
by tannhaeuser 3y ago
While there are solutions based on foreign function interfaces and host calling conventions for particular Prologs, you'd basically integrate the kind of apps envisioned/demoed on the Quantum Prolog site [1] like you would any other modern subsystem - as a SaaS and/or via containers.
Let's say you have a Prolog optimization app for your business domain, such as an elaborate version of the container ship scheduling problem discussed on the site [2]. Traditionally you'd generate Prolog facts encoding the problem instance, and then invoke Prolog to solve the problem and output one or more found solutions. A variant of this expecting a certain directory structure with facts/rules to exist is used by the Aleph machine learning package also demoed on the site [3]. This is popular and very flexible because of Prolog's ultra-flexible term datatypes.
Alternatively, you can implement, in Prolog itself, a small wrapper to parse a JSON representation of your problem instance, where "implement" doesn't really describe it since basic JSON parsing using Prolog's built-in operator precedence parser is as easy as
:- op(600, xfy, :).
MyJSON =
{ "this": "bla",
"that": 100,
"L": [ 1, "two", 3 ] }
but applied to standard input using term reading, provided your Prolog has curly braces (should come with ISO DCGs). The in-browser variant of Quantum Prolog [4] emits JSON right away.
An API/language binding to call Prolog from a particular host environment is less suited for the kind of apps discussed on the Quantum Prolog site since these tend to be longer-running, and potentially parallelized workloads. But let's say a multiplayer game universe represented as Prolog database (or maybe a highly interactive solution viewer/picker under very particular circumstances) might need a different integration model.
[1]: https://quantumprolog.sgml.io/ https://quantumprolog.sgml.io/
[2]: https://quantumprolog.sgml.io/container-planning-demo/part1.html https://quantumprolog.sgml.io/container-planning-demo/part1....
[3]: https://quantumprolog.sgml.io/bioinformatics-demo/part1.html https://quantumprolog.sgml.io/bioinformatics-demo/part1.html
[4]: https://quantumprolog.sgml.io/browser-demo/browser-demo.html https://quantumprolog.sgml.io/browser-demo/browser-demo.html