vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 1 | drop dataverse twitter if exists; |
| 2 | create dataverse twitter; |
| 3 | use dataverse twitter; |
| 4 | |
| 5 | create type Tweet as open { |
| 6 | id: int32, |
| 7 | tweetid: int64, |
| 8 | loc: point, |
RamanGrover29@gmail.com | 58cf330 | 2012-11-09 00:27:45 +0000 | [diff] [blame] | 9 | time: datetime, |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 10 | text: string |
| 11 | } |
| 12 | |
| 13 | create external dataset TwitterData(Tweet) |
| 14 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 15 | (("path"="nc1://data/twitter/smalltweets.txt"),("format"="adm")); |
| 16 | |
| 17 | write output to nc1:"/tmp/count-tweets.adm"; |
| 18 | |
| 19 | for $t in dataset('TwitterData') |
| 20 | let $tokens := word-tokens($t.text) |
| 21 | for $token in $tokens |
| 22 | group by $tok := $token with $token |
| 23 | return { "word": $tok, "count": count($token) } |
| 24 | |