Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

testing for QueryWizard

  • Loading branch information...
commit 372a478f8549038af5f9e2d4cc43436081750c45 1 parent b5ba7a1
@spier spier authored
View
5 prlog/prlog.releases.xml
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- <?xml-stylesheet type="text/xsl" href="https://raw.github.com/spier/yql-tables/yql-stylesheet/prlog/yql-stylesheet.xsl" ?> -->
+<?xml-stylesheet type="text/xsl" href="yql-stylesheet.xsl" ?>
+
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Sebastian Spier (http://twitter.com/#!/sebastianspier/)</author>
@@ -7,7 +10,7 @@
<sampleQuery>SELECT * FROM {table}</sampleQuery>
<sampleQuery>SELECT * FROM {table} WHERE country="de"</sampleQuery>
<sampleQuery>SELECT * FROM {table} WHERE country="de" AND category="books"</sampleQuery>
- <sampleQuery>SELECT * FROM prlog WHERE category IN (SELECT category FROM prlog.categories LIMIT 5)"</sampleQuery>
+ <sampleQuery>SELECT * FROM {table} WHERE category IN (SELECT category FROM prlog.categories LIMIT 5)"</sampleQuery>
</meta>
<bindings>
<select itemPath="rss.channel.item" produces="XML">
View
92 prlog/yql-stylesheet.xsl
@@ -0,0 +1,92 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:yql="http://query.yahooapis.com/v1/schema/table.xsd">
+<!-- <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:yql="http://query.yahooapis.com/v1/schema/table.xsd" xpath-default-namespace="http://query.yahooapis.com/v1/schema/table.xsd"> -->
+
+<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01//EN" />
+
+<xsl:template match="/">
+<html>
+ <head>
+ <title>YQL Table</title>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
+ <script>
+ $(document).ready(function() {
+ // get the table name from the URL
+ var reg_exp = /([a-zA-Z0-9\.]+)\.xml$/i;
+ var matches = reg_exp.exec( document.location.href );
+
+ if (matches.length == 2) {
+ var table_name = matches[1] ;
+
+ // set this table name as the title
+ $("#table_name").html( table_name );
+
+ // set this table name in the sampleQueries
+ $(".sampleQuery").each(function() {
+ t = $(this).html().replace(/\{table\}/g,table_name);
+ $(this).html(t);
+ });
+
+ // make all sampleQueries clickable
+ $(".sampleQuery").each(function(index) {
+ yql_query_str = $(this).html();
+ js_call = "javascript:execute_yql('" + yql_query_str.replace(/"/g,"\"") + "')";
+ $(this).html("<a>"+ yql_query_str +"</a>");
+ //console.log( $(this).html() );
+ $(this).find("a").attr("href",js_call);
+
+ //console.log( $(this).find("a") );
+ //console.log(js_call);
+
+ });
+
+ } // end if
+ });
+
+ function execute_yql(yql_query_str) {
+ table_url = document.location.href;
+ yql_query_str = "USE \"" + table_url + "\"; " + yql_query_str;
+
+ console_url = "http://developer.yahoo.com/yql/console/?q=" + escape(yql_query_str);
+ console.log(yql_query_str);
+ console.log(console_url);
+ window.open(console_url);
+ }
+ </script>
+ </head>
+ <body>
+
+ <h1 id="table_name"> </h1>
+
+ <table id="tableinfo">
+ <tbody>
+ <tr>
+ <td valign="top" align="right" style="font-weight:bold;white-space:nowrap">Author:</td>
+ <td style="word-break:break-all;"> <xsl:value-of select="/yql:table/yql:meta/yql:author"/> </td>
+ </tr>
+ <tr>
+ <td valign="top" align="right" style="font-weight:bold;white-space:nowrap">Description:</td>
+ <td style="word-break:break-all;"> <xsl:value-of select="/yql:table/yql:meta/yql:description"/> </td>
+ </tr>
+ <tr>
+ <td valign="top" align="right" style="font-weight:bold;white-space:nowrap">Documentation:</td>
+ <td style="word-break:break-all;">
+ <a href="{/yql:table/yql:meta/yql:documentationURL}"> <xsl:value-of select="/yql:table/yql:meta/yql:documentationURL"/> </a> </td>
+ </tr>
+ <tr>
+ <td valign="top" align="right" style="font-weight:bold;white-space:nowrap">Sample Query:</td>
+ <td style="word-break:break-all;">
+ <ul>
+ <xsl:for-each select="/yql:table/yql:meta/yql:sampleQuery">
+ <li class="sampleQuery"> <xsl:value-of select="."/> </li>
+ </xsl:for-each>
+ </ul>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </body>
+</html>
+</xsl:template>
+
+</xsl:stylesheet>
View
34 usatoday/usatoday.articles.xml
@@ -1,14 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
+<?xml-stylesheet type="text/xsl" href="yql-stylesheet.xsl" ?>
+
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Sebastian Spier (http://twitter.com/#!/sebastianspier/)</author>
- <description></description>
+ <description>
+ USA TODAY Articles API.
+ (Note: I only mapped the "search" here, but not the queries for "tag" or "topnews" or "community" feeds.)
+ </description>
<documentationURL>http://developer.usatoday.com/docs/read/articles</documentationURL>
<sampleQuery>SELECT * FROM {table} WHERE api_key='YOUR_API_KEY' AND search='money'</sampleQuery>
</meta>
<bindings>
- <select itemPath="json.stories" produces="JSON">
+ <select itemPath="json.stories" produces="JSON" description="Search for USAToday articles">
<urls>
<url env="all">http://api.usatoday.com/open/articles</url>
</urls>
@@ -19,14 +24,11 @@
</paging>
<inputs>
<!-- general parameters -->
- <key id="api_key" type="xs:string" paramType="query" required="true" />
- <key id="encoding" type="xs:string" paramType="query" const="true" default="json" />
+ <key id="api_key" type="xs:string" paramType="query" required="true" description="API key for USAToday" />
+ <key id="encoding" type="xs:string" paramType="query" const="true" default="json" description="In which format to return the results. Either json or xml. ???" />
<!-- specifics for this table -->
- <key id="search" type="xs:string" paramType="query" required="true" />
-
- <!-- page Returns the Xth page of results, where X equals the input value.
- count Use this value to set the number of incoming stories. (default is 10) -->
+ <key id="search" type="xs:string" paramType="query" required="true" description="The search string" />
<!--
##########################
@@ -35,15 +37,15 @@
-->
<!-- csp Appends the designated CSP value to each hyperlink. -->
- <key id="csp" type="xs:string" paramType="query" />
+ <key id="csp" type="xs:string" paramType="query" description="Appends the designated CSP value to each hyperlink." />
<!-- days Returns stories that are no older than X days old, where X equals the input value. -->
- <key id="days" type="xs:string" paramType="query" />
+ <key id="days" type="xs:string" paramType="query" description="Returns stories that are no older than X days old, where X equals the input value." />
<!-- reporter Returns only stories from a specific reporter. Query searches byline field. -->
- <key id="reporter" type="xs:string" paramType="query" />
+ <key id="reporter" type="xs:string" paramType="query" description="Returns only stories from a specific reporter. Query searches byline field." />
<!-- source Returns only stories from a specific news source. -->
- <key id="source" type="xs:string" paramType="query" />
+ <key id="source" type="xs:string" paramType="query" description="Returns only stories from a specific news source." />
<!-- tickersonly When set to Y, returns only stories with embedded stock values. Best used with Money stories. -->
- <key id="tickersonly" type="xs:string" paramType="query" />
+ <key id="tickersonly" type="xs:string" paramType="query" description="When set to Y, returns only stories with embedded stock values. Best used with Money stories." />
<!--
##########################
@@ -52,11 +54,11 @@
-->
<!-- fromdate Returns stories back to the "FromDate" value. Must use yyyy-mm-dd format. -->
- <key id="fromdate" type="xs:string" paramType="query" />
+ <key id="fromdate" type="xs:string" paramType="query" description="Returns stories back to the 'FromDate' value. Must use yyyy-mm-dd format." />
<!-- most Allows programmers with the ability to retrieve articles based on "most read", "most E-mailed" and "most commented". -->
- <key id="most" type="xs:string" paramType="query" />
+ <key id="most" type="xs:string" paramType="query" description="Allows programmers with the ability to retrieve articles based on 'most read', 'most E-mailed' and 'most commented'." />
<!-- todate Returns stories starting at the "ToDate" value and moving back. Must use yyyy-mm-dd format. -->
- <key id="todate" type="xs:string" paramType="query" />
+ <key id="todate" type="xs:string" paramType="query" description="Returns stories starting at the 'ToDate' value and moving back. Must use yyyy-mm-dd format." />
</inputs>
</select>
Please sign in to comment.
Something went wrong with that request. Please try again.