Logical English rules over a library’s loans in RDF find the overdue loan and the member to remind, with RDF dates and names.
library-loans-le.le · data/library-loans-le.ttl · output · proof · check · playground
The question
A library keeps its loans as RDF. Which loan is overdue on 28 November 2026, and whom does the library remind?
What we tell eyemind
data/library-loans-le.ttl holds three loans, with their borrowers, due
dates and return dates, and the members’ names:
lib:loan1 lib:borrower lib:ann ;
lib:dueOn "2026-11-20"^^xsd:date .
library-loans-le.le is Logical English.
the prefixes are: declares lib, and the RDF properties are: binds
templates to RDF properties, so that each triple of a property is a sentence
of its template, subject first:
*a loan* is due on *a date* is lib:dueOn.
An xsd:date literal is an LE date, a string is text, and an IRI is a
prefixed name. The rules read like the other LE examples: a loan is overdue
after its due date until it is returned, and the borrower of an overdue loan
gets a reminder.
What eyemind concludes
% query overdue
lib:loan1 is overdue on 2026-11-28.
% query reminders
Ann gets a reminder on 2026-11-28.
The second loan came back before it was due, and the third is not due yet. The JavaScript check report holds the same answers as LS terms:
struct('le:answer', 'overdue', iri('https://example.org/library#loan1'))
struct('le:answer', 'reminders', 'Ann')
What the proof establishes
The saved proof is checked against the compiled LS program, in which the
RDF triples of the bound properties are facts of their templates, such as
is_due_on(iri('https://example.org/library#loan1'), date(2026, 11, 20)).
--explain writes each answer with what it rests on, in English.
Try it
node bin/eyemind.js examples/library-loans-le.le examples/data/library-loans-le.ttl
node bin/eyemind.js --explain examples/library-loans-le.le examples/data/library-loans-le.ttl
node bin/eyemind.js --check-proof examples/proof/library-loans-le.js examples/library-loans-le.le examples/data/library-loans-le.ttl
Remove the return date of the second loan, and Ben gets a reminder too.
