// 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/ui/render/AbstractInfoGraphRender.java
// public abstract class AbstractInfoGraphRender extends AbstractPlugin implements InfoGraphRender {
// 	
// 	public AbstractInfoGraphRender() {
// 	}
// 	
// 	public AbstractInfoGraphRender(Class<? extends IPlugin> c, Map<String, Object> params) {
// 		super(c, params);
// 	}
// 	
// 	@Override
// 	public void render(RenderProvider renderProvider, InfoNode result, IContext context, ServletOutputStream out) throws Exception {
// 		printStart(renderProvider, result, context, out);
// 		printContent(renderProvider, result, context, out);
// 		printEnd(renderProvider, result, context, out);
// 	}
// 	
// 	@Override
// 	public boolean canRender(IContext context, InfoNode node)
// 			throws Exception {
// 		IResult result = node.getResult();
// 		
// 		if(result == null)
// 			return false;		
// 		
// 		// default check
// 		return result.contains(Properties.URI) ||
// 				result.contains(Properties.Literal.NUMBER) ||
// 				result.contains(Properties.Literal.DATE) ||
// 				result.contains(Properties.Literal.BOOLEAN) ||
// 				result.contains(Properties.RESOURCE);
// 	}
// 	
// 	protected abstract void printStart(RenderProvider render, InfoNode result, IContext context, ServletOutputStream out) throws Exception;
// 
// 	protected abstract void printEnd(RenderProvider render, InfoNode result, IContext context, ServletOutputStream out) throws Exception;
// 
// 	protected abstract void printContent(RenderProvider render, InfoNode result, IContext context, ServletOutputStream out) throws Exception;
// 	
// 	public void visit(IPluginVisitor visitor) {
// 		visitor.visit(this);
// 	}
// }


import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import org.aksw.openqa.Properties;
import org.aksw.openqa.component.context.IContext;
import org.aksw.openqa.component.object.IResult;
import org.aksw.openqa.component.providers.impl.RenderProvider;
import org.aksw.openqa.component.ui.render.AbstractInfoGraphRender;
import org.aksw.openqa.component.ui.render.InfoNode;
import org.apache.commons.lang.StringEscapeUtils;
	+		"</div>"
	+	"<hr class=\"ui-separator ui-state-default ui-corner-all\">"
	+ "</div>";
		
	private final static String endHTML = "</body>" +
											"</html>";
	
	private String linkHumanQuery = "<a id=\"h\" style=\"margin-left: 10px;\" class=\"button_go\" href=\"search?q=\">Graph Search</a>";	
	private String linkRobotQuery = "<a id=\"r\" style=\"margin-left: 10px;\" class=\"button_robot\" href=\"search?q=&amp;content=sparql\">" + StringEscapeUtils.escapeHtml("I´m a robot") + "</a>";
	
	public ResultRender(Map<String, Object> params) {
		super(ResultRender.class, params);
	}

	@Override
	public void printStart(RenderProvider render, InfoNode result, IContext context, ServletOutputStream out) throws Exception {
		String query = (String) context.getInputQuery();
		String linkHumanQuery = this.linkHumanQuery.replace("search?q=", "search?q=" + query);
		String linkRobotQuery = this.linkRobotQuery.replace("search?q=", "search?q=" + query);
		out.print(startHTML + " value=\"" + query +"\""+ searchInputQuery + linkHumanQuery + linkRobotQuery + afterQuery);
	}
	
	@Override
	protected void printContent(RenderProvider render, InfoNode node, IContext context, ServletOutputStream out)
			throws Exception {
		List<InfoNode> infoNodeList = node.getInfoList();
		if(infoNodeList != null) {
			List<InfoNode> infoCopyNodeList = new ArrayList<InfoNode>(infoNodeList);
			// filtering categories
			for(InfoNode infoNode : infoNodeList) {
// 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/ui/render/AbstractInfoGraphRender.java
// public abstract class AbstractInfoGraphRender extends AbstractPlugin implements InfoGraphRender {
// 	
// 	public AbstractInfoGraphRender() {
// 	}
// 	
// 	public AbstractInfoGraphRender(Class<? extends IPlugin> c, Map<String, Object> params) {
// 		super(c, params);
// 	}
// 	
// 	@Override
// 	public void render(RenderProvider renderProvider, InfoNode result, IContext context, ServletOutputStream out) throws Exception {
// 		printStart(renderProvider, result, context, out);
// 		printContent(renderProvider, result, context, out);
// 		printEnd(renderProvider, result, context, out);
// 	}
// 	
// 	@Override
// 	public boolean canRender(IContext context, InfoNode node)
// 			throws Exception {
// 		IResult result = node.getResult();
// 		
// 		if(result == null)
// 			return false;		
// 		
// 		// default check
// 		return result.contains(Properties.URI) ||
// 				result.contains(Properties.Literal.NUMBER) ||
// 				result.contains(Properties.Literal.DATE) ||
// 				result.contains(Properties.Literal.BOOLEAN) ||
// 				result.contains(Properties.RESOURCE);
// 	}
// 	
// 	protected abstract void printStart(RenderProvider render, InfoNode result, IContext context, ServletOutputStream out) throws Exception;
// 
// 	protected abstract void printEnd(RenderProvider render, InfoNode result, IContext context, ServletOutputStream out) throws Exception;
// 
// 	protected abstract void printContent(RenderProvider render, InfoNode result, IContext context, ServletOutputStream out) throws Exception;
// 	
// 	public void visit(IPluginVisitor visitor) {
// 		visitor.visit(this);
// 	}
// }


// Path: openqa.render.infograph/src/main/java/org/aksw/openqa/component/ui/render/impl/ResultRender.java
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import org.aksw.openqa.Properties;
import org.aksw.openqa.component.context.IContext;
import org.aksw.openqa.component.object.IResult;
import org.aksw.openqa.component.providers.impl.RenderProvider;
import org.aksw.openqa.component.ui.render.AbstractInfoGraphRender;
import org.aksw.openqa.component.ui.render.InfoNode;
import org.apache.commons.lang.StringEscapeUtils;

	+		"</div>"
	+	"<hr class=\"ui-separator ui-state-default ui-corner-all\">"
	+ "</div>";
		
	private final static String endHTML = "</body>" +
											"</html>";
	
	private String linkHumanQuery = "<a id=\"h\" style=\"margin-left: 10px;\" class=\"button_go\" href=\"search?q=\">Graph Search</a>";	
	private String linkRobotQuery = "<a id=\"r\" style=\"margin-left: 10px;\" class=\"button_robot\" href=\"search?q=&amp;content=sparql\">" + StringEscapeUtils.escapeHtml("I´m a robot") + "</a>";
	
	public ResultRender(Map<String, Object> params) {
		super(ResultRender.class, params);
	}

	@Override
	public void printStart(RenderProvider render, InfoNode result, IContext context, ServletOutputStream out) throws Exception {
		String query = (String) context.getInputQuery();
		String linkHumanQuery = this.linkHumanQuery.replace("search?q=", "search?q=" + query);
		String linkRobotQuery = this.linkRobotQuery.replace("search?q=", "search?q=" + query);
		out.print(startHTML + " value=\"" + query +"\""+ searchInputQuery + linkHumanQuery + linkRobotQuery + afterQuery);
	}
	
	@Override
	protected void printContent(RenderProvider render, InfoNode node, IContext context, ServletOutputStream out)
			throws Exception {
		List<InfoNode> infoNodeList = node.getInfoList();
		if(infoNodeList != null) {
			List<InfoNode> infoCopyNodeList = new ArrayList<InfoNode>(infoNodeList);
			// filtering categories
			for(InfoNode infoNode : infoNodeList) {
				IResult result = infoNode.getResult();