vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 1 | drop dataverse fuzzyjoin if exists; |
| 2 | |
| 3 | create dataverse fuzzyjoin; |
| 4 | |
| 5 | use dataverse fuzzyjoin; |
| 6 | |
| 7 | create type DBLPType as closed { |
| 8 | id: int32, |
| 9 | dblpid: string, |
| 10 | title: string, |
| 11 | authors: string, |
| 12 | misc: string |
| 13 | } |
| 14 | |
| 15 | create type TOKENSRANKEDADMType as closed { |
| 16 | token: int32, |
| 17 | rank: int32 |
| 18 | } |
| 19 | |
khfaraaz82@gmail.com | 31086b5 | 2012-05-02 21:33:58 +0000 | [diff] [blame] | 20 | create dataset DBLP(DBLPType) partitioned by key id; |
| 21 | create dataset TOKENSRANKEDADM(TOKENSRANKEDADMType) partitioned by key rank; |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 22 | |
| 23 | load dataset DBLP |
| 24 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 25 | (("path"="nc1://data/pub-small/dblp-small-id.txt"),("format"="delimited-text"),("delimiter"=":")) pre-sorted; |
| 26 | |
| 27 | load dataset TOKENSRANKEDADM |
| 28 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 29 | (("path"="nc1://data/pub-small/tokensranked.adm"),("format"="adm")); |
| 30 | |
| 31 | write output to nc1:'rttest/fuzzyjoin_dblp-2.2.adm'; |
| 32 | |
| 33 | // |
| 34 | // -- - Stage 2 - -- |
| 35 | // |
| 36 | for $paperDBLP in dataset('DBLP') |
| 37 | let $idDBLP := $paperDBLP.id |
| 38 | let $tokensUnrankedDBLP := counthashed-word-tokens($paperDBLP.title) |
| 39 | let $lenDBLP := len($tokensUnrankedDBLP) |
| 40 | let $tokensDBLP := |
| 41 | for $tokenUnranked in $tokensUnrankedDBLP |
| 42 | for $tokenRanked in dataset('TOKENSRANKEDADM') |
| 43 | where $tokenUnranked = /*+ bcast*/ $tokenRanked.token |
| 44 | order by $tokenRanked.rank |
| 45 | return $tokenRanked.rank |
| 46 | for $prefixTokenDBLP in subset-collection( |
| 47 | $tokensDBLP, |
| 48 | 0, |
| 49 | prefix-len-jaccard(len($tokensDBLP), .5f)) |
| 50 | order by $idDBLP, $prefixTokenDBLP |
| 51 | return {'id': $idDBLP, 'prefixToken': $prefixTokenDBLP, 'tokens': $tokensDBLP} |