src/LearnIt/MatchInfo.cpp
/** Given a proposition and a slot filler, return a list of all paths that connect
  * that proposition to that slot filler.  A path is a list of <proposition, arg-role>
  * pairs.  The returned paths will all have 'prop' as the proposition for the
  * first element of the path. */
Given a proposition and a slot filler, return a list of all paths that connect
that proposition to that slot filler.  A path is a list of 
pairs.  The returned paths will all have 'prop' as the proposition for the
first element of the path.
Given a proposition and a slot filler return a list of all paths that connect that proposition to that slot filler . A path is a list of pairs . The returned paths will all have ' prop ' as the proposition for the first element of the path .
void MatchInfo::findPropPaths(const SentenceTheory *sentTheory, const Proposition *prop, 
							  SlotFiller_ptr slotFiller, const PropPath &pathToHere,
							  std::vector<PropPath> &result)
{
	BOOST_FOREACH(PropPathLink link, pathToHere) {
		if (link.prop == prop) {
			SessionLogger::info("LEARNIT") << "Cycle detected: ";
			BOOST_FOREACH(PropPathLink l, pathToHere) {
				SessionLogger::info("LEARNIT") << l.prop->getPredHead()->toTextString()
					<< L" " << l.role << L" -> ";
			}
			SessionLogger::info("LEARNIT") << prop->getPredHead()->toTextString() << std::endl;
			return;
		}
	}
	Proposition::PredType propType = prop->getPredType();
	if ((propType == Proposition::NOUN_PRED) || (propType == Proposition::COPULA_PRED) ||
		(propType == Proposition::VERB_PRED) || (propType == Proposition::MODIFIER_PRED)) {
		for (int a = 0; a < prop->getNArgs(); a++) {
			Argument *arg = prop->getArg(a);
			PropPath pathFromHere(pathToHere);
			pathFromHere.push_back(PropPathLink(prop, arg->getRoleSym().to_string(), false));
			findPropPathsViaArg(sentTheory, prop, arg, slotFiller, pathFromHere, result);
		}
	}
	if ((propType == Proposition::SET_PRED) || (propType == Proposition::COMP_PRED))
	{
		for (int a = 0; a < prop->getNArgs(); a++) {
			Argument *arg = prop->getArg(a);
			findPropPathsViaArg(sentTheory, prop, arg, slotFiller, pathToHere, result);
		}
	}
}
void MatchInfo :: findPropPaths ( const SentenceTheory * sentTheory , const Proposition * prop , SlotFiller_ptr slotFiller , const PropPath & pathToHere , std :: vector < PropPath > & result ) { BOOST_FOREACH ( PropPathLink link , pathToHere ) { if ( link . prop == prop ) { SessionLogger :: info ( " " ) << " " ; BOOST_FOREACH ( PropPathLink l , pathToHere ) { SessionLogger :: info ( " " ) << l . prop -> getPredHead ( ) -> toTextString ( ) << L" " << l . role << L" " ; } SessionLogger :: info ( " " ) << prop -> getPredHead ( ) -> toTextString ( ) << std :: endl ; return ; } } Proposition :: PredType propType = prop -> getPredType ( ) ; if ( ( propType == Proposition :: NOUN_PRED ) || ( propType == Proposition :: COPULA_PRED ) || ( propType == Proposition :: VERB_PRED ) || ( propType == Proposition :: MODIFIER_PRED ) ) { for ( int a = 0 ; a < prop -> getNArgs ( ) ; a ++ ) { Argument * arg = prop -> getArg ( a ) ; PropPath pathFromHere ( pathToHere ) ; pathFromHere . push_back ( PropPathLink ( prop , arg -> getRoleSym ( ) . to_string ( ) , false ) ) ; findPropPathsViaArg ( sentTheory , prop , arg , slotFiller , pathFromHere , result ) ; } } if ( ( propType == Proposition :: SET_PRED ) || ( propType == Proposition :: COMP_PRED ) ) { for ( int a = 0 ; a < prop -> getNArgs ( ) ; a ++ ) { Argument * arg = prop -> getArg ( a ) ; findPropPathsViaArg ( sentTheory , prop , arg , slotFiller , pathToHere , result ) ; } } }
Given a proposition and a slot filler, return a list of all paths that connect
 that proposition to that slot filler.
Given a proposition and a slot filler return a list of all paths that connect that proposition to that slot filler .
// Check for cycles: infinite loops are not a good thing.
 // If the proposition has an appropriate type, then (recursively) 
 // check all its arguments to see if they contain the slot filler.
 // If the argument contains a 'SET' or 'COMP' proposition, then recurse to all of
 // of its children, but do *not* add a link to the path.  This has the effect of
 // transparently bypassing SET and COMP predicates.
