alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Description : Fuzzy joins two datasets, DBLP and CSX, based on the similarity-jaccard function of their titles' 3-gram tokens. |
| 3 | * DBLP has a 3-gram index on title, and we expect the join to be transformed into an indexed nested-loop join. |
alexander.behm | 954083a | 2012-11-15 04:01:23 +0000 | [diff] [blame] | 4 | * We expect the top-level equi join introduced because of surrogate optimization to be removed, since it is not necessary. |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 5 | * Success : Yes |
| 6 | */ |
| 7 | |
| 8 | drop dataverse test if exists; |
| 9 | create dataverse test; |
| 10 | use dataverse test; |
ramangrover29 | a321120 | 2013-05-19 11:56:49 -0700 | [diff] [blame^] | 11 | set import-private-functions 'true'; |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 12 | |
| 13 | create type DBLPType as closed { |
| 14 | id: int32, |
| 15 | dblpid: string, |
| 16 | title: string, |
| 17 | authors: string, |
| 18 | misc: string |
| 19 | } |
| 20 | |
| 21 | create type CSXType as closed { |
| 22 | id: int32, |
| 23 | csxid: string, |
| 24 | title: string, |
| 25 | authors: string, |
| 26 | misc: string |
| 27 | } |
| 28 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 29 | create dataset DBLP(DBLPType) primary key id; |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 30 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 31 | create dataset CSX(CSXType) primary key id; |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 32 | |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 33 | create index ngram_index on DBLP(title) type ngram(3); |
| 34 | |
alexander.behm | 954083a | 2012-11-15 04:01:23 +0000 | [diff] [blame] | 35 | write output to nc1:"rttest/inverted-index-join-noeqjoin_ngram-jaccard.adm"; |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 36 | |
| 37 | for $a in dataset('DBLP') |
| 38 | for $b in dataset('CSX') |
alexander.behm | 954083a | 2012-11-15 04:01:23 +0000 | [diff] [blame] | 39 | where similarity-jaccard(gram-tokens($a.title, 3, false), gram-tokens($b.title, 3, false)) >= 0.5f |
alexander.behm | c576c60 | 2012-07-06 02:41:15 +0000 | [diff] [blame] | 40 | and $a.id < $b.id |
ramangrover29 | a321120 | 2013-05-19 11:56:49 -0700 | [diff] [blame^] | 41 | return {"atitle": $a.title, "btitle": $b.title} |