icetindil | 9d0004a | 2014-04-28 14:16:49 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Description : Fuzzy joins two datasets, DBLP and CSX, based on the edit-distance-contains function of their authors. |
| 3 | * DBLP has a 3-gram index on authors, and we expect the join to be transformed into an indexed nested-loop join. |
| 4 | * Success : Yes |
| 5 | */ |
| 6 | |
| 7 | drop dataverse test if exists; |
| 8 | create dataverse test; |
| 9 | use dataverse test; |
| 10 | |
| 11 | create type DBLPType as closed { |
| 12 | id: int32, |
| 13 | dblpid: string, |
| 14 | title: string, |
| 15 | authors: string, |
| 16 | misc: string |
| 17 | } |
| 18 | |
| 19 | create type CSXType as closed { |
| 20 | id: int32, |
| 21 | csxid: string, |
| 22 | title: string, |
| 23 | authors: string, |
| 24 | misc: string |
| 25 | } |
| 26 | |
| 27 | create dataset DBLP(DBLPType) primary key id; |
| 28 | |
| 29 | create dataset CSX(CSXType) primary key id; |
| 30 | |
| 31 | create index ngram_index on DBLP(authors) type ngram(3); |
| 32 | |
| 33 | write output to nc1:"rttest/inverted-index-join_ngram-edit-distance-contains.adm"; |
| 34 | |
| 35 | for $a in dataset('DBLP') |
| 36 | for $b in dataset('CSX') |
| 37 | where edit-distance-contains($a.authors, $b.authors, 3)[0] and $a.id < $b.id |
| 38 | return {"arec": $a, "brec": $b } |