src/PredFinder/elf/ElfRelationFactory.cpp
/**
 * Given a pattern return, extract the role. If the role is nonempty and is not
 * already contained in roles_already_found, also extract the type and value 
 * (for some types, filling in the value with a fake but plausible entry). Build
 * it into an arg, and push it back onto the end of arg_vec.
 *
 * @param pr_ptr The PatternReturn from which information is to be extracted.
 * @param roles_already_found A set of the roles already found.
 * @param arg_vec A vector of args, passed by reference, to which this method will append
 * a single arg if it has a different role from the ones already contained in the vector.
 *
 * @author afrankel@bbn.com
 **/
Given a pattern return, extract the role. If the role is nonempty and is not
already contained in roles_already_found, also extract the type and value
(for some types, filling in the value with a fake but plausible entry). Build
it into an arg, and push it back onto the end of arg_vec.

@param pr_ptr The PatternReturn from which information is to be extracted.
@param roles_already_found A set of the roles already found.
@param arg_vec A vector of args, passed by reference, to which this method will append
a single arg if it has a different role from the ones already contained in the vector.


Given a pattern return extract the role . If the role is nonempty and is not already contained in roles_already_found also extract the type and value ( for some types filling in the value with a fake but plausible entry ) . Build it into an arg and push it back onto the end of arg_vec . @param pr_ptr The PatternReturn from which information is to be extracted . @param roles_already_found A set of the roles already found . @param arg_vec A vector of args passed by reference to which this method will append a single arg if it has a different role from the ones already contained in the vector .
void ElfRelationFactory::add_arg_from_pattern_return(const PatternReturn_ptr pr_ptr, 
													 std::set<std::wstring> & roles_already_found, 
													 std::vector< ElfRelationArg_ptr > & arg_vec) {
	std::wstring role = pr_ptr->getValue(L"role");
	if (role.empty()) {
		return;
	}
	if (roles_already_found.find(role) == roles_already_found.end()) {
		roles_already_found.insert(role);
		std::wstring value = pr_ptr->getValue(L"value");
		std::wstring type = pr_ptr->getValue(L"type");
        update_fake_value_from_type(type, value);
		ElfRelationArg_ptr arg = boost::make_shared<ElfRelationArg>(role, type, value);
		arg_vec.push_back(arg);
	} 
		;
}
void ElfRelationFactory :: add_arg_from_pattern_return ( const PatternReturn_ptr pr_ptr , std :: set < std :: wstring > & roles_already_found , std :: vector < ElfRelationArg_ptr > & arg_vec ) { std :: wstring role = pr_ptr -> getValue ( L" " ) ; if ( role . empty ( ) ) { return ; } if ( roles_already_found . find ( role ) == roles_already_found . end ( ) ) { roles_already_found . insert ( role ) ; std :: wstring value = pr_ptr -> getValue ( L" " ) ; std :: wstring type = pr_ptr -> getValue ( L" " ) ; update_fake_value_from_type ( type , value ) ; ElfRelationArg_ptr arg = boost :: make_shared < ElfRelationArg > ( role , type , value ) ; arg_vec . push_back ( arg ) ; } ; }
Given a pattern return, extract the role.
Given a pattern return extract the role .
// TODO: We may want to process <ElfIndividual>s here, too. For now, simply
 // reject every case where no role is found.
 // These messages were often bogus. For instance, sprop patterns
 // often generated these warnings, even when the patterns were legit.
 // If it turns out that we need the warnings in the future and have
 // some means for filtering out the legitimate instances, we could
 // reinstate this branch.
 //else {
 //SessionLogger::info("LEARNIT") << pattern_set_name << ": "
 //	  << "role <" << role << "> for "
 //	  << "<" << id_vec_seq_pair.first.to_string() << "> already found. "
 //	  << "This instance will be ignored."
 //	  << endl;
 //}
