开发者

Freebase MQL Query output?

I have the following query:

[{
  "type":   "/tv/tv_series_episode",
  "series": "The Simpsons",
  "/tv/tv_series_episode/guest_stars": [{
    "actor": null
  }],
}]

I want to print out a list of guest stars, how do I do such a thing? I tried:

<acre:script>
  var query = acre.require("simpsons").query;
  var result = acre.freebase开发者_JAVA百科.MqlRead(query).result;
</acre:script>
<ul>
 <li acre:for="someResult in result">$someResult.actor.name</li>
</ul>

but that's obviously wrong.


I fixed your code: working example.

Your query is nested, but your display code wasn't.

Note how I used console.log(obj) with "View with Console" to examine the query result.

<html>
  <head>
    <acre:script>
      var query = [{
        "type":   "/tv/tv_series_episode",
        "series": "The Simpsons",
        "guest_stars": [{
          "actor": {
            "name":null
          }
        }],
      }];

      var result = acre.freebase.mqlread(query).result;
      console.log(result);
    </acre:script>
  </head>
  <body>
    <ul>
      <li acre:for="episode in result">
        <div acre:for="star in episode.guest_stars">$star.actor.name</div>
      </li>
    </ul>
  </body>
</html>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜