
Extract a Spatial Model from Wikipedia #45
Chapter 4, Mapping (on) the Web
|
203
HACK
available for Linux distributions (you can get it in Debian by running apt-
get install graphviz
as root). The GraphViz Perl module allows us to easily
get at it programmatically.
Figure 4-18 shows the graph of a small section of Wikipedia’s spatial rela-
tions, centered on the UK. The graph of all spatial interconnections in Wiki-
pedia is too big for GraphViz to easily handle!
Hacking the Hack
You can use these techniques with any corpus of text that you have on a
disk somewhere, over which it might be useful to have a spatial index. A col-
lection of news articles or RSS feeds that you want to display on a map, or
old email archives to map project activity.
We chose to ignore pages whose titles were numbers. Collecting all pages
whose titles are four digits and/or that match the expression
/As of ^\d{4}$/,
you could build a pretty nice temporal index of Wikipedia. Imagine a map
where you adjust a knob and see local content and political boundaries
change through time. “As of” is a recent naming convention for dating pages,
sometimes used in different ways, and the temporal index probably won’t
reveal much depth yet, but Wikipedia is always growing and refining itself.
Figure 4-18. Graphing some of the spatial relations in Wikipedia