1

I was wondering how far down cascalog traps boiled down using the following example.

(defn -main
 "Good ole main boilerplate"
 [people-path trap-path output-path]
 (?- (hfs-textline output-path)
     (people-query (hfs-textline trap-path)
                   (hfs-textline people-path))))

(defn people-query
  "The people query!"
  [trap-path people-path]
  (<- [?first-name ?last-name ?daily-visits]
      (:trap trap)
      (some-generic-parsing-to-tuple-fn people-path :> ?fname ?lname)
      (c/count ?daily-visits)))

If some-generic-parsing-to-tuple-fn is called within the scope of the people-query (which contains the (:trap trap) will the sub query also have access to that trap or should the some-generic-parsing-to-tuple-fn also contain the trap information i.e.

 (some-generic-parsing-to-tuple-fn trap-path people-path :> ?fname ?lname)

TL;DR How much do I need to pass around traps in Cascalog queries in order to allow nested queries to have access to the trap

mcgeep
  • 53
  • 6
  • Have you tested it in the REPL? – Paul Lam Oct 03 '13 at 11:35
  • Yes, the answer ended up being in this case the trap would be applied to the subquery in the testing I did. The idea that my co-worker came up with and it makes sense is that the query planner applies the trap to all subsequent queries that are nested under the trap. If it's not that way someone please correct me. – mcgeep Oct 03 '13 at 18:28

0 Answers0