| |
| ||||||
Mapping RESTful DataThis is a discussion on Mapping RESTful Data within the Oracle News and Views forums, part of the Oracle and Hyperion Forum category; As I mentioned before, Yahoo provides Yahoo Query Language ( YQL ) in a variety of forms.* There is a console that allows you to write a query in a ... |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
| | #1 |
| News Bot Join Date: Nov 2007
Posts: 15,085
![]() | As I mentioned before, Yahoo provides Yahoo Query Language (YQL) in a variety of forms.* There is a console that allows you to write a query in a browser and see the XML results on the screen.* This is nice for development purposes, but XML isn’t all that “humanly readable.”* I’m a big fan of maps to represent data that can be attached to a latitude and longitude.* When you think about it, most data actually can be attached to an address, a zip code, a city or some geospatial component.* In my last blog, demonstrated how to use YQL and it’s RESTful API to query and display information in a tabular form.* Today I’m going to show you how to take that tablular data and represent it in map. In my ApEx application, I created a region that contains 4 input fields: *You can see that I’m collecting:
*In the following figure*you’ll see that I displayed all of the events*within*the radius of the specified address that contain the search text specified.* Again, below the events, is a tabular listing of the event details. . ![]() *There are many maps available including Yahoo, Microsoft (Virtual Earth), Google, etc.* Yahoo Pipes, which I’ve discussed previously, allows you to consume RESTful (or standard) Web Services.* Pipes allows you to consume YQL queries too.* I decided to use Yahoo Pipes to consume my YQL queries.* The figure below shows the Pipes visual diagram, which I’ll explain below. ![]() Above you’ll see that the diagram starts in the upper right corner with 2 text input values (location and radius).* These feed into the “String Builder” which writes a SQL statement that’s used in the YQL query.* The query will look like: select * from maps.traffic where location=”loc” and radisu=radius.* This is fed into the YQL query, which pases it’s results into rename, which changes item.description to description and item.title to title.* The “Location Exrtaction” module will pull the lat/long information from YQL query.* Amazingly simple isn’t it!* When you run the Pipe, you can see that there are 2 tabs.* 1 for the Map (because we used the Location Extractor and a list. ![]() You see that all of the traffic shows up in the lat/long location it belongs on the map.* I’m always amazed how easy it is to integrate this data when you have services.* You can see above that there are many options available with the Pipe data.* You can publish the map on your MyYahoo page or you iGoogle page or get it as an RSS or JSON*feeds and more.* You can also see that there is an option labeled “Get as a Badge.”* As you can see here, you can put the badge in TypePad, Blogger, WordPress, iGoogle or as an Embedded link on your Web page: * ![]() When you click on “Embed,” Pipes provides you with a link to*copy and paste.* Now back to ApEx.* How do we take this embedded link and put it in ApEx?* Remember that we have 2 bind variables for this Pipe.* These will be input variables in the RESTful service.* For this Pipe, the link that I copied looks like this: You can see the 2 bind variables.* Remember that in my ApEx application, I had 4 input variables (ApEx items) on my page.* The names of my variables are: P2_ADDRESS, P2_ZIP, P2_SEARCH and P2_RADIUS.* I created a new HTML region on my page.* Then I pasted the above embedded script into the region’s HTML source.* The only thing I needed to change was to add in my bind variables.* You can see how I changed it below.* In PL/SQL, you reference bind variables with a colon in front.* For example, you would write something like “where radius*= :p2_radius” in PL/SQL.* In HTML, the binding uses an ampersand before the variable name and a period at the end.* So here’s what my region source looks like now: My events map HTML region now looks like this: You can see my bind variables in*this region too.* You can see what my “Events in Town” Pipe looks like when I run it.* Notice the visual diagram (flow chart) here too - very cool! ![]() Let’s take a look at the details behind this Pipe now.* Here’s the flow: *This Pipe begins in the top middle of the page with 3 text input variables - search text, location and radius.* Again, this feeds building the select statement that feeds into YQL.* I then took the results of that query and split it into 2 threads.* One thread takes a lot of the information and moves it into a “new_description” field.* This is used for all of the events, which are then put into an RSS format, sent into the union, which goes into the pipe’s output.* The other thread extras the venue’s zip code and gets the weather for that zip code.* Since many events could be in the same zip code, I ran it through a unique filter for unique cities and for all unique cities builds a YQL query for the weather information, which is also unioned into the pipe’s output.* So we have a powerful combination of service requests.* Again, I’m hoping to inspire you to go and build a really cool application that you can use in your company or personally.* Services are VERY powerful.* And of course…if you need help, give us a call! More from Bradley D. Brown ... |
| | |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mapping to a database table | Latest News Headlines | Data Integration News Feeds | 0 | 25th November 2009 10:39 AM |
| Mapping identifiers for the integration of genomic datasets with the R/Bioconductor p | admin | Analytic News Feeds | 0 | 18th November 2009 11:38 AM |
| DATA DATA DATA ANALYSIS, STRONG SQL, Technical Consulting | admin | 2009 Job Archive | 0 | 21st October 2009 06:56 PM |
| Knowledge mapping | binboy | Project Management | 1 | 28th January 2009 09:08 PM |
| | |
| | |