Do I make something wrong here? First ask for all attributes. The attribute :test/code-file is in that list. And then I ask for those entities, that have this attribute, and the result is empty.
((d/q '[:find ?attr
:where
[?x :type ut-table/test]
[?x ?attr]]
(d/db conn))
[:test/code-file])
=> [:test/code-file]
(d/q '[:find ?x
:where
[?x :type ut-table/test]
[?x :test/code-file]]
(d/db conn))
=> #{}
I found out, that the problem has something to do with my schema. I think, I will be able to isolate the problem. Maybe it is just a stupid mistake, I am making. For some reason, this first query returns something even if ut-table/test is undefined.
To me it looks like a bug.
(def conn (d/get-conn "test/test_db"
{:my-type {:db/valueType :db.type/keyword}}))
(d/transact conn [{:my-type :ddd/test}])
(d/q '[:find ?x
:where
[?x :my-type ddd/test]]
(d/db conn))
=> #{[1]} ; should not work at all, or be empty, because I passed ddd/test instead of :ddd/test.
I looks like a feature. But then the following query should also work.
(d/q '[:find ?x
:where
[?x :my-type :ddd/test]
[?x :my-type ddd/test]]
(d/db conn))
=> #{}the last query should not work, as it is saying the entity attribute having two different values.
Yes. But when you swap the two where clauses, then the last query works.
interesting