Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
Why not imagine it in a way that works?

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.



Internet Query Language

An SQL-like language for easily accessing the world's greatest database - the internet
  (+4, -1)
(+4, -1)
  [vote for,

The internet is clearly the greatest resource of knowledge that exists today. It is an ever-expanding and decentralized database in a common presentational format: HTML. While this may vary (plain text/PDF/differing formats, different encodings), they're all easily handled by a smart programmer.

The problem is most people are not programmers and it takes a lot of work to get all those things together. So an intermediary should be designed to do what SQL has done for databases - IQL - the Internet Query Language.

Unlike SQL which works with tables, IQL will work with hierarchical data (everything that can be done with tables can be done with hierarchical data, example: the <TABLE> tag in HTML). The syntax will be similar to SQL so it will have an easy learning curve.

Comparisons between SQL and IQL:

- SQL uses tables, IQL uses hierarchies.

- SQL accesses local data synchronously, IQL accesses remote data asynchronously, with options for synchronicity.

- SQL uses column names, IQL uses CSS-like selectors.

Example of IQL query: "GET http://www.google.com/search?q=Einstein SELECT TEXT(h3) LIMIT 3;"

which should return:

"Albert Einstein - Wikipedia, the free encyclopedia"

"Albert Einstein - Biography"

"Albert Einstein Online"

It has some resemblance to the SQL language, but the GET comes first, as it is the equivalent of "FROM" in SQL, and I think FROM should have come first in SQL anyway. Custom functions and operators can be added, so the query can be made even more user-friendly, like: "GOOGLE 'Einstein' SELECT TEXT(h3) LIMIT 3;".

Other examples:

GET reddit.com SELECT p.title SELECT TEXT(*) AS TEXT, a.href AS @href, TEXT(a.subreddit) INTO @subreddit GROUP BY @subreddit; (select the top articles on reddit and links to them grouped by subreddit. The returned data is always hierarchical, but can easily be treated like a table in most cases)

GET en.wikipedia.org/wiki/Special:Random SELECT .firstHeading AS @title, #bodyContent AS TEXT REMOVE #siteSub, .navbox, .metadata; (select a random article's title and content on wikipedia, removing banners and other useless things)

GET en.wikipedia.org/wiki/Special:UserLogin SET #wpName1 = 'myname', #wpPassword1 = 'mypass' SUBMIT form[@name='userlogin']; (log into wikipedia account)

I am currently working on it, and would appreciate any ideas and criticism.

manixrock, Jan 01 2010

MQL http://www.freebase.com/developer
(See "your first query" section) [Inyuki, Jan 01 2010]


       My only criticism is, why duplicate all the good work that has been put into XQuery over the recent years?
Ian Tindale, Jan 01 2010

       @Ian Tindale - XQuery is a functional programming language, not a query language. Imagine if SQL was a programming language instead of what it is now, it wouldn't be as useful. It only works with XML, not HTML or other formats (99% of the web is not valid XML). It uses XPath which is ugly and hard to use compared with CSS-like selectors, used, for example, by jQuery.
manixrock, Jan 02 2010


back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle