Exploring Astronomy Dataset Links with GridWorks
May 27th, 2010At ADS we are looking at new ways to index and provide full text searching for the Astronomy and Physics literature we manage to obtain, either through scanning + OCR of historical content, or from digital material provided by some publishers. Two options we’re looking at are Apache Solr and CDS-Invenio. But that’s not what this post is about.
While parsing and indexing a pile of about 42k articles from the past dozen or so years of the ApJ, AJ, ApJL and ApJS, formatted in the NLM XML schema, I noticed that many of the articles contained external links to various things, most interestingly, astronomical datasets.* My first thought was, “hmm, I wonder what’s at the other end of all those links…,” followed closely by, “hey, crawling those links would make a nice dataset to load into that nifty new Freebase Gridworks tool I heard about the other day.” So that’s what I did.
Out of 13652 articles there were 33600 total links which fell into three categories: http urls (28555), dataset links (938) and supplement links (4107). Dataset links consist of an identifier that looks something like ADS/Sa.CXO#obs/927. To get the goods you have to feed that id to a resolver which, assuming a valid identifier, will redirect you to the real location of the dataset. Supplement links took a bit more head-scratching as their values consisted of just a relative file name, like datafile3.txt or 69491.figures.html. We figured out that the solution was to append the filename to the publisher’s URL for the article, e.g., article and dataset or article and figures.
The ultimate objective was to load the results of crawling these links into Gridworks, but that means getting the data into csv or tsv form. Rather than have the crawl script output straight to csv, I stash the results in a MongoDB instance. Here’s an example of one of the resulting json documents in Mongo:
u'anchor_text': u'http://astronomy.swin.edu.au/staff/dforbes/glob.html',
u'bibcode': u'2001ApJ...556L..83F',
u'content': u'<HTML>\n<HEAD>\n<TITLE>Duncan A. Forbes, Swinburne University, Globular Clusters</TITLE>\n</HEAD>\n\n<h1> Globular Cluster Research</h1>\n\nI am interested in various aspects of Extragalactic Globular\n Cluster research. In particular the formation and evolution\n of Globular Cluster Systems and their host galaxies. \n<br>\n\n<UL>\n<A HREF="colours.html">GLOBULAR CLUSTER PHOTOMETRY DATABASE</A>\n</UL>\n\n<UL>\n<A HREF="spectra.html">GLOBULAR CLUSTER SPECTRAL DATABASE</A>\n</UL>\n\n\n<UL>\n<A HREF="review.html">GLOBULAR CLUSTER REVIEW PAPERS</A>\n</UL>\n\n\n<UL>\n<A HREF="http://www.ucolick.org/~brodie/Sages/sages.html"> SAGES PROJECT</A>\n</UL>\n\n<UL>\n<A\n\t HREF="http://www.physics.mcmaster.ca/resources/fs3_resources.html"> HARRIS DATABASE</A>\n</UL>\n\n\n\n<tr><td><hr noshade></td></tr>\n\n </BODY>\n',
u'context': u'<p>The combined sample data are available at <ext-link ext-link-type="uri" xlink:href="http://astronomy.swin.edu.au/staff/dforbes/glob.html">http://astronomy.swin.edu.au/staff/dforbes/glob.html</ext-link>. </p>\n',
u'doi': u'10.1086/323006',
u'ft_source': u'/proj/ads/articles/sources/AAS/ApJL/2001/556/2/323006/323006.xml',
u'link_id': u'http://astronomy.swin.edu.au/staff/dforbes/glob.html',
u'link_type': u'UrlLink',
u'response': {u'accept-ranges': u'bytes',
u'content-length': u'781',
u'content-location': u'http://astronomy.swin.edu.au/~dforbes/glob.html',
u'content-type': u'text/html; charset=UTF-8',
u'date': u'Tue, 25 May 2010 10:14:07 GMT',
u'server': u'Apache/2.2.15 (Unix) DAV/2 mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5',
u'status': u'200'},
u'solr_id': u'31908',
u'url': u'http://astronomy.swin.edu.au/staff/dforbes/glob.html',
u'xpath': u'/html/article/body/sec[5]/fn-group/fn/p/ext-link'}
From there it was easy to dump what I needed to csv and load into Gridworks. I’m not going to get into how totally awesome the Gridworks software is, except to say you should watch the demo videos.
I can’t post the entire Gridworks project, but here’s some screencaps, a column list and some of the more interesting facets.
Column list:
- Id of the MongoDB doc
- Id of the solr doc
- ADS bibcode identifier of the article
- Publication year – derived from the bibcode
- DOI
- xpath expression of the <ext-link> element
- parent tag – the containing element type
- link context – the containing element’s serialized xml contents
- link type – one of url, dataset or supplement
- anchor text – the text contents of the <ext-link>
- full text source file
- journal
- full text source – publisher
- extlink id – either the url or the dataset id or the supplement filename
- domain – derived from the url
- status – http status returned when requesting the resource
- content-type – content-type header returned in the response
- mimetype – derived from the content-type response header
- location – the final url of the resource following any redirects
- content length
- response headers – list of all the header attribute names return in the response (just to see what other interesting stuff might be there)

~70% 200's was more than I expected. Of course 200 doesn't mean it actually found something interesting.

All the gcn.gsfc.nasa.gov hits look like observation reports, like this one, which I think is a good thing
Finally a thanks to Sean Hannan who worked out a hack to a bit of the Gridworks javascript that automatically turns any cell values beginning with “http://” or “https://” into active links. The nice thing about that was it let me turn the column containing the MongoDB id into a link to a little web.py script that dumps a JSON representation of the document.
* NLM allows for links to external resources using either <ext-link> or <supplementary-material> elements.







May 28th, 2010 at 9:17 pm
Thank you for this. I learned a lot from this article, and I will be able to use quite a few techniques from it. I’ve been waiting to see what the next version of Exhibit would look like. Huynh is a genius.
March 21st, 2013 at 12:02 pm
Hello! I’ve been reading your web site for a long time now and finally got the bravery to go ahead and give you a shout out from New Caney Tx! Just wanted to say keep up the fantastic work!
April 14th, 2013 at 10:48 pm
The middle child went upstairs and returned shortly
wearing a nice pair of casual summer shoes. A lot of consumers have enjoyed the shopping as well as walking experience with these
UGG boots. Matching with skinny jeans, they present you
with a sleek tucked-in look.
April 28th, 2013 at 6:14 pm
At the other end of the scale, when subjected to lower temperatures, the oil does not become cloudy, which indicates that any naturally occurring waxes and gums have been
carefully filtered out. My hypothesis is that Vitilago is a systemic
fungal condition similar to, if not, Candidiasis (yeast overgrowth).
It can be controlled fairly easily with the use of proprietary medicines such as aspirin, but travelling along with the use of
any drugs are negative side-effects.