src/PredFinder/common/ElfMultiDoc.cpp
/** 
 *  Adds/updates the entity-id-to-xdoc_id and entity-id-to-bound-uri mappings for the entity ID.
 *  Makes sure that all entity IDs in other_ids point to the specified primary XDoc ID.
 *  Called by EIUtils::attemptNewswireLeadFix().
 *
 *  @param doc_theory DocTheory from which to abstract document name
 *  @param primary Primary entity ID
 *  @param other_ids Set of entity IDs that should all point to the primary entity ID
 **/


@param doc_theory DocTheory from which to abstract document name
@param primary Primary entity ID
@param other_ids Set of entity IDs that should all point to the primary entity ID
@param doc_theory DocTheory from which to abstract document name @param primary Primary entity ID @param other_ids Set of entity IDs that should all point to the primary entity ID
void ElfMultiDoc::merge_entities_in_map(const DocTheory* doc_theory, int primary_eid, const std::set<int> & other_eids){
	if(_eid_to_xdoc_ids.find(primary_eid) != _eid_to_xdoc_ids.end()) {
		BOOST_FOREACH(int other_eid, other_eids){
			_eid_to_xdoc_ids[other_eid].clear();
			BOOST_FOREACH(XDocIdType primary_xdoc_id, _eid_to_xdoc_ids[primary_eid]){
				_eid_to_xdoc_ids[other_eid].insert(primary_xdoc_id);
			}
		}
	}
	else {
		XDocIdType new_xdoc_id(get_next_special_xdoc_id_to_assign());
		SessionLogger::info("LEARNIT") << "New XDoc ID: <" << new_xdoc_id << ">" << std::endl;
		_eid_to_xdoc_ids[primary_eid].insert(new_xdoc_id);
		BOOST_FOREACH(int other_eid, other_eids){
			_eid_to_xdoc_ids[other_eid].clear();
			_eid_to_xdoc_ids[other_eid].insert(new_xdoc_id);
		}
	}
	if(_eid_to_bound_uris.find(primary_eid) != _eid_to_bound_uris.end()){
		BOOST_FOREACH(int other_eid, other_eids){
			_eid_to_bound_uris[other_eid].clear();
			BOOST_FOREACH(std::wstring primary_bound_uri, _eid_to_bound_uris[primary_eid]){
				_eid_to_bound_uris[other_eid].insert(primary_bound_uri);
			}
		}
	}
}
void ElfMultiDoc :: merge_entities_in_map ( const DocTheory * doc_theory , int primary_eid , const std :: set < int > & other_eids ) { if ( _eid_to_xdoc_ids . find ( primary_eid ) != _eid_to_xdoc_ids . end ( ) ) { BOOST_FOREACH ( int other_eid , other_eids ) { _eid_to_xdoc_ids [ other_eid ] . clear ( ) ; BOOST_FOREACH ( XDocIdType primary_xdoc_id , _eid_to_xdoc_ids [ primary_eid ] ) { _eid_to_xdoc_ids [ other_eid ] . insert ( primary_xdoc_id ) ; } } } else { XDocIdType new_xdoc_id ( get_next_special_xdoc_id_to_assign ( ) ) ; SessionLogger :: info ( " " ) << " " << new_xdoc_id << " " << std :: endl ; _eid_to_xdoc_ids [ primary_eid ] . insert ( new_xdoc_id ) ; BOOST_FOREACH ( int other_eid , other_eids ) { _eid_to_xdoc_ids [ other_eid ] . clear ( ) ; _eid_to_xdoc_ids [ other_eid ] . insert ( new_xdoc_id ) ; } } if ( _eid_to_bound_uris . find ( primary_eid ) != _eid_to_bound_uris . end ( ) ) { BOOST_FOREACH ( int other_eid , other_eids ) { _eid_to_bound_uris [ other_eid ] . clear ( ) ; BOOST_FOREACH ( std :: wstring primary_bound_uri , _eid_to_bound_uris [ primary_eid ] ) { _eid_to_bound_uris [ other_eid ] . insert ( primary_bound_uri ) ; } } } }
Adds/updates the entity-id-to-xdoc_id and entity-id-to-bound-uri mappings for the entity ID.
Adds / updates the entity - id - to - xdoc_id and entity - id - to - bound - uri mappings for the entity ID .
// There is an entry in the entity-id-to-xdoc_id map for this entity ID. Retrieve all the primary xdoc_ids
 // to which the entity ID points. Then make sure that there are entity-id-to-xdoc_id entries pointing
 // from each entity ID in other_ids to each of the primary xdoc_ids (and that any preexisting entries
 // are cleared).
 // There is no entry in the entity-id-to-xdoc_id map for this entity ID. Create a new 
 // xdoc_id (with a value decremented from INT_MAX-1) that is unlikely to conflict with existing ones.
 // Then make sure that there are new entity-id-to-xdoc_id entries pointing
 // from each entity ID in other_ids to each of the primary xdoc_ids (and that any preexisting entries are cleared).
 // There is an entry in the entity-id-to-bound-uri map for this entity ID. Retrieve all the bound URIs
 // to which the entity ID points. Then make sure that there are entity-id-to-bound-uri entries pointing
 // from each entity ID in other_ids to each of the primary bound URIs (and that any preexisting entries
 // are cleared).
