import java.io.*;

class graphing
{
	public static void main(String args[])
	{
		try
		{
			FileInputStream f=new FileInputStream("Schema_Parse_Entities.txt");
			FileInputStream f1=new FileInputStream("Schema_Parse_Types.txt");
			FileInputStream f2=new FileInputStream("Schema_Parse_Rules.txt");
			FileInputStream f3=new FileInputStream("Schema_Parse_Functions.txt");
			FileOutputStream fo=new FileOutputStream("graph.txt");
			FileOutputStream fo2=new FileOutputStream("param.txt");
			DataInputStream bf=new DataInputStream(f);
			DataInputStream bf1=new DataInputStream(f1);
			DataInputStream bf2=new DataInputStream(f2);
			DataInputStream bf3=new DataInputStream(f3);
			PrintStream ds=new PrintStream(fo);
			PrintStream ds2=new PrintStream(fo2);
			
			Integer id=8;
			
			ds.println("vType"+","+"1"+","+"ENTITY");
			ds.println("vType"+","+"2"+","+"TYPE");
			ds.println("vType"+","+"3"+","+"RULE");
			ds.println("vType"+","+"4"+","+"FUNCTION");
			ds.println("eType"+","+"5"+","+"SUPER");
			ds.println("eType"+","+"6"+","+"SUB");
			ds.println("eType"+","+"7"+","+"USES");
			//ds.println("eType"+","+"8"+","+"ONE AMONG");
			//ds.println("eType"+","+"9"+","+"FOR");			
				while(bf.available()>0) //generating vertices with an index
				{
					String str=bf.readLine();
					str.trim();
					ds.println("v"+","+"1"+","+id.toString()+","+str); // writing to graph.txt
					ds2.println(str); //writing to param.txt which contains all the concepts
					id++;
				}
				while(bf1.available()>0)
				{
					String str=bf1.readLine();
					str.trim();
					ds.println("v"+","+"2"+","+id.toString()+","+str);
					ds2.println(str);
					id++;
				}
				while(bf2.available()>0)
				{
					String str=bf2.readLine();
					str.trim();
					ds.println("v"+","+"3"+","+id.toString()+","+str);
					ds2.println(str);
					id++;
				}
				while(bf3.available()>0)
				{
					String str=bf3.readLine();
					str.trim();
					ds.println("v"+","+"4"+","+id.toString()+","+str);
					ds2.println(str);
					id++;
				}
			
			ds.close();
			ds2.close();
		}
		catch(Exception e)		
		{
			System.err.println(e);
		}
	}
}