input parameter substitution in url - not simply substituting


I've been looking into YQL for a private project of mine and try to define an open table that is queried like this:

use "http://github.com/vicmortelmans/yql-tables/raw/master/bible/nl.willibrord.xml" as nl.willibrord;
select * from nl.willibrord where book='John' and chapter=3 and passage=16

The open table should fetch html data from this URL

So I specify the <url> as


The variables in '{}' should be replaced by the 'where'-criteria of the query.

But if I query the table, the console tells me that this URL is called:

<url execution-time="9" proxy="DEFAULT"><![CDATA[http://www.bijbel.net/wb/?+,&John+3,16]]></url>

Notice the extra occurrence of the '+' and ',' in the GET-section...

Why is YQL doing this ?? I've been thinking this behaviour is triggered by the uritemplate feature, but can't figure out how...

Complete open table definition:

<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<author>Vic Mortelmans</author>
<description>The table contains the complete bible. Each passage is a record, identified by it's citation reference.</description>
<sampleQuery>select * from nl.willibrord where book='John' and chapter=3 and passage=16 </sampleQuery>
<select produces="XML" itemPath="*">
<key id="book" type="xs:string" paramType="path" required="true"/>
<key id="chapter" type="xs:integer" paramType="path" required="true"/>
<key id="passage" type="xs:integer" paramType="path" required="true"/>
var page = y.query("select * from html where url=@url and xpath='//font[@color=\"red\"]'",{url:request.url});
response.object = page.results;


Thanks !!

1 Reply
  • The problem here is that + in a URI is a space character. Instead I think you should use %20 like this:

    select * from uritemplate where template ='http://www.bijbel.net/wb/?{book}%20{chapter},{passage}' and book = 'John' and chapter=3 and passage=16


Recent Posts

in YQL