[Bio] / Sprout / CustomAttributes.pm Repository:
ViewVC logotype

Diff of /Sprout/CustomAttributes.pm

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

revision 1.16, Wed Jan 24 09:50:29 2007 UTC revision 1.17, Thu Jan 25 02:41:12 2007 UTC
# Line 273  Line 273 
273                  $retVal->Add(lineUsed => 1);                  $retVal->Add(lineUsed => 1);
274                  # Now we insert the attribute.                  # Now we insert the attribute.
275                  $self->InsertObject('HasValueFor', { from => $keyName, to => $id,                  $self->InsertObject('HasValueFor', { from => $keyName, to => $id,
                                                      keywords => $self->_KeywordString($keyName, $value),  
276                                                       value => $value });                                                       value => $value });
277                  $retVal->Add(newValue => 1);                  $retVal->Add(newValue => 1);
278              }              }
# Line 1282  Line 1281 
1281      return @retVal;      return @retVal;
1282  }  }
1283    
 =head3 FindAttributes  
   
 C<< my @attributeList = $attrDB->FindAttributes($searchString); >>  
   
 Search for attributes relevant to a specified keyword. This method performs  
 a full-text search for attribute data. It returns the same information as  
 L</GetAttributes>, except instead of filtering on specific keys or objects we do  
 a text search of the entire <strong>HasValueFor</strong> table.  
   
 =over 4  
   
 =item searchString  
   
 Search string to use. The syntax is the same as it is for any ERDB keyword  
 search.  
   
 =item RETURN  
   
 Returns a list of tuples. The first element in the tuple is an object ID, the  
 second is an attribute key, and the remaining elements are the sections of  
 the attribute value. All of the tuples will match the criteria expressed in  
 the search string.  
   
 =back  
   
 =cut  
   
 sub FindAttributes {  
     # Get the parameters.  
     my ($self, $searchString) = @_;  
     # Search the database.  
     my $query = $self->Search($searchString, 0, ['HasValueFor'], "", []);  
     # Build the results from the query.  
     my @retVal = $self->_QueryResults($query);  
     # Return the result.  
     return @retVal;  
 }  
   
1284  =head3 AddAttribute  =head3 AddAttribute
1285    
1286  C<< $attrDB->AddAttribute($objectID, $key, @values); >>  C<< $attrDB->AddAttribute($objectID, $key, @values); >>
# Line 1364  Line 1325 
1325          # Connect the object to the key.          # Connect the object to the key.
1326          $self->InsertObject('HasValueFor', { 'from-link' => $key,          $self->InsertObject('HasValueFor', { 'from-link' => $key,
1327                                               'to-link'   => $objectID,                                               'to-link'   => $objectID,
                                              'keywords' => $self->_KeywordString($key, $valueString),  
1328                                               'value'     => $valueString,                                               'value'     => $valueString,
1329                                         });                                         });
1330      }      }

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3