Database Reference
In-Depth Information
How to do it…
We'll start with simple queries and build up from there:
1.
First, let's take a look at a simple join:
user=> (?<- (stdout) [?name ?dr]
(full-name ?c ?name) (doctor ?c ?dr) )
RESULTS
-----------------------
Ace 7
Adam Mitchell 9
Adelaide Brooke 10
Adric 4
Adric 5
Amy Pond 11
Astrid Peth 10
This pulls each companion's full name from one table and the numbers of Doctors
they accompanied from another table. The binding for the companion's key, ?c , stays
the same across all the generators and predicates for each row of the output. Also,
notice that the second predicate (doctor ?c ?dr) can generate more than one
row of output for each value of ?c , as it did for Adric.
2.
Let's take a look at one that's slightly more complex:
user=> (?<- (stdout)
[?name ?dr ?actor ?tenure]
(full-name ?c ?name) (doctor ?c ?dr)
(actor ?dr ?actor ?tenure) )
RESULTS
-----------------------
Ace 7 Sylvester McCoy 1987-89, 1996
Adam Mitchell 9 Christopher Eccleston 2005
Adelaide Brooke 10 David Tennant 2005-10
Adric 4 Tom Baker 1974-81
Adric 5 Peter Davison 1981-84
Amy Pond 11 Matt Smith 2010-present
Astrid Peth 10 David Tennant 2005-10
This time, we've reused the same query as the preceding one, but we've also included
the table of actors who've played Doctor Who .
 
Search WWH ::




Custom Search