YQL updates for nmm.collections

I’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’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 can also specify sortby = 'rank' 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:

select * from nmm.collections.search
where category = 'art' and searchterm = '' and sortby='updated'
Try it

Secondly, I’ve set up an XML feed to look up entries in the authority tables, and a corresponding YQL table nmm.collections.authorities. So, rather than having to know that the Aquitania is entry 21209 in the vessels authority, you can look up its entry with:

select * from nmm.collections.authorities
where authority = 'vessels' and title = 'Aquitania'
Try it

This is most useful when doing search for objects linked to a particular authority record, as you can join the two nmm.collections tables. For example, to search for art by the painter Charles Pears, you could try the query:

select * from nmm.collections.search
where searchterm='' and (authority,category) in
(select authority,id from nmm.collections.authorities
where authority = 'people' and title = 'pears')
Try it

The new YQL table definitions are available on github, and will hopefully be available to use in the YQL console soon. I’ve set up a javascript demo page where developers can test YQL queries against the NMM collections. There’s also a page of documentation about the NMM’s collections feeds, with some sample YQL queries for developers.