Open atroche opened 8 years ago
Well, it is in a sense that I haven’t thought about someone would use it this way. I’ll think what can be done about that. Meanwhile, you can rewrite your query like this:
(d/q '[:find ?e
:in $ ?client-squuid
:where [?t :thing/squuid ?client-squuid]
[?e :appointment/client ?t]]
(d/db conn)
#uuid "5664cb92-8256-49f9-a7ff-30d3d00939c4")
Thanks @tonsky. It's definitely not the end of the world =)
On 11 December 2015 at 21:18, Nikita Prokopov notifications@github.com wrote:
Well, it is in a sense that I haven’t thought about someone would use it this way. I’ll think what can be done about that. Meanwhile, you can rewrite your query like this:
(d/q '[:find ?e :in $ ?client-squuid :where [?t :thing/squuid ?client-squuid] [?e :appointment/client ?t]](d/db conn)
uuid "5664cb92-8256-49f9-a7ff-30d3d00939c4")
— Reply to this email directly or view it on GitHub https://github.com/tonsky/datascript/issues/137#issuecomment-163901698.
-- Alistair
Aha! I was wondering why this didn't work:
(d/q '[:find ?film-name (distinct ?actor)
:in $ ?a1 ?a2
:where
[?film :film/name ?film-name]
[?film :film/cast [:actor/name ?a1]]
[?film :film/cast [:actor/name ?a2]]
[?film :film/cast ?actor]
]
@conn
"Nancy Allen"
"Peter Weller")
; => ClassCastException clojure.lang.Symbol cannot be cast to java.lang.String java.lang.String.compareTo (String.java:111)
while this did:
(d/q '[:find ?film-name (distinct ?actor)
:where
[?film :film/name ?film-name]
[?film :film/cast [:actor/name "Nancy Allen"]]
[?film :film/cast [:actor/name "Peter Weller"]]
[?film :film/cast ?actor]]
@conn)
; => (["RoboCop" [46 47 45]])
and this is why :D luckily, I'm making my query map programmatically and can work around this that way. Thought I was going crazy because the query map worked, strings as literal arguments worked, just strings as input arguments didn't.
Hi, I'm trying to do a query using lookup refs, using an input variable in the lookup ref, like this:
When I do the above, I get:
even though this:
works fine.
Is this expected behaviour?
Cheers!