Comments (2)
Just to have that datomic example noted:
(require '[datomic.api :as db])
(def c (db/connect (doto "datomic:free://localhost:4334/mydb?password-datomic" db/create-database)))
(db/transact c [{:db/ident :id :db/valueType :db.type/keyword :db/cardinality :db.cardinality/one :db/unique :db.unique/identity} {:db/ident :n :db/valueType :db.type/long :db/cardinality :db.cardinality/one}])
(db/transact c [{:id 1 :n 1} {:id 2}])
(db/q '[:find (pull ?e [*]) :in $ ?max :where [?e :id ?id] (or-join [?e ?max] (not [?e :n _]) (and [?e :n ?n] [(< ?n ?max)]))] (db/db c) 1000)
;; =>
[[{:db/id 17592186245422, :id :b}] [{:db/id 17592186245421, :id :a, :n 1}]]
from datalog-parser.
I think this is an ambiguity in the Datomic specification:
An or-join clause allows you to specify which variables should unify with the surrounding clause; only this list of variables needs binding before the clause can run.
https://docs.datomic.com/on-prem/query.html#building-queries-programmatically
Our parser has interpreted the "should" unify to mean that these variables should also exist in the clauses and unify between them and the outside. Datomic on the other hand says that it will make sure that these variables are bound before the clause is run (a guarantee that we do not make yet), while it seems permissive if they are not being used. I have changed our behavior. The issue is fixed in datalog-parser 0.1.3
in 85a3ca1.
Please open further issues if you experience more inconsistencies.
from datalog-parser.
Related Issues (13)
- migrate datahike.parser to this project HOT 1
- finish up unparsing
- Satisfies? performance is terrible HOT 6
- implement behaviour for scalars and collections HOT 1
- add automation for snapshots and releases
- Can't parse on ClojureScript HOT 5
- parse-rules fails on any unknown variable HOT 13
- Build fails because of missing ssh-key HOT 1
- New attribute specifications for pull are not supported
- when-let with unused expression HOT 1
- ci: switch to replikativ workflow
- unnecessary loop in validate-or-join
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datalog-parser.