About
Search Database
User Manual
Report a missing article
Add an article to the database
Country Analysis
#!/usr/local/bin/perl use DBI; require Harold::base; require Harold::entetes; require Harold::tablo; $dbi_tobres=DBI->connect("dbi:mysql:dbname=tobres;host=$HOST_MYSQL","tobres","res777rch"); ################################################### print PrintHeader(); ReadParse() unless defined %in; $in{intent}=0 unless $in{intent}; $WIDTHTAB="100%"; #map {print "$_: $in{$_}
"} sort keys %in; #print "
"; print<<"scripts"; scripts $bandebleue="#93cffe"; while ($in{id}=~/,$/) {chop($in{id})} @ids=split/,/,$in{id}; $inid="'$in{id}'"; $inid=~s/,/','/g; foreach $thisid (@ids) { $sql="select Articles.Title,Countries.Name,Articles.Citation,Articles.Abstract,Articles.ArticleID,Intents.Name,Subintents.Name,Articles.PubYear from Articles left join Country on Articles.ArticleID=Country.ArticleID inner join Countries on Country.CountryID=Countries.Code left join Intents on Articles.IntentID=Intents.Code left join Subintents on Articles.SubintentID=Subintents.Code where Articles.ArticleID in ($inid) group by Articles.ArticleID"; $result=sql($sql,$dbi_tobres); while (@a=$result->fetchrow_array) { next if grep/^$a[4]$/,@dejafait; $a[3]=~s/\n/

/sg; $a[3]=~s/\. ([A-Z]{4})/.
$1/sg; $a[3]="(No Abstract)" unless $a[3]; $res_kw=sql("select Keywords.Name from Keywords inner join Keyword on Keywords.Code=Keyword.KeywordID where Keyword.ArticleID='$a[4]'",$dbi_tobres); while ($kw=$res_kw->fetchrow_array) {$keywords.="$kw; "} $res_kw->finish; if ($keywords=~/; $/) { chop($keywords); chop($keywords); } $res_au=sql("select Authors.Name from Authors inner join Author on Authors.Code=Author.AuthorID where Author.ArticleID='$a[4]'",$dbi_tobres); while ($au=$res_au->fetchrow_array) {$authors.="$au; "} $res_au->finish; if ($authors=~/; $/) { chop($authors); chop($authors); } if ($in{printable}==1) { print "
" unless @dejafait; lignetablo("$a[0]
$a[2]
Authors: $authors
Year: $a[7]
Keywords: $keywords
Country: $a[1]
Intent: $a[5]
Subintent: $a[6]","","100%","left"); lignetablo("
$a[3]","","100%","left"); print "
"; } else { lignetablo("$a[0]
$a[2]
Authors: $authors
Year: $a[7]
Keywords: $keywords
Country: $a[1]
Intent: $a[5]
Subintent: $a[6]
","#2266AA","100%","left"); #lignetablo("$a[0]
$a[2]
Year: $a[7]
Intent: $a[5]
Subintent: $a[6]
","#2266AA","100%","left"); lignetablo($a[3],"#F4F8FF","100%","left"); lignebleue('','','','',$bandebleue,1); } push @dejafait,$a[4]; } $result->finish; print "" if $in{printable}==1; print "" if $in{printable}==2; exit; } # affiche resultats if (($in{country} or $in{author} or $in{keywords} or $in{subintent} or $in{year} or $in{citation} or $in{title}) and !$in{id}) { $where=""; $innerjoin=""; if ($in{country}) { $where.=" and Country.CountryID=$in{country}"; $innerjoin.=" inner join Country on Articles.ArticleID=Country.ArticleID"; } if ($in{keywords}) { if ($in{phonetickw}) {$where.=" and Keywords.soundslike = soundex('$in{keywords}')"} else {$where.=" and (Keywords.Name like '$in{keywords}%' or Articles.Abstract like '%$in{keywords}%')"} $innerjoin.=" inner join Keyword on Articles.ArticleID=Keyword.ArticleID inner join Keywords on Keywords.Code=Keyword.KeywordID"; } if ($in{author}) { if ($in{phoneticau}) {$where.=" and Authors.soundslike = soundex('$in{author}')"} else {$where.=" and Authors.Name like '$in{author}%'"} #$innerjoin.=" inner join Author on Articles.ArticleID=Author.ArticleID inner join Authors on Authors.Code=Author.AuthorID"; } if ($in{year} and $in{year2}) { $where.=" and Articles.PubYear>='$in{year}' and Articles.PubYear<='$in{year2}'"; } elsif ($in{year}) { $where.=" and Articles.PubYear='$in{year}'"; } if ($in{title}) { $where.=" and Articles.Title like '%$in{title}%'"; } if ($in{citation}) { $where.=" and Articles.Citation like '%$in{citation}%'"; } if ($in{subintent}) { chop($in{subintent}); $where.=" and Subintents.Code in ($in{subintent})"; $innerjoin.=" inner join Subintents on Articles.SubintentID=Subintents.Code"; } $sql="select Articles.ArticleID,Articles.Title from Articles inner join Author on Articles.ArticleID=Author.ArticleID inner join Authors on Authors.Code=Author.AuthorID $innerjoin where Author.AuthorID=Authors.Code $where and Articles.valid='yes' group by Articles.ArticleID order by Articles.Title limit 30"; #print STDERR $sql; $result=sql($sql,$dbi_tobres); $nb=0; print "
"; while (@c=$result->fetchrow) { #$c[1]=~s/\]$//; #lignetablo(" $c[1] ($c[2]) print","","100%"); #$res_au=sql("select Authors.Name from Authors inner join Author on Authors.Code=Author.AuthorID where Author.ArticleID='$c[0]'",$dbi_tobres); #while ($au=$res_au->fetchrow_array) { # $auth=$au; # $auth=~s/\W.*//; # $authors.="$au; "; #} #$res_au->finish; #if ($authors=~/; $/) { # chop($authors); # chop($authors); #} $c[1]="No title" unless $c[1]; #lignetablo(" 
$c[1] ($authors)","","100%"); lignetablo(" $c[1]","","100%"); $nb++; } $result->finish; lignebleue('','','','',$bandebleue,1); unless ($nb) { lignetablo("No Match Found","","100%","center"); } else {lignetablo("  
 ",'','','center')} if ($nb==30) { print "
"; lignetablo("Your request returns more than 30 articles. Please be more specific.","#93cffe","100%","center"); } } # affiche formulaire $countries=""; $resul=sql("select Name,Code from Countries order by Name",$dbi_tobres); while (@a=$resul->fetchrow_array) {$countries.=""} $resul->finish; print "
"; $remplacer{COUNTRY}=$countries; printed2004("/ftp/tobres/literature.shtml"); <<'LAFIN'; print ""; print "
Intent:\n"; while (@a=$resul->fetchrow_array) { print ""; $subintents.=""; } $resul->finish; print "
Sub Intent:$subintents"; LAFIN $dbi_tobres->disconnect; sub printed2004 { my ($fichier,$return)=@_; undef $display; return unless -e $fichier; open(display,$fichier); @display=; close(display); chomp(@display); foreach $key (keys %remplacer) {map {s/%%$key%%/$remplacer{$key}/g} @display} map {$display.="$_\n"} @display; return $display if $return eq "return"; print $display; }