ne of Yahoo!'s key goals is to become more open through the Yahoo! Open Strategy (Y!OS). At the heart of Y!OS is an open and extensible platform that allows developers to rapidly access Yahoo! network data and develop applications with access control using an open authentication standard.
Yahoo! makes structured data available to developers through its web services, such as Flickr and Yahoo! Local,
and through other sources like RSS feeds or CSV documents. There are also numerous external web services and APIs
outside of Yahoo! that provide valuable data. For example,
Programmableweb.com shows more than a thousand APIs available on topics ranging from project management to the Bible.
These disparate services require developers to locate the correct URLs for accessing the APIs and the documentation for querying them. Data remains isolated and separated, requiring developers to combine and work on the data after it's returned to them.
What Is YQL?
Yahoo! Query Language (YQL) platform provides a
mediator service that enables developers to query, filter, and combine data across the web. YQL exposes a SQL-like
syntax that is both familiar to developers and expressive enough for getting the right data.
Through YQL's SHOW
commands, Yahoo! attempts to make YQL self-documenting, enabling developers to discover the available data sources and structure without opening another web browser or reading a manual.
The SELECT statement is the primary verb for YQL and borrows much from a SQL-like syntax:
SELECT what FROM table WHERE filter
"Tables" in YQL refer to external data sources that often contain very large collections of structured data. You can think of each item in a table as a "row" in a more traditional relational database. All data in YQL is treated as XML, and if the underlying table source does not provide XML, it converts into an XML-like representation.
You can join any table or data source with another data source through sub-selects—if each table has a matching value—similar to a foreign key in SQL.
Consider the following YQL statement:
SELECT filename,thumbnail_url FROM search.images(50) WHERE query="hat" AND mimetype LIKE "%jpeg%"
AND height<400 AND width<400 LIMIT 2
This returns the thumbnail URL and filename of up to two results FROM
table for images of "hats" that are jpeg encoded and under a certain size:
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="2" yahoo:created="2008-12-02T12:50:59Z"
yahoo:lang="en-US" yahoo:updated="2008-12-02T12:50:59Z" yahoo:uri="http:// query.yahooapis.com/v1/
You can run this query by simply copying the following URL into your browser: