查看twitter数据库的“id”字段:
thufir@dur:~/flwor$
thufir@dur:~/flwor$ basex
BaseX 9.0.1 [Standalone]
Try 'help' to get more information.
>
> open twitter
Database 'twitter' was opened in 218.67 ms.
>
> xquery //id
<id type="number">1224165280068382720</id>
<id type="number">60919433</id>
<id type="number">1224160851797643264</id>
<id type="number">60919433</id>
..
<id type="number">14248074</id>
Query executed in 268.13 ms.
>
我如何从FLWOR
语句中得到相同的结果?
thufir@dur:~/flwor$
thufir@dur:~/flwor$ cat id.xq
for $tweets in db:open("twitter")
let $tweet := $tweets
return <results>{$tweet}</results>
thufir@dur:~/flwor$
它将所有内容包装在<result>
标签中,但仍提供每个节点。如何选择“id”节点?尝试变化:
let $tweet := $tweets/id
没有积极的结果。也许是因为JSON
混合在一起?