This homework will take you beyond the basics and give you a chance to write Theseus plans that require using wrappers, the Xquery operator, and subplans.
IMPORTANT: You will need to download the newest version of Theseus, which has some important bugfixes.
| What to do |
You are going to write a plan that, given a zip code, a business category, and a business subcategory, does the following:
(zip, biz_cat, biz_subcat) and call the Yahoo Yellow
Pages Wrapper to find the businesses in a particular zip code
that match specified category and subcategory information.
This plan will return a streamed relation with
the schema (name, streetaddress, city, state, zip).
(name, streetaddress, city,
state, zip) and use the Geocoder Wrapper to find the polar
coordinates of each
of the businesses found. This plan will return a streamed relation
consisting of the schema (name, streetaddress, city, state, zip,
lat, lon).
(name, streetaddress, city,
state, zip, lat, lon) and use the Building Finder Wrapper to find
the URLs for
satellite images of the geocoded businesses. This plan will return a
streamed relation with a schema (name, streetaddress, city, state, zip,
lat, lon, imageurl).
The benefit of using subplans is that your development becomes better modularized. Thus, if you wanted to write a different plan that gathered businesses, geocoded them, and plotted them on a Yahoo map, you would quickly be able to reuse the first two plans as subplans in this new plan.
| Notes |
There are some important notes regarding various parts of this assignment:
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<Row>
<name id="6.3" type="data">
<Value>Arico's Hallmark</Value>
</name>
<streetaddress id="6.4" type="data">
<Value>13175 Mindanao Way</Value>
</streetaddress>
<city id="6.5" type="data">
<Value>Marina Del Rey</Value>
</city>
<state id="6.6" type="data">
<Value>CA</Value>
</state>
<phone id="6.7" type="data">
<Value>(310) 823-3739</Value>
</phone>
<nextlink id="6.56" type="data">
<Value>
</Value>
</nextlink>
</Row>
<Row>
<name id="6.9" type="data">
<Value>Beyond Scents</Value>
</name>
... etc. ...
This will make it possible for you to use the Theseus xml2rel
operator to convert this data from XML to a relation (which you
will need for the rest of the plan).
lat and lat_value. One is just a label
and one is the actual value.
| Input and output |
Your hw6.plan should have the following interface:
PLAN hw6
{
INPUT: stream criteria
OUTPUT: stream imageurls
BODY
{
/* You will write this! */
}
}
The input datafile should look something like this:
RELATION criteria: zip char, biz_cat char, biz_subcat char 90292|Retail Shopping|Gifts and CardsWhen using this input file with your plan, the output should look like this:
---------------------------------------------- RELATION: hw6_imageurls attrs: name, streetaddress, city, state, zip, imageurl, lat, lon ---------------------------------------------- Arico's Hallmark|13175 Mindanao Way|Marina Del Rey|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1835&y=18808&z=11&Scale=10&width=2&height=2&toplon=-118.439953394851&toplat=33.9883621706051&botlon=-118.435563250856&botlat=33.9848063332803&displayHouses=1&displayRoads=1|33.9865842519427|-118.437758322853 Girl From Ipanema|103 Washington Blvd|Venice|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1822&y=18806&z=11&Scale=10&width=2&height=2&toplon=-118.46803281021&toplat=33.984423152998&botlon=-118.463641742986&botlat=33.9808683410465&displayHouses=1&displayRoads=1|33.9826457470222|-118.465837276598 Heather's Flowers|101 Washington Blvd|Venice|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1822&y=18806&z=11&Scale=10&width=2&height=2&toplon=-118.46803281021&toplat=33.984423152998&botlon=-118.463641742986&botlat=33.9808683410465&displayHouses=1&displayRoads=1|33.9826457470222|-118.465837276598 Beyond Scents|4710 Admiralty Way|Marina Del Rey|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1834&y=18806&z=11&Scale=10&width=2&height=2&toplon=-118.4420572117&toplat=33.9847303823688&botlon=-118.437667175289&botlat=33.9811746155411&displayHouses=1&displayRoads=1|33.9829524989549|-118.439862193494 Relish Gift Designs Inc|4223 Glencoe Ave|Marina Del Rey|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1833&y=18810&z=11&Scale=10&width=2&height=2&toplon=-118.444343904389&toplat=33.9919178397541&botlon=-118.439953394851&botlat=33.9883621706051&displayHouses=1&displayRoads=1|33.9901400051796|-118.44214864962 Marina Del Rey Florist|4072 1/2 Lincoln Blvd|Marina Del Rey|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1712&y=0&z=11&Scale=10&width=2&height=2&toplon=-118.416166225139&toplat=0.0018089063233339&botlon=-118.412572628698&botlat=-0.00180890914347243&displayHouses=1&displayRoads=1|-1.4100692661027E-09|-118.414369426919 Jeanne's Hallmark|4726 Admiralty Way|Marina Del Rey|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1834&y=18805&z=11&Scale=10&width=2&height=2&toplon=-118.442026753043&toplat=33.9829271666497&botlon=-118.437636813397&botlat=33.9793713952946&displayHouses=1&displayRoads=1|33.9811492809722|-118.43983178322 Star Lane|13737 Fiji Way|Marina Del Rey|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1712&y=0&z=11&Scale=10&width=2&height=2&toplon=-118.416166225139&toplat=0.0018089063233339&botlon=-118.412572628698&botlat=-0.00180890914347243&displayHouses=1&displayRoads=1|-1.4100692661027E-09|-118.414369426919 Marina Sensations|13755 Fiji Way|Marina Del Rey|CA|90292|http://apollo.isi.edu/BF/Find.aspx?x=1712&y=0&z=11&Scale=10&width=2&height=2&toplon=-118.416166225139&toplat=0.0018089063233339&botlon=-118.412572628698&botlat=-0.00180890914347243&displayHouses=1&displayRoads=1|-1.4100692661027E-09|-118.414369426919 ----------------------------------------------
| What to turn in |
You should turn in the following:
| Questions and comments |
If you have any, contact Greg Barish.