[Bio] / FigWebServices / save_to_attributes.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/save_to_attributes.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4, Thu Jan 18 19:21:52 2007 UTC revision 1.6, Tue Mar 20 18:15:29 2007 UTC
# Line 18  Line 18 
18  my $all_publications = $cgi->param("all_publications");  my $all_publications = $cgi->param("all_publications");
19  my $peg = $cgi->param ("purpose_peg");  my $peg = $cgi->param ("purpose_peg");
20  my $name  = $cgi->param ("master");  my $name  = $cgi->param ("master");
21    my $role = $cgi->param("functional_role");
22  my $server_name = $ENV{'SERVER_NAME'};  my $server_name = $ENV{'SERVER_NAME'};
23    
24    
# Line 32  Line 33 
33          print "Press the back button <p>";          print "Press the back button <p>";
34          exit;          exit;
35  }  }
36  print "$peg<p>";  #print "$peg<p>";
37  #print $curated_journals;  #print $curated_journals;
38    
39  my @pubmed_r_attributes = $fig->get_attributes($peg, "PUBMED_CURATED_RELEVANT");  my @pubmed_r_attributes = $fig->get_attributes($peg, "PUBMED_CURATED_RELEVANT");
# Line 67  Line 68 
68                  #Check to see if the pmid is already in the attributes for this peg                  #Check to see if the pmid is already in the attributes for this peg
69                  #If it is then we exit                  #If it is then we exit
70                  next if ($to_add =~ /PMID/);                  next if ($to_add =~ /PMID/);
71                  print "ADD PMID is $to_add<p>";                  #print "ADD PMID is $to_add<p>";
72    
73                  if( $pmid2key{$to_add} ne "") {                  if( $pmid2key{$to_add} ne "") {
74                          print "PMID:$to_add is already in the attribute database<p>";                          print "PMID:$to_add is already in the attribute database<p>";
# Line 77  Line 78 
78                          my $add_title = &FigWebServices::SeedComponents::PubMed::pmid_to_title($to_add);                          my $add_title = &FigWebServices::SeedComponents::PubMed::pmid_to_title($to_add);
79                          my $add_url = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=pubmed&dopt=Abstract&list_uids=$to_add";                          my $add_url = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=pubmed&dopt=Abstract&list_uids=$to_add";
80                          $fig->add_attribute($peg, "PUBMED_CURATED_RELEVANT", "$name,$to_add,$add_title", $add_url);                          $fig->add_attribute($peg, "PUBMED_CURATED_RELEVANT", "$name,$to_add,$add_title", $add_url);
81                          print "Added to attributes as PUBMED_CURATED_RELEVANT, $name,$to_add, $add_title<p>";  
82                            my $output_table = &FigWebServices::SeedComponents::PubMed::get_author_date_title($to_add);
83                            my ($id, $author, $date, $title) = split(/\;/, $output_table);
84                            my $peg_relevant_value = "$author\;$date\;$title";
85                            $fig->add_attribute("Role:$role", "ROLE_FROM_PEG_RELEVANT",  "$to_add\;$name\;$peg_relevant_value");
86    
87                            #print "Added to attributes as PUBMED_CURATED_RELEVANT, $name,$to_add, $add_title<p>";
88                          $pmid2whom{$to_add} = $name;                          $pmid2whom{$to_add} = $name;
89                          $pmid2key{$to_add} = "PUBMED_CURATED_RELEVANT";                          $pmid2key{$to_add} = "PUBMED_CURATED_RELEVANT";
90                  }                  }
# Line 106  Line 113 
113    
114          if (! $pmid2key{$curated_pmid})          if (! $pmid2key{$curated_pmid})
115          {          {
116                  print "Doesn't exist $pmid2key{$curated_pmid}";                  my $output_table = &FigWebServices::SeedComponents::PubMed::get_author_date_title($curated_pmid);
117                    my ($id, $author, $date, $title) = split(/\;/, $output_table);
118                    my $peg_relevant_value = "$author\;$date\;$title";
119                  $fig->add_attribute($peg, $curated_key, "$name,$curated_pmid,$value", $url);                  $fig->add_attribute($peg, $curated_key, "$name,$curated_pmid,$value", $url);
120                  print "Doesn't exist - ADD $peg, $curated_key, $name,$curated_pmid, $value <p>";                  $fig->add_attribute("Role:$role", "ROLE_FROM_PEG_RELEVANT",  "$curated_pmid\;$name\;$peg_relevant_value");
121                  $pmid2whom{$curated_pmid} = $name;                  $pmid2whom{$curated_pmid} = $name;
122                  $pmid2key{$curated_pmid} = $curated_key;                  $pmid2key{$curated_pmid} = $curated_key;
123    
# Line 120  Line 129 
129          if ( $curated_key ne $pmid2key{$curated_pmid}          if ( $curated_key ne $pmid2key{$curated_pmid}
130          )  {          )  {
131                  my $delete_url = $url;                  my $delete_url = $url;
132                  $fig->delete_attribute($peg,$pmid2key{$curated_pmid},$pmid2value{$curated_pmid},$delete_url);                  $fig->delete_matching_attributes($peg,$pmid2key{$curated_pmid},"$pmid2whom{$curated_pmid}%");
133                  $fig->add_attribute($peg,$curated_key,"$name,$curated_pmid,$value",$url);                  $fig->add_attribute($peg,$curated_key,"$name,$curated_pmid,$value",$url);
134    
135                  print "ADD $peg, $curated_key, $name,$curated_pmid, $value <p>";                  my $output_table = &FigWebServices::SeedComponents::PubMed::get_author_date_title($curated_pmid);
136                  print "DELETE $pmid2key{$curated_pmid} $pmid2value{$curated_pmid}<p>";                  my ($id, $author, $date, $title) = split(/\;/, $output_table);
137                    my $peg_relevant_value = "$author\;$date\;$title";
138                    $fig->add_attribute("Role:$role", "ROLE_FROM_PEG_RELEVANT",  "$curated_pmid\;$name\;$peg_relevant_value");
139                  #Update the hash                  #Update the hash
140                  $pmid2whom{$curated_pmid} = $name;                  $pmid2whom{$curated_pmid} = $name;
141                  $pmid2key{$curated_pmid} = $curated_key;                  $pmid2key{$curated_pmid} = $curated_key;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3