A compact Notation3 (N3) reasoner in JavaScript.
eyeling.js), no external runtime deps=>) + backward (<=) chaining over Horn-style rulesEyeling is regularly checked against the community Notation3 test suite; the report above tracks current pass/fail results.
If you want to understand how the parser, unifier, proof search, skolemization, scoped closure, and builtins are implemented, start with the handbook.
npm i eyeling
Run on a file:
npx eyeling examples/socrates.n3
See all options:
npx eyeling --help
CommonJS:
const { reason } = require('eyeling');
const input = `
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix : <http://example.org/socrates#>.
:Socrates a :Human.
:Human rdfs:subClassOf :Mortal.
{ ?S a ?A. ?A rdfs:subClassOf ?B } => { ?S a ?B }.
`;
console.log(reason({ proofComments: false }, input));
ESM:
import eyeling from 'eyeling';
console.log(eyeling.reason({ proofComments: false }, input));
Streaming / in-process reasoning (browser/worker, direct eyeling.js):
const { closureN3 } = eyeling.reasonStream(input, {
proof: false,
onDerived: ({ triple }) => console.log(triple),
});
Note: the npm
reason()helper shells out to the bundledeyeling.jsCLI for simplicity and robustness.
Builtins are defined in eyeling-builtins.ttl and described in the HANDBOOK.
npm test
MIT (see LICENSE).