Querying data with Cascalog
In the Initializing Cascalog and Hadoop for distributed processing recipe, we looked at how to query data in Cascalog with a couple of small examples. However, Cascalog's query language is much more powerful than what we saw here. We'll dive in further in this recipe and start looking at some of the logical predicates available. Recipes in the later part of this chapter will have still more examples of querying with Cascalog.
Getting ready
For this recipe, we'll need the project.clj
dependencies and imports from the Initializing Cascalog and Hadoop for distributed processing recipe. We'll also use the data from that recipe: the sequences of information about the companions and actors from the British television program Doctor Who.
How to do it…
For the first example, we'll get the first five actors who played the role of the doctor:
(?<- (stdout) [?n ?actor ?period] (actor ?n ?actor ?period) (<= ?n 5)) … RESULTS ----------------------- 1 William Hartnell...