Ken mql-query fails to read ruby variable

Hi all,

I ran into a problem using the rubygem Ken
(http://rubygems.org/gems/ken). It is used to query freebase. I want to
save the information on tourist attractions of a city in the variable
@info like that:

@city = City.find(params[:id])
cityname = @city.name.downcase
cityname = “”/en/" + cityname + “”"

@info = Ken::Collection.new
@info = Ken.all(:"!pd:/travel/travel_destination/tourist_attractions" =>
[{ :id => cityname }])

This throws the error
“/api/status/error/mql/type: “/en/berlin” is a JSON string, but the
expected type is /type/id”

When I substitute the string “/en/berlin” with the variable cityname as
mql
parameter, it works. But I need it to be dynamical so I can query e.g.
“/en/london”, “/en/oslo” or “/en/moscow” just by calling the id.

This is taken from the wiki.freebase.com
"“value is a JSON type, but the expected type is /path/to/type”: a
constant value (which has JSON type type) was seen where something of
type /path/to/type was expected "

I don’t understand what is meant with that

Thanks for any advice

frizze rizze wrote in post #1042193:

sorry for opening a topic for that

I had to turn

cityname = “”/en/" + cityname + “”"

into

cityname = “/en/” + cityname

all done :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs