changelog shortlog graph tags branches changeset file revisions annotate raw help

Mercurial > core / lisp/lib/q/dql.lisp

revision 502: a2fe095379f9
child 574: 9e7d4393eac6
     1.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2+++ b/lisp/lib/q/dql.lisp	Tue Jul 02 19:30:24 2024 -0400
     1.3@@ -0,0 +1,45 @@
     1.4+;;; dql.lisp --- Deductive Query Langs
     1.5+
     1.6+;; Query Engine for Inference-based query langs.
     1.7+
     1.8+;;; Commentary:
     1.9+
    1.10+;; Prolog, Datalog, etc.
    1.11+
    1.12+;;;; Why bother with this when we have SQL?
    1.13+
    1.14+;; My current understanding is that Prolog and SQL-derived langs share much in
    1.15+;; common. You can certainly do deductive logic in SQL and you can do
    1.16+;; relational table-based logic in Prolog.
    1.17+
    1.18+;; It is interesting to note that they were both discovered around the same
    1.19+;; time in the 60s-70s, but in very different contexts. Prolog was intended
    1.20+;; for NLP and SQL (relational-algebra/RA) was the foundation for
    1.21+;; RDBMS. Prolog never really found the same sort of success had by SQL, but
    1.22+;; with the AI summer in full bloom and NLP being a hot-topic, perhaps we will
    1.23+;; see the scales shift.
    1.24+
    1.25+;;;; Design
    1.26+
    1.27+;; The WAM compiler is a bit too much to understand let alone implement at
    1.28+;; this stage. The design of this package will be much simpler and optimized
    1.29+;; for compatibility with Lisp.
    1.30+
    1.31+;; I think we can get quite far 
    1.32+
    1.33+;;; Code:
    1.34+(in-package :q/dql)
    1.35+
    1.36+;;; Conditions
    1.37+(define-condition dql-error (error) ())
    1.38+
    1.39+(deferror simple-dql-error (dql-error simple-error) ())
    1.40+
    1.41+(defun simple-dql-error (ctrl &rest args)
    1.42+  (error 'simpl-dql-error :format-control ctrl :format-arguments args))
    1.43+
    1.44+(defclass dql-query (query) ())
    1.45+
    1.46+(defclass dql-data-source (data-source) ()
    1.47+  (:documentation "Data source which can be used withing DQL expressions."))
    1.48+