// Path: src/main/java/org/deri/cqels/data/EnQuad.java
// public class EnQuad {
// 	long gID,sID,pID,oID;
// 	long time;
// 	public EnQuad(long gID,long sID, long pID, long oID){
// 		this.gID=gID;
// 		this.sID=sID;
// 		this.pID=pID;
// 		this.oID=oID;
// 		time=System.nanoTime();
// 	}
// 	
// 	public long getGID(){
// 		return gID;
// 	}
// 	
// 	public long getSID(){
// 		return sID;
// 	}
// 	
// 	public long getPID(){
// 		return pID;
// 	}
// 	
// 	public long getOID(){
// 		return oID;
// 	}
// 	
// 	public long time(){ return time;};
// }


import org.deri.cqels.data.EnQuad;
import com.espertech.esper.client.EPServiceProvider;
import com.espertech.esper.client.EPServiceProviderManager;
import com.espertech.esper.client.EPStatement;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.sparql.core.Quad;
import com.hp.hpl.jena.tdb.store.NodeId;
package org.deri.cqels.engine;



/** 
 * This class implements CQELS engine. It has an Esper Service provider and context belonging to
 * 
 * @author		Danh Le Phuoc
 * @author 		Chan Le Van
 * @organization DERI Galway, NUIG, Ireland  www.deri.ie
 * @email 	danh.lephuoc@deri.org
 * @email   chan.levan@deri.org
 */
public class CQELSEngine {
	EPServiceProvider provider;
	ExecContext context;
    
	/**
	 * @param context the context this engine belonging to
	 */
	public CQELSEngine(ExecContext context) {
		this.provider = EPServiceProviderManager.getDefaultProvider();
		this.context = context;
	}
	
	/**
	 * send a quad to to engine
	 * @param quad the quad will be sent after encoded
	 */
	public void send(Quad quad) {
		this.provider.getEPRuntime().sendEvent(encode(quad));
	}
	
	/**
	 * send a quad which is represented as a graph node and a triple to engine
	 * @param graph graph node
	 * @param triple
	 */
	public void send(Node graph, Triple triple) {
		this.provider.getEPRuntime().sendEvent(encode(graph,triple));
	}
	
	/**
	 * send a quad which is represented as a graph, subject, 
	 * predicate and object node to engine
	 * @param graph graph node
	 * @param s subject
	 * @param p predicate
	 * @param o object
	 */
	public void send(Node graph, Node s, Node p, Node o) {
// Path: src/main/java/org/deri/cqels/data/EnQuad.java
// public class EnQuad {
// 	long gID,sID,pID,oID;
// 	long time;
// 	public EnQuad(long gID,long sID, long pID, long oID){
// 		this.gID=gID;
// 		this.sID=sID;
// 		this.pID=pID;
// 		this.oID=oID;
// 		time=System.nanoTime();
// 	}
// 	
// 	public long getGID(){
// 		return gID;
// 	}
// 	
// 	public long getSID(){
// 		return sID;
// 	}
// 	
// 	public long getPID(){
// 		return pID;
// 	}
// 	
// 	public long getOID(){
// 		return oID;
// 	}
// 	
// 	public long time(){ return time;};
// }


// Path: src/main/java/org/deri/cqels/engine/CQELSEngine.java
import org.deri.cqels.data.EnQuad;
import com.espertech.esper.client.EPServiceProvider;
import com.espertech.esper.client.EPServiceProviderManager;
import com.espertech.esper.client.EPStatement;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.sparql.core.Quad;
import com.hp.hpl.jena.tdb.store.NodeId;

package org.deri.cqels.engine;



/** 
 * This class implements CQELS engine. It has an Esper Service provider and context belonging to
 * 
 * @author		Danh Le Phuoc
 * @author 		Chan Le Van
 * @organization DERI Galway, NUIG, Ireland  www.deri.ie
 * @email 	danh.lephuoc@deri.org
 * @email   chan.levan@deri.org
 */
public class CQELSEngine {
	EPServiceProvider provider;
	ExecContext context;
    
	/**
	 * @param context the context this engine belonging to
	 */
	public CQELSEngine(ExecContext context) {
		this.provider = EPServiceProviderManager.getDefaultProvider();
		this.context = context;
	}
	
	/**
	 * send a quad to to engine
	 * @param quad the quad will be sent after encoded
	 */
	public void send(Quad quad) {
		this.provider.getEPRuntime().sendEvent(encode(quad));
	}
	
	/**
	 * send a quad which is represented as a graph node and a triple to engine
	 * @param graph graph node
	 * @param triple
	 */
	public void send(Node graph, Triple triple) {
		this.provider.getEPRuntime().sendEvent(encode(graph,triple));
	}
	
	/**
	 * send a quad which is represented as a graph, subject, 
	 * predicate and object node to engine
	 * @param graph graph node
	 * @param s subject
	 * @param p predicate
	 * @param o object
	 */
	public void send(Node graph, Node s, Node p, Node o) {
		this.provider.getEPRuntime().sendEvent(new EnQuad(encode(graph), encode(s), 