Database Reference
In-Depth Information
Now we can run this and send the results to the standard output:
user=> (?- (stdout) census-joined)
RESULTS
-----------------------
Abingdon town 8191 4271 2056 7681 257 15 86
6
Accomac town 519 229 117 389 106 0 3
1
Adwolf CDP 1530 677 467 1481 17 1 4
0
Alberta town 298 163 77 177 112 4 0
0
Alexandria city 139966 72376 30978 85186 30491 589 8432
141
Altavista town 3450 1669 928 2415 891 5 20
0
Amherst town 2231 1032 550 1571 550 17 14
0
Annandale CDP 41008 14715 9790 20670 3533 212 10103
53
Appalachia town 1754 879 482 1675 52 4 2
0
Appomattox town 1733 849 441 1141 540 8 3
0
Aquia Harbour CDP 6727 2300 1914 5704 521 38
150
How it works…
In every recipe so far, we've used the ?<- macro, which is a combination of <- and ?- .
The arrow, <- , allows you to create and compose queries. The ?- executes the query and
sends the results to a sink. Using the combined ?<- macro is convenient, but using the
separate ones can be more powerful.
Transforming data with Cascalog
Often, simply querying data won't do everything you need to do. The data might not be in a
form you can use, for instance. In that case, you'll need to transform the data. You can easily
do this in Cascalog.
For this recipe, we'll deine a custom operation and use it to split year ranges of the form
'2000-2010' into two ields.
 
Search WWH ::




Custom Search