2026-04-08ยท10 min readยทsota.io team

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:

:- 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:

InstitutionCountryContribution
VU Amsterdam๐Ÿ‡ณ๐Ÿ‡ฑ NetherlandsCore development (Wielemaker, 1987โ€“present)
TU Delft๐Ÿ‡ณ๐Ÿ‡ฑ NetherlandsPengines, semantic web extensions
KU Leuven๐Ÿ‡ง๐Ÿ‡ช BelgiumCLP extensions, constraint research
University of Vienna๐Ÿ‡ฆ๐Ÿ‡น AustriaOWL/RDF reasoning integration
INRIA๐Ÿ‡ซ๐Ÿ‡ท FranceISO standard interoperability
Universidade do Porto๐Ÿ‡ต๐Ÿ‡น PortugalLogtalk 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-PrologSICStusECLiPSeGNU Prolog
OriginVU Amsterdam ๐Ÿ‡ณ๐Ÿ‡ฑ, 1987SICS Stockholm ๐Ÿ‡ธ๐Ÿ‡ช, 1988ECRC Munich ๐Ÿ‡ฉ๐Ÿ‡ช, 1988INRIA Paris ๐Ÿ‡ซ๐Ÿ‡ท, 1998
LicenceLGPL/BSDCommercialMPLLGPL
ISO 13211-1FullFullPartialFull
CLP(FD)YesYesYes (ic)Yes
Web serverNative HTTP libraryVia packsVia librariesNo
Semantic WebRDF/SPARQL/OWLVia packsNoNo
TablingYes (library)YesYesNo
Dict typeYes (native)NoNoNo
ThreadsFull POSIXLimitedYesNo
CommunityLarge, activeIndustrial nicheAcademicSmall
Cloud Act riskNone (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:

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


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.