<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eat your greens! &#187; geekage</title>
	<atom:link href="http://eatyourgreens.org.uk/category/geekage/feed" rel="self" type="application/rss+xml" />
	<link>http://eatyourgreens.org.uk</link>
	<description>Actually, I am a rocket scientist</description>
	<lastBuildDate>Mon, 22 Aug 2011 16:53:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Get excited and make things with science</title>
		<link>http://eatyourgreens.org.uk/archives/2010/06/get-excited-and-make-things-with-science.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2010/06/get-excited-and-make-things-with-science.html#comments</comments>
		<pubDate>Fri, 25 Jun 2010 00:30:46 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[astronomy]]></category>
		<category><![CDATA[geekage]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=631</guid>
		<description><![CDATA[Last weekend, 19th &#38; 20th June 2010, saw the first Science Hack Day at the Guardian offices in London. Jeremy Keith organised a venue, food and drink and sponsorship for around 100 people to spend two days building small science projects. Saturday morning saw a series of short talks to introduce the event,  give people [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend, 19th &amp; 20th June 2010, saw the first <a href="http://sciencehackday.com">Science Hack Day</a> at <a href="http://guardian.co.uk">the Guardian</a> offices in London. <a href="http://adactio.com">Jeremy Keith</a> organised <a href="http://adactio.com/journal/1674/">a venue, food and drink and sponsorship</a> for around 100 people to spend two days building small science projects. Saturday morning saw a series of short talks to introduce the event,  give people some ideas of what they might make, and what tools were available to help them make it. 24 hours of hacking and building followed, with presentations and prizes for the best hacks on Sunday afternoon. Ed Gomez has a great <a href="http://lcogt.net/en/blog/egomez/science-hack-day">write-up of the hack day</a> itself, and the winning hacks. My personal favourites were the Aurorascope, which shows auroral activity by lighting up LEDs inside a ball representing the Earth, and <a href="http://randomorbit.net">Random Orbit</a>, a RESTful service to track satellites in real time.</p>
<p>I was asked by Jeremy to give one of the talks at the beginning of the hack day, so I chatted a bit about the work we&#8217;ve done with <a href="http://astrometry.net">astrometry.net</a> to tag Flickr photos with their celestial locations — astrotagging.</p>
<h3><span id="more-631"></span>Introducing astrotags</h3>
<p>At the <a href="http://www.nmm.ac.uk/places/royal-observatory/">Royal Observatory, Greenwich</a>, we&#8217;ve set up a Flickr group for our photography competition, <a href="http://flickr.com/groups/astrophoto">Astronomy Photographer of the Year</a>. Photos in the group are being scanned by the <a href="http://http://www.nmm.ac.uk/visit/exhibitions/astronomy-photographer-of-the-year/astro-robot/">astrometry.net bot</a>, which identifies stars in a photo then solves for celestial coordinates by comparison with a reference catalogue. Astrometry.net leaves a comment on each photo, listing the coordinates of the image and the names of objects within the field of view. The comments are relatively easy to parse, and I&#8217;ve written a <a href="/archives/2010/01/generating-astrotags-for-flickr-photos.html">small utility</a> to extract information from commented photos. However, this is the sort of problem that&#8217;s ideally suited to <a href="http://www.flickr.com/groups/api/discuss/72157594497877875/">machine tags</a> so we asked astrometry.net to add tags to photos in our group using the astro: prefix. The tags are:</p>
<dl>
<dt>astro:RA</dt>
<dd>Right Ascension of the centre of the photo.</dd>
<dt>astro:dec</dt>
<dd>Declination of the centre of the photo.</dd>
<dt>astro:orientation</dt>
<dd>Orientation of the photo from North, in degrees.</dd>
<dt>astro:fieldsize</dt>
<dd>Angular extent of the photo, East-West × North-South.</dd>
<dt>astro:name</dt>
<dd>Named objects in the field. One tag per name.</dd>
</dl>
<p>Some good examples of tagged photos are:</p>
<ul>
<li><a href="http://www.flickr.com/photos/36418300@N02/3362016992/">Horsehead Nebula</a></li>
<li><a href="http://www.flickr.com/photos/strongman/3476473934/">Eta Carina Nebula</a></li>
<li><a href="http://www.flickr.com/photos/31557673@N05/2955988513/">Summer Triangle and Milky Way</a></li>
</ul>
<p>The simplest way to get at these machine tags and use them in your own applications is with <a href="http://developer.yahoo.com/yql/">YQL</a>, which allows you to query the flickr search and photo info APIs using a simple, SQL-like syntax. To make life easier, I&#8217;ve written a <a href="http://developer.yahoo.com/yql/guide/yql-opentables-chapter.html">YQL open table</a>, <a href="http://github.com/yql/yql-tables/blob/master/flickr/flickr.photos.astro.xml">flickr.photos.astro</a>, which can be queried to return a feed of astronomical coordinates and info for a set of Flickr photos.</p>
<pre class="brush: sql; title: ; notranslate">select * from flickr.photos.astro where astro_name = 'Horsehead Nebula'</pre>
<p>That query, for example, returns <a href="http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20flickr.photos.astro%20where%20astro_name%3D'Horsehead%20Nebula'&amp;diagnostics=true&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys">a feed of photos tagged astro:name=&#8217;Horsehead Nebula&#8217;</a>. For some other examples, have a look at my post on <a href="/archives/2009/12/searching-astroname-with-yql.html">searching astro:name with YQL</a>.</p>
<h3>My hack</h3>
<p>Astrometry.net have <a href="http://www.flickr.com/photos/tags/Astrometrydotnet%3Astatus%3Dsolved/">solved almost 7,000 photos</a> on Flickr, but only <a href="http://www.flickr.com/photos/tags/astro:ra=">around 600 of those</a> have been tagged with astro: machine tags. For my hack, I decided to try making a YQL table based on screen-scraping Flickr for information left by the astrometry.net robot. I took the code from my <a href="/testapps/yql/astrotagger.html">astrotagging web form</a> and put together <a href="http://github.com/eatyourgreens/yql-tables/blob/master/flickr/flickr.photos.astrometry.xml">flickr.photos.astrometry</a>, a YQL open table that can parse astrometry information from Flickr comments. The input parameter is a Flickr photo page URL, so a query looks like</p>
<pre class="brush: sql; title: ; notranslate">select * from flickr.photos.astrometry where url = 'http://www.flickr.com/photos/dangerous_astro/4722913544/'</pre>
<p>This returns <a href="http://query.yahooapis.com/v1/public/yql?q=use%20%27http%3A%2F%2Fgithub.com%2Featyourgreens%2Fyql-tables%2Fraw%2Fmaster%2Fflickr%2Fflickr.photos.astrometry.xml%27%3B%20select%20*%20from%20flickr.photos.astrometry%20where%20url%20%3D%20%27http://www.flickr.com/photos/dangerous_astro/4722913544/%27&amp;diagnostics=true">a feed of the coordinates and names</a> found on that page.</p>
<p>To demo this, I hacked together a little javascript <a href="http://eatyourgreens.org.uk/yql/scihackday.html?text=rosette+nebula">astronomy photo search engine</a>. You pass in a search query in the URL:</p>
<p><a href="http://eatyourgreens.org.uk/yql/scihackday.html?text=milky+way">http://eatyourgreens.org.uk/yql/scihackday.html?text=milky+way</a></p>
<p>That text is then used to run a Flickr search and grab up to 30 photos, shown as thumbnails. The search is limited to photos which have been solved by astrometry.net, and we also request the photographer&#8217;s name so that we can credit them:</p>
<pre class="brush: sql; title: ; notranslate">select * from flickr.photos.search(30) where text = 'milky way' and extras='owner_name' and machine_tags = 'Astrometrydotnet:status=solved'</pre>
<p>If you don&#8217;t pass in a search query, we instead return the 30 most recent photos solved by astrometry.net.</p>
<pre class="brush: sql; title: ; notranslate">select * from flickr.photos.search(30) where extras='owner_name' and machine_tags = 'Astrometrydotnet:status=solved'</pre>
<p>When you select a thumbnail, by clicking on it, another YQL query is run against flickr.photos.astrometry to return the coordinates and names for that photo. The coordinates are used to plot the photo on a map of the sky, while the names are listed as links so that you can go on to search for pictures of specific objects in the field of view.</p>
<p>It&#8217;s quite a simple little bit of code, but hopefully it shows how useful YQL can be for accessing structured data on the web, even when that data is in HTML or plain text. If anyone does use it to build anything, Astronomy Photographer of the Year has <a href="http://www.nmm.ac.uk/visit/exhibitions/astronomy-photographer-of-the-year/showcase/">a showcase page</a> for mashups built using the Flickr astrometry data.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2010/06/get-excited-and-make-things-with-science.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solving a browser bug with invalid HTML</title>
		<link>http://eatyourgreens.org.uk/archives/2010/02/solving-a-browser-bug-with-invalid-html.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2010/02/solving-a-browser-bug-with-invalid-html.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 22:26:53 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[geekage]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=624</guid>
		<description><![CDATA[Recently, I&#8217;ve been involved in building Solar Stormwatch, a citizen science project which asks people to look for Coronal Mass Ejections by watching videos of data recorded by the wide-field cameras on the STEREO spacecraft. We ask people a series of questions about each video and record their answers. The answers they submit then determine [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I&#8217;ve been involved in building <a href="http://solarstormwatch.com">Solar Stormwatch</a>, a <a href="http://citizensciencealliance.org/">citizen science</a> project which asks people to look for <a rel="tag" href="http://en.wikipedia.org/wiki/Coronal_mass_ejection">Coronal Mass Ejections</a> by watching videos of data recorded by the wide-field cameras on the <a href="http://www.nasa.gov/mission_pages/stereo/main/index.html">STEREO spacecraft</a>. We ask people a series of questions about each video and record their answers. The answers they submit then determine subsequent questions that they&#8217;ll be asked. Answers are tracked in the underlying <abbr title="Application Programming Interface">API</abbr> by assigning each answer a numerical ID, so the markup for an answer looks something like this (using HTML buttons for each answer):<br />
<code>&lt;button value=&quot;2&quot;&gt;Ahead&lt;/button&gt;</code></p>
<p>If the site user wants to pick the answer &#8216;Ahead&#8217; to a question, they click this button. With <a href="http://jquery.com">jQuery</a>, I get the value of the button (2) using <code>var answer_id = $(this).val()</code>. Users confirm their answer by pressing a &#8216;Next&#8217; button to move onto the next question:</p>
<p><code>&lt;button id=&quot;next&quot; value=&quot;&quot;&gt;Next&lt;/button&gt;</code></p>
<p>I decided to use the &#8216;Next&#8217; button to store the currently selected answer: <code>$('#next').val(answer_id)</code>. I can then look at the value of the &#8216;Next&#8217; button to decide which question to ask next when they submit an answer. All fairly straightforward HTML and JavaScript, which works in any standards-compliant web browser.</p>
<p>However, after launching the site we started to get strange bug reports on <a href="http://www.galaxyzooforum.org/index.php?board=32.0">the Solar Stormwatch forum</a>. Buttons were displaying numbers instead of words as their labels. Questions were repeating rather than moving onto the next question for a given answer. It turns out there is a bug in IE6 and IE7, which was being picked up by our users &mdash; IE6 and IE7 do not support the <code>value</code> attribute on buttons.</p>
<p>In IE6 and IE7, calling <code>$(this).val()</code> returns the text of a button &mdash; &#8216;Ahead&#8217; in the example given above. Similarly, setting <code>.val()</code> for a button sets the button text, not its value. My first reaction was to change my jQuery code to use <code>.attr('value')</code> to access the <code>value</code> attribute instead. This runs into exactly the same underlying browser bug &mdash; <code>.attr('value')</code> gets and sets the button text in IE6 and 7.</p>
<p>To solve this, and get the questions working in IE, I ended up changing the <code>value</code> attribute on buttons to <code>data-value</code>. This is invalid in HTML 4, though it will be valid in HTML 5.</p>
<pre>
<code>&lt;button data-value=&quot;2&quot;&gt;Ahead&lt;/button&gt;</code>
</pre>
<p>This works, however, because the default behaviour of HTML parsers in all the major browsers is the same when they encounter an attribute they don&#8217;t understand. They simply add it to the <abbr title="Document Object Model">DOM</abbr> as a property of the current node ie. you get something like <code>button.data-value=2</code>. So, wherever I had used <code>.val()</code> in my jQuery code, I now use <code>.attr('data-value')</code> to get and set the value of buttons.</p>
<p>I&#8217;m not hugely happy with this solution. It&#8217;s invalid HTML and relies on default error-handling behaviour in HTML parsers. It does work cross-browser, and it is robust in that HTML parsers aren&#8217;t likely to change the way they handle unrecognised attributes. I wish Internet Explorer supported the standards-compliant, valid solution though.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2010/02/solving-a-browser-bug-with-invalid-html.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating astrotags for Flickr photos</title>
		<link>http://eatyourgreens.org.uk/archives/2010/01/generating-astrotags-for-flickr-photos.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2010/01/generating-astrotags-for-flickr-photos.html#comments</comments>
		<pubDate>Sun, 03 Jan 2010 12:46:06 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[astronomy]]></category>
		<category><![CDATA[geekage]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=603</guid>
		<description><![CDATA[In December, I talked at London Web Standards about tagging astronomy photos with position and name information. I mentioned that around 400 photos have been tagged already on Flickr but this is only a tiny fraction of the 4,900 photos that have been solved by astrometry.net. It would be great if the remaining 4,500 photos [...]]]></description>
			<content:encoded><![CDATA[<p>In December, I talked at <a href="http://londonwebstandards.org/">London Web Standards </a>about <a href="http://eatyourgreens.org.uk/archives/2009/12/london-web-standards-introducing-astrotags.html">tagging astronomy photos with position and name information</a>. I mentioned that <a href="http://www.flickr.com/photos/tags/astro:ra=">around 400 photos</a> have been tagged already on Flickr but this is only a tiny fraction of the 4,900 photos that have been <a href="http://www.flickr.com/photos/tags/Astrometrydotnet%3Astatus%3Dsolved/">solved by astrometry.net</a>. It would be great if the remaining 4,500 photos could also be tagged, and it ought to be straightforward to generate tags for those photos too. Inspired by the <a href="http://inaturalist.org/taxa/flickr_tagger?taxon_id=4981">iNaturalist Taxonomic Tagging Tool</a>, I&#8217;ve written a little <a href="http://eatyourgreens.org.uk/testapps/yql/astrotagger.html">astrotagging form for Flickr photos</a>.</p>
<p>When the <a href="http://astrometry.net">astrometry.net</a> robot solves a photo on Flickr, it leaves a comment identifying the coordinates of the photo and listing the names of objects in the field.</p>
<blockquote cite="http://www.flickr.com/photos/eatyourgreens/4182924966/comment72157623004301204/">
  <p>Hello, this is the blind astrometry solver.
  Your results are:<br/>
   (RA, Dec) center:(82.4668973542,
  6.33857270637) degrees<br/>
  (RA, Dec) center (H:M:S,
  D:M:S):(05:29:52.055, +6:20:18.862)<br/>
  Orientation:161.45 deg E of N<br/>
  <br/>
  Pixel scale:67.93 arcsec/pixel<br/>
  <br/>
  Parity:Reverse (&#8220;Left-handed&#8221;)<br/>
  Field size :53.14 x 39.85 degrees<br/>
  <br/>
  Your field contains:<br/>
  The star Rigel (&beta;Ori)<br/>
  The star Betelgeuse (&alpha;Ori)<br/>
  The star Aldebaran (&alpha;Tau)<br/>
  The star Bellatrix (&gamma;Ori)<br/>
  The star Alnilam (&epsilon;Ori)<br/>
  The star Alhena (&gamma;Gem)<br/>
  The star Alnitak (&zeta;Ori)<br/>
  The star Saiph (&kappa;Ori)<br/>
  The star Mintaka (&delta;Ori)<br/>
  The star Cursa (&beta;Eri)<br/>
  IC 2118 / IC 2118 / Witch Head nebula<br/>
  NGC 1976 / NGC 1976 / Great Nebula in Orion
  / M 42<br/>
  NGC 1990 / NGC 1990<br/>
  IC 434 / IC 434 / Horsehead nebula<br/>
  IC 443 / IC 443<br/>
  NGC 2264 / NGC 2264 / Christmas Tree cluster
  / Cone nebula<br/>
  <br/>
  <a rel="nofollow" href="http://www.worldwidetelescope.org/wwtweb/ShowImage.aspx?reverseparity=False&amp;scale=67.93&amp;name=Orion,+Taurus+and+Gemini&amp;imageurl=http://farm3.static.flickr.com/2689/4182924966_9a291b6c39_o.jpg&amp;credits=Jim+O'Donnell+(Attribution-NonCommercial-ShareAlike+License)&amp;creditsUrl=http://creativecommons.org/licenses/by-nc-sa/2.0/&amp;ra=82.4668973542&amp;y=1056&amp;x=1408&amp;rotation=161.45&amp;dec=6.33857270637&amp;thumb=http://farm3.static.flickr.com/2689/4182924966_89b3009869_t.jpg">View in World Wide Telescope</a><br/>
  <br/>
  &#8212;&#8211;<br/>
  If you would like to have other images
  solved, please submit them to the <a href="http://www.flickr.com/groups/astrometry">astrometry group</a>.
  																<br/>

  								<small>
  									Posted 3 weeks ago.
  									( <a class="Plain" href="/photos/eatyourgreens/4182924966/comment72157623004301204/">permalink</a>
  														| <a class="Plain" href="/photos/eatyourgreens/4182924966/deletecomment72157623004301204/">delete</a>
  																)
  								</small>
  								</p>
</blockquote>
<p>These comments are always in the same format, so it&#8217;s straightforward to parse them and extract the astrometry metadata as a list of tags. I&#8217;ve written a small form which does this, using <abbr title="Yahoo! Query Language">YQL</abbr> to grab the comments from a Flickr photo then parsing them using standard <abbr title="Document Object Model">DOM</abbr> traversal and manipulation methods.</p>
<p>If you have a photo which has been solved, generating tags is straightforward. Copy the address of a Flickr photo page into the <a href="http://eatyourgreens.org.uk/testapps/yql/astrotagger.html">tagging form</a> and press the big blue &#8216;Get astrotags&#8217; button. The script should find the comment from astrometry.net and print out the tags for celestial coordinates and names, which you can then paste into the &#8216;Add a tag&#8217; form on Flickr.</p>
<p>The code to do this is fairly simple, and reproduced below. After initialising the page, we can take advantage of YQL&#8217;s HTML parser to fetch all of the comments for a Flickr photo page by selecting all paragraphs inside divs with a class of &#8216;comment-content&#8217; at that URL.</p>
<pre class="brush: sql; title: ; notranslate">
select * from html where url='http://www.flickr.com/photos/eatyourgreens/4182924966/' and xpath='//div[@class=&quot;comment-content&quot;]/p'
</pre>
<p>We then loop through the results of this query, looking for paragraphs which contain the text &#8216;blind astrometry solver&#8217;. If we have a match, we add this paragraph to the DOM so we can parse it with standard DOM methods. The code then loops through the child nodes of the comment paragraph, running regular expression matches against any text nodes it finds to extract the coordinates of the photo. </p>
<p>Names are slightly more tricky. For those, we grab every line of text between &#8216;Your field contains:&#8217; and the line &#8216;&#8212;&#8211;&#8217; above the signature, strip out whitespace, split each line on &#8216;/&#8217; to get individual names and store these in an associative array, keyed on name to remove duplicates. That done, we can then just loop through the arrays of coordinates and names and print them out.</p>
<p>Here&#8217;s the full code:</p>
<pre class="brush: jscript; title: ; notranslate">
 var url = &quot;http://www.flickr.com/photos/skiwalker79/4174398309&quot;;
 var comment_holder;
 var position_output;
 var names_output;
 
 function init() {
   var url_input = document.getElementById('photoURL');
   var url_button = document.getElementById('updateURL');
   
   comment_holder = document.getElementById('comment');
   position_output = document.getElementById('position');
   names_output = document.getElementById('names');
   
   url_input.disabled = false;
   url_input.value = url;
   url_button.disabled = false;
   position_output.disabled = false;
   names_output.disabled = false;
   
   addEvent(url_button, 'click', function(e) {
     getFlickrPhotoComments(url_input.value);
     return false;
   });
   addEvent(url_input, 'focus', function(e) {
     url_input.select();
   });
   addEvent(position_output, 'focus', function(e) {
     position_output.select();
   });
   addEvent(names_output, 'focus', function(e) {
     names_output.select();
   });
   
   // Mark up nodes which this script updates as
   // ARIA live regions.
   comment_holder.setAttribute('aria-live', 'polite');
   position_output.setAttribute('aria-live', 'polite');
   names_output.setAttribute('aria-live', 'polite');
   
   getFlickrPhotoComments(url);    
 }

 function getFlickrPhotoComments(url) {

   // YQL query to get all comments from a Flickr photo page.
   var yql = &quot;select * from html where url='&quot;+url+&quot;' and xpath='//div[@class=\&quot;comment-content\&quot;]/p'&quot;;
   var yql_url = 'http://query.yahooapis.com/v1/public/yql?q='+escape(yql)+'&amp;format=xml&amp;callback=getAstrometryComment&amp;diagnostics=false';
   position_output.value = '';
   names_output.value = '';
   comment_holder.innerHTML = 'Looking up '+url;
   makeYQLRequest(yql_url);
 }
 
 function makeYQLRequest(yql_url) {
   var script=document.getElementById('yqlscript');
   var newscript=document.createElement('script');
   newscript.type = 'text/javascript';
   newscript.src=yql_url;
   newscript.id='yqlscript';
   document.getElementsByTagName(&quot;body&quot;)[0].removeChild(script);
   document.getElementsByTagName(&quot;body&quot;)[0].appendChild(newscript);
 }

function getAstrometryComment(data) {
  var results = data.results;
  
  var comment = 'Sorry, that photo has not been solved by &lt;a href=&quot;http://astrometry.net&quot;&gt;astrometry.net&lt;/a&gt;.';
  for (var i in results) {
    var text = results[i];
    // Comments left by the solver contain the text 'blind astrometry solver'.
    if(text.match(/blind astrometry solver/gi)) {
      comment = text;
    }
  }
  parseComment(comment);
  
}

function parseComment(comment) {
  var astro = {};
  var names = {};
  var parsing_names = false;
  
  comment_holder.innerHTML = comment;
  var children = comment_holder.firstChild.childNodes;
  
  for (var i in children) {
    var child = children[i];
    var text = '';
    text = child.data;
    
    if (text) {
      if (text.match(/(RA, Dec)/g) &amp;&amp; text.match(/degrees/g)) {
        text=text.match(/[-0-9\.]+/g);
        astro.RA = text[0];
        astro.Dec = text[1];
      } else if (text.match(/Orientation/g)) {
        text = text.match(/[-0-9\.]+/g);
        astro.orientation = text[0];
      } else if (text.match(/Pixel scale/g)) {
        text = text.match(/[0-9\.]+/g);
        astro.pixelScale = text[0];
      } else if(text.match(/Field size/g)) {
        text = text.match(/[0-9\.]+ x [0-9\.]+ (degrees|arcminutes|arcseconds)/g);
        astro.fieldsize = text[0];
      } else if(text.match(/Your field contains:/g)) {
        parsing_names = true;
      } else if (text.match(/-----/g)) {
        parsing_names = false;
      }

      if (parsing_names) {
        names = addNames(names, text);
      }
      
    }
  }

  renderPositionTags(astro);
  
  renderNameTags(names);
  
  if (astro.RA) {
    position_output.focus();
  }
}

function addNames(names, text) {
  
 text = trim(text);
 text = text.split('/');
 for (var j in text) {
   var name = text[j];
   name = trim(name);
   if (name &amp;&amp; name !='Your field contains:'){
     names[name] = name;
   }
 }
 return names;
}

function renderPositionTags(astro) {
  
  position_output.value = '';
   for (var tag in astro) {
     position_output.value += 'astro:'+tag+'=&quot;'+astro[tag]+'&quot; ';
   } 
}

function renderNameTags(names) {

  names_output.value = '';
   for (var name in names) {
     names_output.value += 'astro:name=&quot;'+name+'&quot; '
   }
}

function trim(text) {
  // Trim leading and trailing whitespace from a string.
  text = text.replace(/^\s+/, '');
  text = text.replace(/\s+$/,'');
  return text;
}

function addEvent(obj, evType, fn) {
  if (obj.addEventListener) {
    obj.addEventListener(evType, fn, false);
    return true;
  } else if (obj.attachEvent) {
    var r = obj.attachEvent(&quot;on&quot; + evType, fn);
    return r;
  } else {
    return false;
  }
}
</pre>]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2010/01/generating-astrotags-for-flickr-photos.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Searching astro:name with YQL</title>
		<link>http://eatyourgreens.org.uk/archives/2009/12/searching-astroname-with-yql.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2009/12/searching-astroname-with-yql.html#comments</comments>
		<pubDate>Sat, 19 Dec 2009 22:59:53 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[astronomy]]></category>
		<category><![CDATA[geekage]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/archives/2009/12/searching-astroname-with-yql.html</guid>
		<description><![CDATA[Searching astro:name with YQL, originally uploaded by Eat your greens!. The YQL team announced personal URLs for queries this week. I&#8217;ve used the new feature to set up a shortcut for looking up photos of astronomical objects by name. The URL is: http://queries.yahooapis.com/v1/public/yql/eatyourgreens/astrolookup?name=M+42 You can set the name parameter in the URL to change the [...]]]></description>
			<content:encoded><![CDATA[<p><a title="photo sharing" href="http://www.flickr.com/photos/eatyourgreens/4198668956/"><img style="border: solid 2px #000000;" src="http://farm3.static.flickr.com/2797/4198668956_e6490091f7.jpg" alt="" /></a></p>
<p style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/eatyourgreens/4198668956/">Searching astro:name with YQL</a>, originally uploaded by <a href="http://www.flickr.com/people/eatyourgreens/">Eat your greens!</a>.</p>
<p>The <abbr title="Yahoo! Query Language">YQL</abbr> team announced <a href="http://developer.yahoo.net/blog/archives/2009/12/yql_gets_personal_urls_and_more_cache_control.html">personal URLs for queries</a> this week. I&#8217;ve used the new feature to set up a shortcut for looking up photos of astronomical objects by name. The URL is:</p>
<p><a href="http://queries.yahooapis.com/v1/public/yql/eatyourgreens/astrolookup?name=M+42">http://queries.yahooapis.com/v1/public/yql/eatyourgreens/astrolookup?name=M+42</a></p>
<p>You can set the <code>name</code> parameter in the URL to change the name of the object you are looking for. I&#8217;ve also set up <a href="http://eatyourgreens.org.uk/testapps/yql/astronamesearch.html?name=Horsehead+nebula">a demo page</a> to render results from this query. The URL is:</p>
<p><a href="http://eatyourgreens.org.uk/testapps/yql/astronamesearch.html?name=Horsehead+nebula">http://eatyourgreens.org.uk/testapps/yql/astronamesearch.html?name=Horsehead+nebula</a></p>
<p>Again, change the <code>name</code> parameter in the URL to lookup different objects. Note that it looks for an exact match with the <code>astro:name</code> machine tag, so looking up stars is cumbersome:</p>
<p><a href="http://eatyourgreens.org.uk/testapps/yql/astronamesearch.html?name=the%20star%20deneb%20%28%CE%B1cyg%29">http://eatyourgreens.org.uk/testapps/yql/astronamesearch.html?name=the+star+deneb+(&alpha;cyg)</a></p>
<p><strong>Update:</strong> it seems Flickr&#8217;s machine tag search can match just the first part of a tag, so you can search for stars by supplying the first part of the tag&#8217;s value.</p>
<p><a href="http://eatyourgreens.org.uk/testapps/yql/astronamesearch.html?name=the+star+deneb">http://eatyourgreens.org.uk/testapps/yql/astronamesearch.html?name=the+star+deneb</a></p>
<p>I&#8217;ve also made some changes to <a href="http://github.com/eatyourgreens/yql-tables/blob/master/flickr/flickr.photos.astro.xml"><code>flickr.photos.astro</code></a> in order to enable faster searching by name. Use <code>astro_name</code> in a query to find objects by matching on <code>astro:name</code>:</p>
<pre class="brush: sql; title: ; notranslate">
select * from flickr.photos.astro where astro_name = 'M 31'
</pre>
<p>or use <code>text</code> to run a Flickr text search across photo descriptions and titles:</p>
<pre class="brush: sql; title: ; notranslate">
select * from flickr.photos.astro where text = 'orion'
</pre>
<p>If you want to see what values have been used for <code>astro:name</code> on Flickr, I recommend <a href="http://husk.org/code/machine-tag-browser.html#tag=astro:name">Paul Mison&#8217;s excellent machine tag browser</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2009/12/searching-astroname-with-yql.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>London web standards: Introducing astrotags</title>
		<link>http://eatyourgreens.org.uk/archives/2009/12/london-web-standards-introducing-astrotags.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2009/12/london-web-standards-introducing-astrotags.html#comments</comments>
		<pubDate>Tue, 15 Dec 2009 00:18:37 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[astronomy]]></category>
		<category><![CDATA[geekage]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=530</guid>
		<description><![CDATA[Here are the slides from my talk at the December LWS meetup &#8211; Introducing astrotags: astrometry, machine tags and YQL (20MB pdf). The examples and demos should all be in the YQL category on this blog. If you&#8217;re interested in the nuts and bolts of the automated astrometry robot, I recommend having a look at [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the slides from my talk at the December LWS meetup &#8211; <a href="/pdf/astrotags.pdf">Introducing astrotags: astrometry, machine tags and YQL</a>  (20MB pdf). The examples and demos should all be in the <a href="/category/yql">YQL category</a> on this blog.</p>
<p>If you&#8217;re interested in the nuts and bolts of the automated astrometry robot, I recommend having a look at <a href="http://astrometry.net">astrometry.net</a> and reading <a href="http://cosmo.nyu.edu/hogg/research/2006/09/28/astrometry_google.pdf">Making the sky searchable: Fast geometric hashing for automated astrometry</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2009/12/london-web-standards-introducing-astrotags.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Is it about elephants?</title>
		<link>http://eatyourgreens.org.uk/archives/2009/11/is-it-about-elephants.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2009/11/is-it-about-elephants.html#comments</comments>
		<pubDate>Mon, 30 Nov 2009 18:27:20 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[geekage]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=527</guid>
		<description><![CDATA[I found my copy of Ghastly Beyond Belief, Neil Gaiman and Kim Newman&#8217;s wonderful collection of quotations from science fiction and fantasy. Page 164 has this excellent exchange between Michael Moorcock and Thomas Disch. Tom Disch: I&#8217;m writing a book about what everyone wants most. Moorcock: Really? Is it about elephants? Disch: Elephants? No, it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I found my copy of <a href="http://www.fantasticfiction.co.uk/g/neil-gaiman/ghastly-beyond-belief.htm">Ghastly Beyond Belief</a>, <a href="http://www.neilgaiman.com">Neil Gaiman</a> and <a href="http://www.johnnyalucard.com/">Kim Newman&#8217;s</a> wonderful collection of quotations from science fiction and fantasy. Page 164 has this excellent exchange between Michael Moorcock and Thomas Disch.</p>
<blockquote><p>
<cite>Tom Disch</cite>: I&#8217;m writing a book about what everyone wants most.</p>
<p><cite>Moorcock</cite>: Really? Is it about elephants?</p>
<p><cite>Disch</cite>: Elephants? No, it&#8217;s about becoming more intelligent.</p>
<p><cite>Moorcock</cite>: Oh, what I&#8217;ve always wanted most is to be an elephant.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2009/11/is-it-about-elephants.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Look out honey cos I&#8217;m using technology</title>
		<link>http://eatyourgreens.org.uk/archives/2009/11/look-out-honey-cos-im-using-technology.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2009/11/look-out-honey-cos-im-using-technology.html#comments</comments>
		<pubDate>Mon, 02 Nov 2009 22:20:17 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[geekage]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=488</guid>
		<description><![CDATA[My last post gave some examples of YQL queries that could be used to access the data for the Science Museum&#8217;s Cosmic Collections competition. Looking at XML feeds is pretty dry, though, so I thought it would be fun to put together a demo which uses a YQL query to visualise the data. I&#8217;ve also [...]]]></description>
			<content:encoded><![CDATA[<p>My last post gave some examples of <abbr title="Yahoo Query Language">YQL</abbr> queries that could be used to access the data for the Science Museum&#8217;s <a href="http://www.sciencemuseum.org.uk/visitmuseum/galleries/cosmos_and_culture/mash-up_competition.aspx">Cosmic Collections competition</a>. Looking at XML feeds is pretty dry, though, so I thought it would be fun to put together a demo which uses a YQL query to visualise the data. I&#8217;ve also been looking at <a href="http://raphaeljs.com">Raphaël </a>recently, a small library for working with <abbr title="Scalable Vector Graphics">SVG</abbr> in web pages. Inspired by the <a href="http://www.flickr.com/photos/eatyourgreens/4037719269/">Royal Observatory&#8217;s Flickr touchscreen</a>, and knowing next to nothing about either<a href="http://jquery.com"> jQuery</a> or SVG, I wrote some quick code with jQuery and Raphaël to display photos of the Science Museum objects as a pile of polaroid photos.</p>
<p>Here&#8217;s the code, with some explanation in the comments that hopefully shows how to extract the Science Museum data from the query results and do something useful with it. The event handling code seems a little dodgy to me ( I really know very little about SVG or jQuery) but seems to work in Opera, Firefox and Safari. You can try it on <a href="http://eatyourgreens.org.uk/yql/coscultcom.html">the demo page</a>. Click to pick up a photo and move it. Click again to drop it.</p>
<p><strong>A small update:</strong> Here&#8217;s <a href="http://eatyourgreens.org.uk/yql/coscultcom2.html">a second demo</a> using drag-and-drop instead of mouse clicks. I&#8217;ve also added the <code>focusable</code> attribute to the SVG rectangles, to make them accessible from the keyboard. This only seems to work in Opera.</p>
<pre class="brush: jscript; title: ; notranslate">
// URL of the environment file, which points to the URL
// of the nmsi.cosmosculture YQL table definition.
var env = 'http://eatyourgreens.org.uk/yql/nmsi.env';
// YQL query to select everything from the Cosmic Collections dataset.
// Change this query to change the objects displayed in the page.
var yql = &quot;select * from nmsi.cosmosculture&quot;;
// Example alternate query - fetch everything linked to the Moon
// var yql = &quot;select * from nmsi.cosmosculture where LinkedCelestialBodies.CelestialBody.CommonName = 'Moon'&quot;;

// Encode the query and env file URL in a call to the YQL web service.
// Specify JSON as the return format.
var url = 'http://query.yahooapis.com/v1/public/yql?q='+ encodeURIComponent(yql) + '&amp;env='+encodeURIComponent(env)+'&amp;diagnostics=false&amp;format=json&amp;callback=?';

// Set a canvas for Raphael to draw on.
var height = 600;
var width = 800;
var paper = Raphael('canvas', width, height);

// Set some global variables to use when we are dragging elements around the canvas.
var startx = 0;
var starty = 0;
var dragging = false;
var draggedSet = null;

// Call the YQL web service and pass the json result to a callback function
$.getJSON(url, function(json){
//  Get the array of museum objects from the query result.
	var items = json.query.results.MuseumObject;
// Loop through the items array
	$.each(items, function(i, item) {
// Ignore items which don't have a photo
		if(item.Image.Source){
			var src = item.Image.Source;
// The smallest available image size is 'Inline'.
			src = src.replace(&quot;Medium&quot;,&quot;Inline&quot;);
			src = 'http://www.sciencemuseum.org.uk'+src;
// Generate a random x,y position for the photo
 			var x = 10 + (width-110) * Math.random();
 			var y = 10 + (height-110) * Math.random();
// Generate a random angle between 350 and 10 degrees.
 			var rot = 10*Math.random();
 			if(Math.random() &amp;lt; 0.5) rot = 360-rot;
// Each photo is built from a set consisting of a white rectangle and the photo
 				var s = paper.set();
 				s.push(paper.rect(x,y,110,140).attr('fill','white'),paper.image(src, x+5, y+5, 100, 100));
// Rotate the set by our random angle
 				s.rotate(rot);
// When the set is clicked, if already dragging, drop the photo.
// Otherwise, bring to the front and store the mouse
// coordinates for future use.
 				s.click(function(e) {
 					if (dragging) {
 						dragging=false;
 					}else {
 						dragging = true;
 						startx = e.clientX;
 						starty = e.clientY;
 						s.toFront();
 						draggedSet = s;
 					}
 				});
// Listen for mouse movement on the document.
// If dragging, move the dragged set to the
// x,y coordinates of the mouse.
// Store the current coordinates for the start
// of the next move.
 				document.onmousemove = function(e){
 					if(dragging) {
 						dx = e.clientX - startx;
 						dy = e.clientY - starty;

 						for (var j=0; j &amp;lt; 2; j++) {
 							var node = draggedSet[j];
 							node.attr({x: node.attr('x')+dx, y: node.attr('y')+dy});
 						}

 						startx = e.clientX;
 						starty = e.clientY;
 					}
 				};
 			}
 		});
})
</pre>
]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2009/11/look-out-honey-cos-im-using-technology.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Science Museum Cosmic Collections competition</title>
		<link>http://eatyourgreens.org.uk/archives/2009/10/science-museum-cosmic-collections-competition.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2009/10/science-museum-cosmic-collections-competition.html#comments</comments>
		<pubDate>Sun, 25 Oct 2009 13:52:51 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[geekage]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=471</guid>
		<description><![CDATA[The Science Museum have launched their Cosmic Collections website competition. They are offering two £1,000 prizes for web mashups built using their data describing the objects in the Cosmos &#38; Culture gallery. The deadline for entries is 28th November 2009. Full details are available on the competition web page. There&#8217;s also a Yahoo! Developer Network [...]]]></description>
			<content:encoded><![CDATA[<p>The Science Museum have launched their <a href="http://www.sciencemuseum.org.uk/visitmuseum/galleries/cosmos_and_culture/mash-up_competition.aspx">Cosmic Collections website competition</a>. They are offering two £1,000 prizes for web mashups built using their data describing the objects in the <a href="http://www.sciencemuseum.org.uk/visitmuseum/galleries/cosmos_and_culture.aspx">Cosmos &amp; Culture gallery</a>. The deadline for entries is 28th November 2009. Full details are available on the competition web page. There&#8217;s also a <a href="http://developer.yahoo.net/blog/archives/2009/10/a_new_api_and_h.html">Yahoo! Developer Network interview with Mia Ridge</a> about the competition.</p>
<p>The data has been released using a fairly simple API, so I&#8217;ve drafted a <a href="http://eatyourgreens.org.uk/yql/nmsi.cosmosculture.xml">YQL open table definition</a> for it. You can use it to retrieve the full dataset:</p>
<pre class="brush: sql; title: ; notranslate">use &quot;http://eatyourgreens.org.uk/yql/nmsi.cosmosculture.xml&quot;;
select * from nmsi.cosmosculture</pre>
<p><a href="http://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Featyourgreens.org.uk%2Fyql%2Fnmsi.cosmosculture.xml%22%3B%0Aselect%20*%20from%20nmsi.cosmosculture&amp;format=xml&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys">Try it</a></p>
<p>or retrieve an individual item, given the accession number:</p>
<pre class="brush: sql; title: ; notranslate">use &quot;http://eatyourgreens.org.uk/yql/nmsi.cosmosculture.xml&quot;;
select * from nmsi.cosmosculture where AccessionNumber = '1923-668';</pre>
<p><a href="http://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Featyourgreens.org.uk%2Fyql%2Fnmsi.cosmosculture.xml%22%3B%0Aselect%20*%20from%20nmsi.cosmosculture%20where%20AccessionNumber%20%3D%20'1923-668'%3B&amp;format=xml&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys">Try it</a></p>
<p>You can also use YQL&#8217;s own filtering operators to restrict the result set. For example, get items for a particular place:</p>
<pre class="brush: sql; title: ; notranslate">use &quot;http://eatyourgreens.org.uk/yql/nmsi.cosmosculture.xml&quot;;
select * from nmsi.cosmosculture
where LinkedPlaces.Place.PlaceName like '%Italy%'</pre>
<p><a href="http://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Featyourgreens.org.uk%2Fyql%2Fnmsi.cosmosculture.xml%22%3B%0Aselect%20*%20from%20nmsi.cosmosculture%20where%20LinkedPlaces.Place.PlaceName%20like%20'%25Italy%25'&amp;format=xml&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys">Try it</a></p>
<p>The <a href="http://cosmiccollections.pbworks.com/">competition wiki</a> has a page describing the <a href="http://cosmiccollections.pbworks.com/Cosmic-Collections-API">catalogue fields</a> returned by the API.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2009/10/science-museum-cosmic-collections-competition.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YQL updates for nmm.collections</title>
		<link>http://eatyourgreens.org.uk/archives/2009/10/yql-updates-for-nmm-collections.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2009/10/yql-updates-for-nmm-collections.html#comments</comments>
		<pubDate>Thu, 22 Oct 2009 22:14:54 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[geekage]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=452</guid>
		<description><![CDATA[I&#8217;ve made a couple of updates to the National Maritime Museum YQL tables, to hopefully make it a little easier to search the NMM collections with YQL. Firstly, I&#8217;ve added a new input parameter, sortby, to nmm.collections.search, which specifies the field used to sort search results. Possible values are objectid, title, maker, year, updated. You [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a couple of updates to the National Maritime Museum YQL tables, to hopefully make it a little easier to search the NMM collections with <a href="http://developer.yahoo.com/yql/">YQL</a>.</p>

<p>Firstly, I&#8217;ve added a new input parameter, <code>sortby</code>, to <code>nmm.collections.search</code>, which specifies the field used to sort search results. Possible values are <code>objectid, title, maker, year, updated</code>. You can also specify <code>sortby = 'rank'</code> to order results by relevance for free text searches. So, for example, you can get the most recently updated records from the art collection with the following query:</p>

<pre class="brush: sql; title: ; notranslate">select * from nmm.collections.search
where category = 'art' and searchterm = '' and sortby='updated'</pre>
<a href="http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20nmm.collections.search%0Awhere%20category%20%3D%20'art'%20and%20searchterm%3D''%20and%20sortby%3D'updated'&amp;format=xml&amp;env=http%3A%2F%2Fwww.nmm.ac.uk%2Fcollections%2Fexperiments%2Fyql%2Fnmm.env">Try it</a>

<p>Secondly, I&#8217;ve set up an XML feed to look up entries in the authority tables, and a corresponding YQL table <code>nmm.collections.authorities</code>. So, rather than having to know that the Aquitania is entry 21209 in the vessels authority, you can look up its entry with:</p>

<pre class="brush: sql; title: ; notranslate">select * from nmm.collections.authorities
where authority = 'vessels' and title = 'Aquitania'</pre>
<a href="http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20nmm.collections.authorities%20where%20authority%20%3D%20'vessels'%20and%20title%20%3D%20'Aquitania'&amp;format=xml&amp;env=http%3A%2F%2Fwww.nmm.ac.uk%2Fcollections%2Fexperiments%2Fyql%2Fnmm.env">Try it</a>

<p>This is most useful when doing search for objects linked to a particular authority record, as you can join the two <code>nmm.collections</code> tables. For example, to search for art by the painter Charles Pears, you could try the query:</p>

<pre class="brush: sql; title: ; notranslate">select * from nmm.collections.search
where searchterm='' and (authority,category) in
(select authority,id from nmm.collections.authorities
where authority = 'people' and title = 'pears')</pre>
<a href="http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20nmm.collections.search%0Awhere%20searchterm%3D''%0Aand%20(authority%2Ccategory)%20in%20%0A(select%20authority%2Cid%20from%20nmm.collections.authorities%0Awhere%20authority%20%3D%20'people'%20and%20title%20%3D%20'pears')%0A&amp;format=xml&amp;env=http%3A%2F%2Fwww.nmm.ac.uk%2Fcollections%2Fexperiments%2Fyql%2Fnmm.env">Try it</a>

<p>The <a href="http://github.com/yql/yql-tables/tree/master/nmm/">new YQL table definitions</a> are available on github, and will hopefully be available to use in the YQL console soon. I&#8217;ve set up a<a href="http://www.nmm.ac.uk/collections/experiments/yql/badge.html"> javascript demo page</a> where developers can test YQL queries against the NMM collections. There&#8217;s also a page of <a href="http://www.nmm.ac.uk/collections/feeds/docs/">documentation about the NMM&#8217;s collections feeds</a>, with some sample YQL queries for developers.</p>]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2009/10/yql-updates-for-nmm-collections.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Searching the sky with YQL Execute</title>
		<link>http://eatyourgreens.org.uk/archives/2009/05/searching-the-sky-with-yql-execute.html</link>
		<comments>http://eatyourgreens.org.uk/archives/2009/05/searching-the-sky-with-yql-execute.html#comments</comments>
		<pubDate>Mon, 11 May 2009 22:45:42 +0000</pubDate>
		<dc:creator>Jim O'Donnell</dc:creator>
				<category><![CDATA[astronomy]]></category>
		<category><![CDATA[geekage]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://eatyourgreens.org.uk/?p=411</guid>
		<description><![CDATA[Astro location search with YQL execute, originally uploaded by eat your greens. I was fortunate enough to win one of the prizes at Open Hack London this weekend. I ported the javascript from my astronomy photo browser to YQL Execute, creating a new open data table which returns celestial coordinates for astrotagged flickr photos. Essentially, [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: left; padding: 3px;"><a title="photo sharing" href="http://www.flickr.com/photos/eatyourgreens/3528192730/"><img style="border: 2px solid #000000;" src="http://farm4.static.flickr.com/3572/3528192730_354929ee9e.jpg" alt="" width="500" height="256" /></a></p>
<p><span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/eatyourgreens/3528192730/">Astro location search with YQL execute</a>, originally uploaded by <a href="http://www.flickr.com/people/eatyourgreens/">eat your greens</a>.</span></div>
<p>I was fortunate enough to win one of the prizes at <a href="http://openhacklondon.pbwiki.com/">Open Hack London</a> this weekend. I ported the javascript from my <a href="http://eatyourgreens.org.uk/archives/2009/03/google-sky-photo-browser.html">astronomy photo browser</a> to <a href="http://developer.yahoo.com/yql/guide/yql-execute-chapter.html">YQL Execute</a>, creating a new open data table which returns celestial coordinates for astrotagged flickr photos. Essentially, my hack extends the flickr API to, hopefully, enable location-based searching in the sky.</p>
<p>Since I only wrote my hack in about an hour, during breakfast on Sunday, I returned to it this evening and finished it off. I&#8217;ve defined an open data table at <a href="http://eatyourgreens.org.uk/yql/flickr.photos.astro.xml">http://eatyourgreens.org.uk/yql/flickr.photos.astro.xml</a> which returns all machine tag info in the astro: namespace for the 50 most recently tagged photos. For convenience, it also returns the photo owner, title, url and root url for thumbnail images.</p>
<p>There is a demo, where you can try searching based on Right Ascension and Declination (both expressed in degrees). Please try it out and leave feedback in the comments here.</p>
<p>Demo URL: <a href="http://eatyourgreens.org.uk/testapps/yql/locationsearch.html">http://eatyourgreens.org.uk/testapps/yql/locationsearch.html</a></p>
<h3>Example queries</h3>
<p>The Carina Nebula</p>
<pre><code>        select * from flickr.photos.astro
        where ra &gt; 155 and ra &lt; 165
        and dec &gt; -65 and dec &lt; -55</code></pre>
<p>The Orion Nebula and surroundings</p>
<pre><code>        select * from flickr.photos.astro
        where ra &gt; 70 and ra &lt; 100
        and dec &gt; -20 and dec &lt; 10</code></pre>
<p>Get lots of photos of Orion (may be slow)</p>
<pre><code>        select * from flickr.photos.astro(0,200)
        where ra &gt; 70 and ra &lt; 100
        and dec &gt; -20 and dec &lt; 10</code></pre>
<p>Find nebulae from the New General Catalogue (names beginning NGC)</p>
<pre><code>      select * from flickr.photos.astro
      where name like 'NGC%'
</code></pre>
<p>Find nebulae from the Messier catalogue (names beginning with M )</p>
<pre><code>     select id, title, url, imgroot, username, ra, dec, fov, orientation, name
      from flickr.photos.astro(40)
      where name like 'M %'</code></pre>
<p>Find all photos of the Rosette nebula</p>
<pre><code>      select * from flickr.photos.astro(0,200)
        where name = 'Rosette nebula'</code></pre>
<p>Explicitly declare all the table columns</p>
<pre><code>      select id, title, url, imgroot, username, ra, dec, fov, orientation, name
      from flickr.photos.astro</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://eatyourgreens.org.uk/archives/2009/05/searching-the-sky-with-yql-execute.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

