src/PredFinder/macros/RelationParameter.cpp
/**
 * Comparison method; makes sure that the relation's
 * roles would all be consumed. Does not check the
 * predicate, since by convention that is used for output.
 *
 * @param relation The relation to match against.
 * @param ignore_unknown A flag that if true considers
 * this relation parameter to match a relation even if
 * the relation contains roles not contained in this parameter.
 * @param allow_individual A flag that if true allows the use
 * of the special "individual" role name indicating that the role
 * refers to a generated individual. Default false.
 *
 * @return True if all non-optional roles are present.
 *
 * @author nward@bbn.com
 * @date 2010.10.15
 **/
Comparison method; makes sure that the relation's
roles would all be consumed. Does not check the
predicate, since by convention that is used for output.

@param relation The relation to match against.
@param ignore_unknown A flag that if true considers
this relation parameter to match a relation even if
the relation contains roles not contained in this parameter.
@param allow_individual A flag that if true allows the use
of the special "individual" role name indicating that the role
refers to a generated individual. Default false.

@return True if all non-optional roles are present.


Comparison method ; makes sure that the relation ' s roles would all be consumed . Does not check the predicate since by convention that is used for output . @param relation The relation to match against . @param ignore_unknown A flag that if true considers this relation parameter to match a relation even if the relation contains roles not contained in this parameter . @param allow_individual A flag that if true allows the use of the special " individual " role name indicating that the role refers to a generated individual . Default false . @return True if all non - optional roles are present .
bool RelationParameter::matches(ElfRelation_ptr relation, bool ignore_unknown, bool allow_individual) {
	size_t matched_roles = 0;
	BOOST_FOREACH(RoleParameter_ptr role, _roles) {
		if (allow_individual && role->get_input_name() == L"individual")
			continue;
		ElfRelationArg_ptr arg = relation->get_arg(role->get_input_name());
		if (arg.get() != NULL) {
			matched_roles++;
		} else if (!role->is_optional()) {
			return false;
		}
	}
	if (ignore_unknown || matched_roles == relation->get_args().size())
		return true;
	return false;
}
bool RelationParameter :: matches ( ElfRelation_ptr relation , bool ignore_unknown , bool allow_individual ) { size_t matched_roles = 0 ; BOOST_FOREACH ( RoleParameter_ptr role , _roles ) { if ( allow_individual && role -> get_input_name ( ) == L" " ) continue ; ElfRelationArg_ptr arg = relation -> get_arg ( role -> get_input_name ( ) ) ; if ( arg . get ( ) != NULL ) { matched_roles ++ ; } else if ( ! role -> is_optional ( ) ) { return false ; } } if ( ignore_unknown || matched_roles == relation -> get_args ( ) . size ( ) ) return true ; return false ; }
Comparison method; makes sure that the relation's
 roles would all be consumed.
Comparison method ; makes sure that the relation ' s roles would all be consumed .
// Loop over this relation parameter's role parameters, checking each one
 // Ignore roles that refer to a generated individual if allowed
 // Get the arg for this role, if any
 // Count this as a match
 // Required role not found, no match
 // Make sure we matched everything (that is the relation didn't have unknown roles)
 // No match
