// 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 if (param.contains(Properties.Literal.TEXT))
				attrValue = (String) param.getParam(Properties.Literal.TEXT);
			else {
				attrValue = (String) param.getParam(Properties.RESOURCE);
			}
			
			// there is no check for null, once canProcess assure that there is the attribute

			if(attrKey == Properties.URI) {
				attrValue = attrValue.substring(attrKey.lastIndexOf("/") + 1);
			}
			
			if(instanceIncidence.containsKey(attrValue)) {
				Candidate candidate = instanceIncidence.get(attrValue);
				candidate.incidence++;
				instanceIncidence.put(attrValue, candidate);
			} 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;
// 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 if (param.contains(Properties.Literal.TEXT))
				attrValue = (String) param.getParam(Properties.Literal.TEXT);
			else {
				attrValue = (String) param.getParam(Properties.RESOURCE);
			}
			
			// there is no check for null, once canProcess assure that there is the attribute

			if(attrKey == Properties.URI) {
				attrValue = attrValue.substring(attrKey.lastIndexOf("/") + 1);
			}
			
			if(instanceIncidence.containsKey(attrValue)) {
				Candidate candidate = instanceIncidence.get(attrValue);
				candidate.incidence++;
				instanceIncidence.put(attrValue, candidate);
			} 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);