Position paper for AI and Information Integration workshop at AAAI-98

Squeal: SQL Access to Information on the Web

Ellen Spertus

The World-Wide Web contains an abundance of semi-structured information, including hyperlinks between pages, structure within hypertext pages, and structure within the addresses of pages (URLs). Because of the difficulty in harnessing this structural information, many Web tools fail to make use of it, instead treating the Web as though it were a flat text collection. We introduce Squeal, a SQL-like language for querying the Web as though it were in a relational database. We describe simple but powerful applications built on top of Squeal, which we call "ParaSites" because they make effective use of this underutilized information on the Web, often in ways unintended by the informationís authors.


Relational databases provide a powerful abstraction for manipulating data. The division of data into relations helps users comprehend the data and allows them to specify queries in Structured Query Language (SQL). While the Web is too large and quickly-changing to be stored in a relational database, it is useful to provide users with the illusion that it is. We provide this through the Squeal language and interpreter, which allows users to make SQL queries involving Web information. The Squeal interpreter determines what information needs to be fetched and parsed from the Web in order to answer the question. The retrieved information is cached in a local database in case it is needed again.

The Squeal schema includes relations for representing the following types of Web information:

For example, hyperlinks are expressed through the link table, which expresses a relation between a source URL, anchor text, and a destination URL. In order to ask what pages are pointed to by the MIT AI Lab home page, the user would enter:

SELECT destination FROM link
WHERE source = "www.ai.mit.edu"

The Squeal interpreter would retrieve the page, parse it, then return a list of the destinations of links on the page. Instead of (or in addition to) specifying the source page, the user could provide another field. For example, to ask for pages containing hyperlinks with "artificial intelligence" as anchor text, the user would enter:

SELECT source FROM link
WHERE anchor = "artificial intelligence"

To answer this, the Squeal interpreter would ask a search engine, such as AltaVista, what pages contain "artificial intelligence" as anchor text. Because no such engine can ensure returning all such pages, the list is likely to be incomplete. The Squeal interpreter then retrieves and examines the pages, returning to the user a list of pages that it has verified as having the desired anchor text. While recall will be less than 1, the precision is guaranteed to be 1. A similar process is used to request pages that link to both "www.ai.mit.edu" and "www.lcs.mit.edu":

SELECT L1.source FROM link L1, L2
WHERE L1.destination = "www.ai.mit.edu"
AND L2.destination = "www.lcs.mit.edu"
AND L1.source = L2.source

Queries involving multiple Squeal- and user-defined tables are also possible and are discussed elsewhere.


We have built a number of ParaSites on top of Squeal that exploit the Webís structural information, including a personal home page finder, which uses the following algorithm to try finding the home page of the person with name N.

  1. Generate a list of candidate pages from the destinations of hyperlinks whose anchor text is N.
  2. Give bonus points to candidate pages where one or more of the following conditions hold:

This algorithm, with additional heuristics described elsewhere, is quite effective.

The contrast between text-based and structure-based approaches can be seen most directly in different recommender systems for Web pages. With either approach, a user specifies seed pages. A text-based system, such as Excite, then searches for pages that contain the same words, and return these pages to the user. The ParaSite approach is to find parent pages that point to the seed URLs, then to return the pages pointed to most frequently by the parents, i.e., the seed pagesí siblings. The underlying philosophy is that human beings are best at deciding what pages are alike, so we should associate pages with each other if they co-occur as destinations of hyperlinks on multiple pages. This is entirely analogous to mining citation indexes. A small user study showed the ParaSite approach to be superior in some ways to the purely text-based approach. We predict the best system would combine both approaches.


We have provided a taste of the Squeal programming system for accessing structural information on the Web and have outlined some effective applications that can be easily written in Squeal, demonstrating the utility of the Webís structural information and how Web tools, such as AltaVista, can be harnessed.


Spertus, Ellen. ParaSite: Mining the Structural Information on the World-Wide Web. PhD Thesis, Department of EECS, MIT, Cambridge, MA, February 1998.