src/Generic/icews/ICEWSOutputWriter.cpp
// add event source actor data (actor_id, actor_name, etc.) to ICEWSEventData struct

add event source actor data (actor_id, actor_name, etc.) to ICEWSEventData struct
add event source actor data ( actor_id actor_name etc . ) to ICEWSEventData struct
void ICEWSOutputWriter::extractEventSourceData(ActorMention_ptr actor, ICEWSEventData& eventData) {
	ActorId actorID = ActorId();
	AgentId agentID = AgentId();
	if (ProperNounActorMention_ptr pm = boost::dynamic_pointer_cast<ProperNounActorMention>(actor)) {
		actorID = pm->getActorId();
	} else if (CompositeActorMention_ptr cm = boost::dynamic_pointer_cast<CompositeActorMention>(actor)) {
		actorID = cm->getPairedActorId();
		agentID = cm->getPairedAgentId();
	} 
	if (!actorID.isNull()) {
		eventData.source_actor_id = boost::lexical_cast<std::wstring>(actorID.getId());
		eventData.source_actor_name = _actorInfo->getName(actorID);
		std::vector<ActorId> countries = _actorInfo->getAssociatedCountryActorIds(actorID);
		if (countries.size() > 0) {
			eventData.source_country_code = L"";
			eventData.source_country_codes = L"";
			BOOST_FOREACH(ActorId countryId, countries) {
				Symbol cc = _actorInfo->getIsoCodeForActor(countryId);
				if (!cc.is_null()) {
					if (eventData.source_country_code == L"") {
						eventData.source_country_code = cc.to_string();
					}
					if (eventData.source_country_codes != L"") {
						eventData.source_country_codes += L",";
					}
					eventData.source_country_codes += cc.to_string();
				}
			}			
		} 
	}
	if (!agentID.isNull()) {
		eventData.source_agent_id = boost::lexical_cast<std::wstring>(agentID.getId());
		eventData.source_agent_name = _actorInfo->getName(agentID);
	}
}
void ICEWSOutputWriter :: extractEventSourceData ( ActorMention_ptr actor , ICEWSEventData & eventData ) { ActorId actorID = ActorId ( ) ; AgentId agentID = AgentId ( ) ; if ( ProperNounActorMention_ptr pm = boost :: dynamic_pointer_cast < ProperNounActorMention > ( actor ) ) { actorID = pm -> getActorId ( ) ; } else if ( CompositeActorMention_ptr cm = boost :: dynamic_pointer_cast < CompositeActorMention > ( actor ) ) { actorID = cm -> getPairedActorId ( ) ; agentID = cm -> getPairedAgentId ( ) ; } if ( ! actorID . isNull ( ) ) { eventData . source_actor_id = boost :: lexical_cast < std :: wstring > ( actorID . getId ( ) ) ; eventData . source_actor_name = _actorInfo -> getName ( actorID ) ; std :: vector < ActorId > countries = _actorInfo -> getAssociatedCountryActorIds ( actorID ) ; if ( countries . size ( ) > 0 ) { eventData . source_country_code = L" " ; eventData . source_country_codes = L" " ; BOOST_FOREACH ( ActorId countryId , countries ) { Symbol cc = _actorInfo -> getIsoCodeForActor ( countryId ) ; if ( ! cc . is_null ( ) ) { if ( eventData . source_country_code == L" " ) { eventData . source_country_code = cc . to_string ( ) ; } if ( eventData . source_country_codes != L" " ) { eventData . source_country_codes += L" " ; } eventData . source_country_codes += cc . to_string ( ) ; } } } } if ( ! agentID . isNull ( ) ) { eventData . source_agent_id = boost :: lexical_cast < std :: wstring > ( agentID . getId ( ) ) ; eventData . source_agent_name = _actorInfo -> getName ( agentID ) ; } }
add event source actor data (actor_id, actor_name, etc.)
add event source actor data ( actor_id actor_name etc . )