Mercylog
Datalog based relational programming in Python.
Install / Use
/learn @RAbraham/MercylogREADME
NOTE: EXPERIMENTAL. PROTOTYPE FOR DESIGN PURPOSES. Do not use !!
Vision
Mercylog will be a Datalog based library which investigates the benefits of Datalog to build:
-
Applications:
- Datalog's expressiveness can allow us to reduce the code required to build applications(Overlog, Yedalog)
- Query data sources with higher expressivity of Datalog(Datomic, DataScript).
- We can build specifications which could easily be translatable to code. (Object-role modeling)
- We can build declarative UIs (source: Greg Rosenblatt, dbKanren)
- Using Python, we can have one language to code end to end(Brython/Pyodide for browsers/phones, Python Extensions for Postgresql)
- Because Datalog is declarative(capturing the 'What'), when a new technology/library comes along, we can quickly build backends for Mercylog to move from one technology to another, hence maintaining our algorithmic knowledge, business logic and not having to code them again for the new technology(e.g. moving from tensorflow to pytorch, or like Bashlog which is Datalog to bash scripts)
-
Distributed Systems: By including time in our relations, we make it easier to solve many tough problems in distributed systems(Dedalus, 3DF in Clojure)
-
Analytics:
- By including time in our relations, we can do high performance incremental analytics(Timely Dataflow or Naiad, Boom Analytics)
- By including values for relations, we can do probablisitic programming(JudgeD)
-
Machine Learning:
- We can capture machine learning concepts(MLog)
- By including values for relations, we can explore AI(Yedalog, Dyna)
Prerequisites:
- Needs Java 8 already installed(for BashLog)
pip install mercylog
Tutorial
Check out the tutorial/introduction to Mercylog
Short Introduction
import mercylog
m = mercylog.BashlogV1()
_ = m._
father = m.relation('father')
mother = m.relation('mother')
facts = [
father('Aks', 'Bob'),
father('Bob', 'Cad'),
father('Yan', 'Zer'),
mother('Mary', 'Marla'),
mother('Marla', 'Kay'),
mother('Jane', 'Zanu'),
]
X = m.variables('X')
paternal_grandfather = m.relation('paternal_grandfather')
maternal_grandmother = m.relation('maternal_grandmother')
def transitive(head, clause):
X, Y, Z = m.variables('X', 'Y', 'Z')
return head(X, Z) <= [clause(X, Y), clause(Y, Z)]
rules = [
transitive(paternal_grandfather, father),
transitive(maternal_grandmother, mother)
]
print(m.run(facts, rules, [paternal_grandfather(X, _)])) # ['Aks']
print(m.run(facts, rules, [maternal_grandmother(X, _)])) # ['Mary']
Related Skills
node-connect
354.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
112.2kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
354.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
