Deploy SWI-Prolog to Europe โ VU Amsterdam ๐ณ๐ฑ (1987), Open-Source ISO Prolog + Web APIs + Semantic Web, on EU Infrastructure in 2026
In 1987, Jan Wielemaker ๐ณ๐ฑ at the Vrije Universiteit Amsterdam (VU Amsterdam) started building a Prolog system for the Social Science Informatics department โ the "SWI" in SWI-Prolog stands for Sociaal-Wetenschappelijk Informatica. The goal was modest: a portable, practical Prolog for research and teaching. What emerged over the next three decades is the most widely used open-source Prolog system in the world, and the de facto standard for anyone deploying Prolog to a web server.
SWI-Prolog is the Prolog implementation that EU researchers, AI engineers, and knowledge-graph developers reach for when they need production reliability without vendor lock-in. It is maintained entirely within the European academic ecosystem โ Wielemaker has driven the project at VU Amsterdam since 1987, with contributions from TU Delft, KU Leuven, the University of Vienna, and dozens of European universities. There is no venture capital, no US parent company, and no Cloud Act exposure. The source is on GitHub under an LGPL licence (with a BSD exception for linking).
WAM Architecture and the Module System
SWI-Prolog compiles Prolog clauses to Warren Abstract Machine bytecode โ the same compilation strategy used by SICStus Prolog (RISE Stockholm ๐ธ๐ช, 1988) and ECLiPSe CLP (ECRC Munich ๐ฉ๐ช, 1988). The WAM organises execution across four memory regions: the heap (term storage), the stack (environments and choice points), the trail (bindings to undo on backtracking), and the code area. SWI-Prolog extends the standard WAM with a generational garbage collector that handles atom management, clause indexing structures, and large heap workloads efficiently โ a necessity for semantic web applications that may load millions of RDF triples into memory.
% SWI-Prolog โ module declaration and clause structure
:- module(family, [ancestor/2, parent/2]).
parent(tom, bob).
parent(tom, liz).
parent(bob, ann).
parent(bob, pat).
ancestor(X, Y) :- parent(X, Y).
ancestor(X, Y) :- parent(X, Z), ancestor(Z, Y).
% Query with findall
?- findall(X, ancestor(tom, X), Descendants).
% Descendants = [bob, liz, ann, pat]
SWI-Prolog's module system follows ISO Prolog conventions with pragmatic extensions. Modules declare their exports, use use_module/1 for imports, and support qualified calls (Module:Goal). The system ships with over 150 built-in libraries covering everything from constraint solving to cryptography to web serving โ all accessible via the module system without external package managers.
Constraint Programming: CLP(FD), CLP(R), CLP(B)
Like SICStus and ECLiPSe, SWI-Prolog provides a complete suite of constraint libraries. CLP(FD) โ constraint logic programming over finite domains โ is the core library for combinatorial optimisation, scheduling, and configuration problems.
:- use_module(library(clpfd)).
% 8-Queens problem
eight_queens(Qs) :-
Qs = [_,_,_,_,_,_,_,_],
Qs ins 1..8,
all_different(Qs),
foldl(no_attack, Qs, 1-[], _),
label(Qs).
no_attack(Q, R0-Ls0, R1-Ls1) :-
R1 is R0 + 1,
maplist(no_attack_(Q, R0), Ls0),
Ls1 = [Q-R0|Ls0].
no_attack_(Q, R, Q0-R0) :-
abs(Q - Q0) #\= abs(R - R0).
?- eight_queens(Qs).
% Qs = [1, 5, 8, 6, 3, 7, 2, 4] ; ...
CLP(R) handles constraints over real numbers โ useful for linear programming, physics simulations, and financial modelling. CLP(B) covers Boolean constraints, integrating cleanly with SAT-style reasoning. SWI-Prolog 9.x also ships with CLP(BNR) (Boolean + numerical + real), providing interval arithmetic for robust numerical reasoning under uncertainty.
Web Development: HTTP Server Library and Pengines
SWI-Prolog's most distinctive feature relative to other Prolog systems is its first-class web stack. The library(http/http_server) family provides a production-quality HTTP/HTTPS server that runs inside the Prolog process โ no external web server required.
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_json)).
:- http_handler(root(api/query), handle_query, [method(post)]).
handle_query(Request) :-
http_read_json_dict(Request, Body),
Goal = Body.goal,
term_to_atom(T, Goal),
( call(T) -> Result = true ; Result = false ),
reply_json_dict(_{result: Result}).
:- initialization(http_server([port(8080)]), main).
# Build and run
docker build -t my-prolog-api .
docker run -p 8080:8080 my-prolog-api
# POST /api/query {"goal": "member(X, [1,2,3])"}
Pengines (Prolog Engines) extend this model to distributed computation. A Pengine is a Prolog session running on a remote server, accessible via a JavaScript or Prolog client. This enables Prolog reasoning to be invoked directly from browser applications โ the basis for SWISH (SWI-Prolog for SHaring, at swish.swi-prolog.org), the online collaborative Prolog environment used by universities across Europe for teaching and research.
// JavaScript client โ query a remote Pengine
var pengine = new Pengine({
server: "https://your-sota-app.sota.io/pengine",
ask: "ancestor(tom, X)",
onSuccess: function(data) {
console.log(data.data); // [{X: "bob"}, {X: "liz"}, ...]
}
});
Semantic Web: RDF, SPARQL, and OWL Reasoning
SWI-Prolog is the leading platform for Semantic Web development in the Prolog world. The library(semweb) family supports:
- RDF/SPARQL via
library(semweb/rdf11)โ load, query, and update RDF graphs - SPARQL endpoint via
library(semweb/sparql_client)โ query remote SPARQL endpoints - OWL reasoning via
library(semweb/rdf_turtle)and the ClioPatria framework - Linked Data publishing via HTTP content negotiation
:- use_module(library(semweb/rdf11)).
:- use_module(library(semweb/turtle)).
% Load an OWL ontology
:- rdf_load('gene_ontology.owl').
% Query all biological processes
biological_processes(Process, Label) :-
rdf(Process, rdf:type, 'http://purl.obolibrary.org/obo/GO_0008150'),
rdf(Process, rdfs:label, Label^^xsd:string).
?- aggregate_all(count, biological_processes(_, _), N).
% N = 29688
This semantic web capability has made SWI-Prolog the preferred platform for biomedical knowledge engineering. The Gene Ontology (EU-led consortium), SNOMED CT implementations, and numerous Horizon Europe research projects in biomedical NLP use SWI-Prolog as their reasoning substrate. ClioPatria โ a Prolog-based semantic search platform developed at VU Amsterdam โ has been deployed in digital humanities projects across EU research institutions.
Tabling and Memoization
SWI-Prolog 7.3+ introduced tabling (also called tabled resolution or memoization), an extension of standard SLD resolution that caches answers to calls and handles left recursion โ a notorious pitfall of standard Prolog.
:- use_module(library(tabling)).
% Without tabling: infinite loop
% reachable(X, Z) :- reachable(X, Y), edge(Y, Z).
% With tabling: terminates correctly
:- table reachable/2.
reachable(X, Y) :- edge(X, Y).
reachable(X, Z) :- reachable(X, Y), edge(Y, Z).
edge(a, b). edge(b, c). edge(c, b). % cycle!
?- reachable(a, X).
% X = b ; X = c (terminates, no infinite loop)
Tabling enables SWI-Prolog to evaluate Datalog programs correctly โ critical for graph reachability queries over large RDF datasets where cycles are common.
The Dict Type and Modern Prolog
SWI-Prolog 7 introduced dicts โ a native key-value data structure that integrates with unification and pattern matching:
% SWI-Prolog dicts (native key-value type)
Person = person{name: "Jan Wielemaker", institution: "VU Amsterdam", country: "NL"},
Name = Person.name, % unification-based access
Institution = Person.institution.
% Nested
Config = config{
server: server{host: "0.0.0.0", port: 8080},
db: db{host: "postgres", name: "myapp"}
}.
Port = Config.server.port. % Port = 8080
Dicts make SWI-Prolog practical for JSON APIs, configuration management, and data pipeline code โ domains where traditional Prolog's term-based data structures are ergonomically awkward.
EU Provenance and Research Ecosystem
SWI-Prolog's EU academic lineage is deep:
| Institution | Country | Contribution |
|---|---|---|
| VU Amsterdam | ๐ณ๐ฑ Netherlands | Core development (Wielemaker, 1987โpresent) |
| TU Delft | ๐ณ๐ฑ Netherlands | Pengines, semantic web extensions |
| KU Leuven | ๐ง๐ช Belgium | CLP extensions, constraint research |
| University of Vienna | ๐ฆ๐น Austria | OWL/RDF reasoning integration |
| INRIA | ๐ซ๐ท France | ISO standard interoperability |
| Universidade do Porto | ๐ต๐น Portugal | Logtalk integration (Paulo Moura) |
The project has received EU Horizon funding through multiple periods, including the ACSI project (FP7, coordination and support) and contributions through the OpenCyc/SUMO knowledge graph initiatives. There is no US parent company and no exposure to the US CLOUD Act โ all development, release infrastructure, and community coordination occurs within the EU academic ecosystem.
Industrial and Research Applications
SWI-Prolog is deployed in production across a diverse range of domains:
Biomedical informatics: The Gene Ontology Consortium (an EU-led international consortium) uses SWI-Prolog for ontology validation and SPARQL query services. The SNOMED CT browser used by national health authorities in the Netherlands, Belgium, and Denmark runs on SWI-Prolog semantic web infrastructure.
Natural language processing: The Grammatical Framework (GF, Aarne Ranta ๐ธ๐ช, Chalmers/Gothenburg) interoperates with SWI-Prolog for multilingual knowledge extraction. EU-funded NLP projects in the META-NET network use SWI-Prolog as a reasoning backend.
Legal reasoning and knowledge graphs: The MIREL project (EU H2020, Mining and Reasoning with Legal texts) uses SWI-Prolog for formalising EU directives. Eunomos (compliance management system, Politecnico di Torino ๐ฎ๐น) represents legislative knowledge in Prolog.
Semantic search: ClioPatria (VU Amsterdam) โ a SWI-Prolog-based faceted search and linked data platform โ is deployed at the Dutch National Library (KB), the Netherlands Institute for Sound and Vision, and multiple EU digital humanities archives.
Comparison: SWI-Prolog vs SICStus vs ECLiPSe vs GNU Prolog
| SWI-Prolog | SICStus | ECLiPSe | GNU Prolog | |
|---|---|---|---|---|
| Origin | VU Amsterdam ๐ณ๐ฑ, 1987 | SICS Stockholm ๐ธ๐ช, 1988 | ECRC Munich ๐ฉ๐ช, 1988 | INRIA Paris ๐ซ๐ท, 1998 |
| Licence | LGPL/BSD | Commercial | MPL | LGPL |
| ISO 13211-1 | Full | Full | Partial | Full |
| CLP(FD) | Yes | Yes | Yes (ic) | Yes |
| Web server | Native HTTP library | Via packs | Via libraries | No |
| Semantic Web | RDF/SPARQL/OWL | Via packs | No | No |
| Tabling | Yes (library) | Yes | Yes | No |
| Dict type | Yes (native) | No | No | No |
| Threads | Full POSIX | Limited | Yes | No |
| Community | Large, active | Industrial niche | Academic | Small |
| Cloud Act risk | None (EU academic) | None (RISE Sweden) | None (IC Cork ๐ฎ๐ช) | None (INRIA) |
EU AI Act Angle
SWI-Prolog's inference model maps directly onto EU AI Act compliance requirements. Article 13 mandates transparency for high-risk AI systems โ a requirement that neural networks, by design, struggle to satisfy without post-hoc explanation layers. Logic programming systems like SWI-Prolog are inherently interpretable: every decision is a sequence of rule applications that can be traced, audited, and explained in human-readable terms.
For Annex III high-risk applications (medical diagnosis, legal reasoning, critical infrastructure management), SWI-Prolog backends provide:
- Traceable reasoning chains:
trace/0andleash/1for interactive debugging; the event-driven meta-interpreter for production audit logging - Deterministic outputs: given the same fact base and query, the same proof path always results โ no stochastic variation
- Human-auditable rules: domain expert knowledge encoded in Prolog clauses that a legal team can review
- Incremental knowledge updates:
assert/retractallows the knowledge base to be updated without retraining a model
Deploy SWI-Prolog to EU Infrastructure
sota.io is built for workloads exactly like this. One Dockerfile, one git push, and your SWI-Prolog application is running on European servers โ GDPR-compliant by default, no DevOps required.
# Dockerfile for SWI-Prolog web service
FROM swipl:9.4
WORKDIR /app
COPY . .
# Install SWI-Prolog packs if needed
RUN swipl -g "pack_install(prosqlite, [interactive(false)])" -t halt
EXPOSE 8080
CMD ["swipl", "-g", "server:start", "-t", "halt", "server.pl"]
% server.pl โ minimal SWI-Prolog HTTP service
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_json)).
:- http_handler(root(health), health_check, []).
:- http_handler(root(query), handle_query, [method(post)]).
health_check(_Request) :-
reply_json_dict(_{status: "ok", runtime: "swi-prolog"}).
handle_query(Request) :-
http_read_json_dict(Request, _{goal: GoalStr}),
term_to_atom(Goal, GoalStr),
( call(Goal) -> Status = success ; Status = failure ),
reply_json_dict(_{status: Status}).
start :- http_server([port(8080)]).
# sota.yml โ deploy to EU infrastructure
service: swi-prolog-api
runtime: docker
region: eu-central
resources:
memory: 512mb
cpu: 0.5
env:
- PROLOG_STACK_LIMIT=2g
- PROLOG_TABLE_SPACE=1g
With sota.io's managed PostgreSQL, your SWI-Prolog service connects to a GDPR-compliant database running in the same EU region โ no data leaves the EU, no Cloud Act subpoenas can reach it, and your Article 13 audit trail stays under EU jurisdiction.
The intellectual lineage from VU Amsterdam in 1987 to your production service in 2026 is unbroken: Dutch academic research, European open-source governance, EU infrastructure. sota.io closes the loop.
See Also
- Deploy Prolog to Europe โ โ ISO Prolog standard (ISO 13211-1); SWI-Prolog is the most widely used open-source implementation of the ISO core
- Deploy Logtalk to Europe โ โ Paulo Moura ๐ต๐น (Universidade do Porto); object-oriented layer that compiles directly to SWI-Prolog, ECLiPSe, or SICStus โ listed in SWI-Prolog's official integration docs
- Deploy SICStus Prolog to Europe โ โ RISE Research Institutes of Sweden ๐ธ๐ช (Stockholm, 1988); shares the WAM architecture and CLP(FD/R/B) constraint stack with SWI-Prolog, the two most widely deployed ISO Prolog systems in EU research
- Deploy ECLiPSe CLP to Europe โ โ ECRC Munich ๐ฉ๐ช (ESPRIT 1988); the canonical EU constraint logic programming system, same WAM + CLP(FD)/
iclineage, SWI-Prolog's counterpart for constraint-intensive combinatorial workloads - Deploy Clingo/ASP to Europe โ โ University of Potsdam ๐ฉ๐ช (2007), Answer Set Programming; complements SWI-Prolog's Semantic Web stack for non-monotonic reasoning and explainable AI applications under EU AI Act Art. 13
SWI-Prolog is maintained by Jan Wielemaker and the SWI-Prolog community at VU Amsterdam ๐ณ๐ฑ. Source: github.com/SWI-Prolog/swipl-devel (LGPL/BSD). Documentation: swi-prolog.org.
Deploy SWI-Prolog to EU infrastructure โ try sota.io free.