// Path: src/main/java/eu/socialsensor/focused/crawler/models/ImageVector.java
// public class ImageVector {
// 	public String id;
// 	public double[] v;
// 	public String url;
// 
// 	public ImageVector(String id, String url, double[] v) {
// 		this.id = id;
// 		this.url = url;
// 		this.v = v;
// 	}
// }


import static backtype.storm.utils.Utils.tuple;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.Logger;
import com.mathworks.toolbox.javabuilder.MWException;
import eu.socialsensor.focused.crawler.models.ImageVector;
import eu.socialsensor.framework.common.domain.Concept;
import eu.socialsensor.framework.common.domain.Concept.ConceptType;
import eu.socialsensor.framework.common.domain.MediaItem;
import gr.iti.mklab.detector.examples.Example;
import gr.iti.mklab.detector.examples.ReadFileToStringList;
import gr.iti.mklab.detector.smal.ConceptDetector;
import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseRichBolt;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;
package eu.socialsensor.focused.crawler.bolts.media;






public class ConceptDetectionBolt extends BaseRichBolt {

	/**
	 *	@author Manos Schinas - manosetro@iti.gr
	 *
	 *	Storm Bolt using to detect concepts in media items. The bolt collects Visual Features 
	 *	of Media Items, and periodically runs a Concept Detection method.   
	 * 	
	 * 	For more information in Concept detection algorithm used from ConceptDetectionBolt
	 *  check the following project in github: 
	 *  https://github.com/socialsensor/mm-concept-detection-experiments
	 *  
	 */
	private static final long serialVersionUID = 8098257892768970548L;
	private static Logger _logger;
	
	private String matlabFile;
// Path: src/main/java/eu/socialsensor/focused/crawler/models/ImageVector.java
// public class ImageVector {
// 	public String id;
// 	public double[] v;
// 	public String url;
// 
// 	public ImageVector(String id, String url, double[] v) {
// 		this.id = id;
// 		this.url = url;
// 		this.v = v;
// 	}
// }


// Path: src/main/java/eu/socialsensor/focused/crawler/bolts/media/ConceptDetectionBolt.java
import static backtype.storm.utils.Utils.tuple;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.Logger;
import com.mathworks.toolbox.javabuilder.MWException;
import eu.socialsensor.focused.crawler.models.ImageVector;
import eu.socialsensor.framework.common.domain.Concept;
import eu.socialsensor.framework.common.domain.Concept.ConceptType;
import eu.socialsensor.framework.common.domain.MediaItem;
import gr.iti.mklab.detector.examples.Example;
import gr.iti.mklab.detector.examples.ReadFileToStringList;
import gr.iti.mklab.detector.smal.ConceptDetector;
import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseRichBolt;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;

package eu.socialsensor.focused.crawler.bolts.media;






public class ConceptDetectionBolt extends BaseRichBolt {

	/**
	 *	@author Manos Schinas - manosetro@iti.gr
	 *
	 *	Storm Bolt using to detect concepts in media items. The bolt collects Visual Features 
	 *	of Media Items, and periodically runs a Concept Detection method.   
	 * 	
	 * 	For more information in Concept detection algorithm used from ConceptDetectionBolt
	 *  check the following project in github: 
	 *  https://github.com/socialsensor/mm-concept-detection-experiments
	 *  
	 */
	private static final long serialVersionUID = 8098257892768970548L;
	private static Logger _logger;
	
	private String matlabFile;
	private BlockingQueue<Pair<ImageVector, MediaItem>> queue;