package com.wx.application.nebula.graph.base;

/**
 * 语句模板
 */
public interface GqlTemplate {
	
	final static String CREATESPACE = "CREATE SPACE IF NOT EXISTS {}(vid_type = {}({})) COMMENT =\"{}\"";
	final static String SHOWSPACES = "SHOW SPACES";
	final static String USESPACE = "USE {};";
	final static String DROPSPACE = "DROP SPACE IF EXISTS {}";
	final static String DESCSPACE = "DESC SPACE {}";
	
	final static String CREATETAG = "CREATE TAG IF NOT EXISTS {} ({}) COMMENT =\"{}\"";
	final static String DROPTAG = "DROP TAG IF EXISTS {}";
	final static String ALTERADDTAG = "ALTER TAG {} ADD ({})";
	final static String ALTERDROPTAG = "ALTER TAG {} DROP ({})";
	final static String ALTERCHANGETAG = "ALTER TAG {} CHANGE ({})";
	final static String SHOWTAGS = "SHOW TAGS";
	final static String SHOWCREATETAG = "SHOW create tag {}";
	
	final static String DESCRIBETAG = "DESCRIBE TAG {}";
	
	final static String CREATEEDGE = "CREATE EDGE IF NOT EXISTS {}({}) COMMENT =\"{}\"";
	final static String DROPEDGE = "DROP EDGE IF EXISTS {}";
	final static String ALTERADDEDGE = "ALTER EDGE {} ADD ({})";
	final static String ALTERDROPEDGE = "ALTER EDGE {} DROP ({})";
	final static String ALTERCHANGEEDGE = "ALTER EDGE {} CHANGE ({})";
	final static String SHOWEDGES = "SHOW EDGES";
	final static String DESCRIBEEDGE = "DESCRIBE EDGE {}";
	final static String SHOWCREATEEDGE = "SHOW create edge {}";
	
	final static String CREATEINDEX = "CREATE {} INDEX IF NOT EXISTS {} on {}({}) COMMENT \"{}\"";
	final static String SHOWINDEX = "SHOW {} INDEXES;";
	final static String DROPINDEX = "DROP {} INDEX {};";
	
	
	final static String DELETEVERTEX = "DELETE VERTEX '{}' WITH EDGE;";
	final static String INSERTVERTEX = "INSERT VERTEX {} ({}) VALUES {}";
	
	final static String DELETEEDGEDATA = "DELETE EDGE {} {}->{}";
	final static String INSERTDGEDATA = "INSERT EDGE {} ({}) VALUES {}";
	
	
	final static String NODESBYVID = "match(v) where id(v)=={} return v";
	
	final static String NODESBYVIDS = "FETCH PROP ON {} {} YIELD vertex AS v";
	final static String RELATIONSBYVIDS = "FETCH PROP ON {} {} YIELD edge AS e";
	
	final static String ONERELATIONBYID = "MATCH p=(n1)-->(n2) where id(n1)=={} RETURN p";
	
	final static String ONERELATIONBYSRCIDANDDCTID = "MATCH p=(n1)-->(n2) where id(n1)=={} and id(n2)=={} RETURN p";
	
	final static String PAGING =" | limit {},{}";
	
	final static String MATCHVERTEXSNGQL = "MATCH (n) RETURN n skip {} limit {}";
	
	final static String LOOKUPEDGESNGQL = "LOOKUP ON {} YIELD edge as e";
	
	final static String LOOKUPVERTEXSNGQL = "LOOKUP ON {} YIELD vertex as e";
	
	final static String MATCHVERTEXBYWHERESNGQL = "MATCH (v:{}) {} RETURN v skip {} limit {}";
	
	/**
	 * 根据点的id集合删除点
	 */
	final static String DELETEVERTEXBYVIDS = "FETCH PROP ON {} {} YIELD id(vertex) as id | DELETE VERTEX $-.id WITH EDGE";
	
	/**
	 * 根据条件管道删除点
	 */
	final static String DELETEVERTEXCONDUIT = "LOOKUP ON {} YIELD id(vertex) as id | DELETE VERTEX $-.id WITH EDGE";

	
	/**
	 * 根据条件统计点
	 */
	final static String COUNTVERTEXS = "LOOKUP ON {} YIELD id(vertex) | YIELD COUNT(*) AS ct";
	
	/**
	 * 根据条件统计边
	 */
	final static String COUNTEDGES = "LOOKUP ON {} YIELD edge AS e | YIELD COUNT(*) AS ct";
	
	/**
	 * 根据图空间统计
	 */
	final static String SUBMITJOBSTATS = "SUBMIT JOB STATS";
	final static String SHOWSTATS = "SHOW STATS";
	final static String STOPJOB = "STOP JOB {}";
	
	
}
