How to build a conditional steps using ogre

25 views
Skip to first unread message

Fairuz WAN ISMAIL

unread,
Dec 29, 2014, 11:27:50 PM12/29/14
to clojure-...@googlegroups.com
Hi,

I'm having trouble building a conditional query. 

I'm hoping to have something like 

(oq/query 
   (tv/find-by-kv tx :label "Restaurant")
   (if-not (nil? FOO) 
        (oq/--> [:featured-in])
        (oq/has :name "RESTOFTHEMONTH"))
   oq/into-list!)

Is it possible to achieve this kind of query? Thanks

Simon Belak

unread,
Jan 5, 2015, 10:35:54 AM1/5/15
to clojure-...@googlegroups.com
query is just a glorified ->, try using cond-> or ?> from https://github.com/Prismatic/plumbing or factor it out to a seperate fn. 

If you need branching based on where you are in your pipeline, Gremlin has ifThenElse [http://gremlindocs.com/#branch/ifthenelse], but it doesn't seem to be implemented yet in Ogre (but it shouldn't be too dificult to write your own wrapper following the examples in Ogre source). 

Fairuz WAN ISMAIL

unread,
Jan 7, 2015, 12:42:01 AM1/7/15
to clojure-...@googlegroups.com
Oh thanks, I just realized it really is just a glorified ->. I end up adding an anonymous function in the chain.

Something like: ((fn [v] ...))

Thanks.
Reply all
Reply to author
Forward
0 new messages