// Path: openqa.engine/src/main/java/org/aksw/openqa/component/answerformulation/AbstractSynthesizer.java
// public abstract class AbstractSynthesizer extends AbstractQFProcessor implements ISynthesizer {
// 
// 	public AbstractSynthesizer(Map<String, Object> params)
// 			throws IOException {
// 		super(params);
// 	}
// 	
// 	public void visit(IPluginVisitor visitor) {
// 		visitor.visit(this);
// 	}
// }
// 
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/object/IParams.java
// public interface IParams extends IObject {
// 	public IComponent getSource();
// }
// 
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/object/IResult.java
// public interface IResult extends IParams {
// 	public IParams getInputParam();
// }
// 
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/object/Result.java
// public class Result extends AbstractResult {
// 		
// 	protected IComponent source;
// 	protected IParams inputParam;
// 
// 	public Result() {
// 	}
// 	
// 	public Result(Map<String, Object> params, IParams inputParam, IComponent source) {
// 		// setting the source
// 		this.source = source;
// 		this.inputParam = inputParam;
// 		setProperties(params);
// 	}
// 	
// 	public Result(Map<String, Object> params) {
// 		// setting the source
// 		setProperties(params);
// 	}
// 	
// 	public Result(IParams inputParam, IComponent source) {
// 		// setting the source
// 		this.source = source;
// 		this.inputParam = inputParam;
// 	}
// 
// 	@Override
// 	public IComponent getSource() {
// 		return source;
// 	}
// 
// 	@Override
// 	public IParams getInputParam() {
// 		return inputParam;
// 	}
// }
// 
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/providers/impl/ServiceProvider.java
// public class ServiceProvider extends AbstractPluginProvider<IService, IServiceFactory> {
// 	public ServiceProvider(List<? extends ClassLoader> classLoaders) {
// 		super(IServiceFactory.class, classLoaders, null);
// 	}
// 	
// 	public ServiceProvider() {
// 	}
// }


import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.aksw.openqa.Properties;
import org.aksw.openqa.component.answerformulation.AbstractSynthesizer;
import org.aksw.openqa.component.context.IContext;
import org.aksw.openqa.component.object.IParams;
import org.aksw.openqa.component.object.IResult;
import org.aksw.openqa.component.object.Result;
import org.aksw.openqa.component.providers.impl.ServiceProvider;
			} else {
				Candidate candidate = new Candidate();
				candidate.param = param;
				candidate.incidence++;
				instanceIncidence.put(attrValue, candidate);
			}		
		}
		
		List<Entry<String, Candidate>> intanceIncidenceList = new ArrayList<Entry<String, Candidate>>(instanceIncidence.entrySet());
		Collections.sort(intanceIncidenceList, comparator);
		List<IResult> results = new ArrayList<IResult>();
		for(Entry<String, Candidate> entry: intanceIncidenceList) {			
			Candidate candidate = entry.getValue();
			IParams inputParam = candidate.param;
			Result result = new Result(inputParam.getParameters(), inputParam, this);
			results.add(result);
		}
		
		return results;
	}

	private class Candidate {
		IParams param;
		int incidence = 0;
	}

	@Override
	public List<? extends IResult> process(IParams param,
			ServiceProvider services, IContext context) throws Exception {
		List<IResult> results = new ArrayList<IResult>();
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/answerformulation/AbstractSynthesizer.java
// public abstract class AbstractSynthesizer extends AbstractQFProcessor implements ISynthesizer {
// 
// 	public AbstractSynthesizer(Map<String, Object> params)
// 			throws IOException {
// 		super(params);
// 	}
// 	
// 	public void visit(IPluginVisitor visitor) {
// 		visitor.visit(this);
// 	}
// }
// 
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/object/IParams.java
// public interface IParams extends IObject {
// 	public IComponent getSource();
// }
// 
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/object/IResult.java
// public interface IResult extends IParams {
// 	public IParams getInputParam();
// }
// 
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/object/Result.java
// public class Result extends AbstractResult {
// 		
// 	protected IComponent source;
// 	protected IParams inputParam;
// 
// 	public Result() {
// 	}
// 	
// 	public Result(Map<String, Object> params, IParams inputParam, IComponent source) {
// 		// setting the source
// 		this.source = source;
// 		this.inputParam = inputParam;
// 		setProperties(params);
// 	}
// 	
// 	public Result(Map<String, Object> params) {
// 		// setting the source
// 		setProperties(params);
// 	}
// 	
// 	public Result(IParams inputParam, IComponent source) {
// 		// setting the source
// 		this.source = source;
// 		this.inputParam = inputParam;
// 	}
// 
// 	@Override
// 	public IComponent getSource() {
// 		return source;
// 	}
// 
// 	@Override
// 	public IParams getInputParam() {
// 		return inputParam;
// 	}
// }
// 
// Path: openqa.engine/src/main/java/org/aksw/openqa/component/providers/impl/ServiceProvider.java
// public class ServiceProvider extends AbstractPluginProvider<IService, IServiceFactory> {
// 	public ServiceProvider(List<? extends ClassLoader> classLoaders) {
// 		super(IServiceFactory.class, classLoaders, null);
// 	}
// 	
// 	public ServiceProvider() {
// 	}
// }


// Path: openqa.engine/src/main/java/org/aksw/openqa/component/answerformulation/synthesizer/impl/DefaultRDFTermSynthesizer.java
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.aksw.openqa.Properties;
import org.aksw.openqa.component.answerformulation.AbstractSynthesizer;
import org.aksw.openqa.component.context.IContext;
import org.aksw.openqa.component.object.IParams;
import org.aksw.openqa.component.object.IResult;
import org.aksw.openqa.component.object.Result;
import org.aksw.openqa.component.providers.impl.ServiceProvider;

			} else {
				Candidate candidate = new Candidate();
				candidate.param = param;
				candidate.incidence++;
				instanceIncidence.put(attrValue, candidate);
			}		
		}
		
		List<Entry<String, Candidate>> intanceIncidenceList = new ArrayList<Entry<String, Candidate>>(instanceIncidence.entrySet());
		Collections.sort(intanceIncidenceList, comparator);
		List<IResult> results = new ArrayList<IResult>();
		for(Entry<String, Candidate> entry: intanceIncidenceList) {			
			Candidate candidate = entry.getValue();
			IParams inputParam = candidate.param;
			Result result = new Result(inputParam.getParameters(), inputParam, this);
			results.add(result);
		}
		
		return results;
	}

	private class Candidate {
		IParams param;
		int incidence = 0;
	}

	@Override
	public List<? extends IResult> process(IParams param,
			ServiceProvider services, IContext context) throws Exception {
		List<IResult> results = new ArrayList<IResult>();
		Result result = new Result(param.getParameters());