eyeprolog

EyeProlog

EyeProlog logo

npm version DOI

EyeProlog combines ISO Prolog and W3C RDF 1.2 to turn portable rules and linked data into answers and inspectable proofs.

Book — The Art of EyeProlog · Why EyeProlog? · Playground

The book is the reference for the language, command line, JavaScript API, RDF 1.2 support, examples, proofs, conformance, and implementation.

Quick start

EyeProlog requires Node.js 18 or newer.

npm install --global eyeprolog
eyeprolog examples/socrates.pl
eyeprolog --proof examples/socrates.pl
eyeprolog --goal 'type(socrates, mortal)' examples/socrates.pl

Programs may declare their default queries with %% goal: comments. Double-quoted text follows the ISO double_quotes flag and defaults to a proper list of one-character atoms (chars), matching Trealla and Scryer.

Portable library

EyeProlog adds 50 public library predicates to its 115-predicate ISO profile. All 50 are ordinary Prolog clauses across src/eyeprolog-library.pl and src/eyeprolog-common-library.pl; both are autoloaded in Node and the browser. None requires host support. Other Prolog systems should load only eyeprolog-library.pl, which avoids redefining their common list predicates. Portable text predicates use ISO atoms or character lists; the RDF tools emit lexical values as ISO atoms as well.

RDF 1.2

node tools/rdf-to-pl.mjs --rules rules.pl data.ttl -o program.pl
eyeprolog program.pl > derived.pl
node tools/pl-to-rdf.mjs derived.pl -o derived.nq

See the book for RDF mappings, graphs, triple terms, reifiers, annotations, formats, and policy examples.

Development

git clone https://github.com/eyereasoner/eyeprolog.git
cd eyeprolog
npm install
npm test

EyeProlog is released under the MIT License.