package im.ene.lab.rdf.bench.ksj;

import im.ene.lab.rdf.bench.ksj.map.KsjDataManager;
import im.ene.lab.rdf.bench.ksj.map.ksj.shelter.ShelterDataLoaderImpl;
import im.ene.lab.rdf.bench.ksj.map.ksj.shelter.ShelterDataset;
import im.ene.lab.rdf.bench.ksj.util.DataUtil;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		String dir = args.length > 0 ? args[0] : "shelter_data";

		KsjDataManager mgr = new KsjDataManager(dir + File.separatorChar
				+ "org", dir + File.separatorChar + "csv");

		ShelterDataLoaderImpl shelterLoader = new ShelterDataLoaderImpl(dir
				+ File.separatorChar + "original", dir + File.separatorChar
				+ "csv");

		System.out.println(dir);
		// mgr.getJapanPolygon();
		// mgr.getAreaDataset();
		// mgr.getRailwayDataset();
		// mgr.getBusDataset(13);
		// mgr.getKsjFile(20);

		ShelterDataset tokyoData = shelterLoader.getShelterDataset(13);
		// System.out.println(tokyoData.toString());

		File file = new File("tokyo.txt");

		// if file doesnt exists, then create it
		if (!file.exists()) {
			file.createNewFile();
		}

		FileOutputStream outFile = new FileOutputStream(file);

		// FileWriter fw = new FileWriter(file.getAbsoluteFile(), false);
		// BufferedWriter bw = new BufferedWriter(fw);
		// bw.write(tokyoData.toString());
		// bw.close();

		tokyoData.toRDF(DataUtil.MODEL).write(outFile, "Turtle");
		// outFile.flush();
		outFile.close();

	}
}

@@ -427,16 +427,158 @@
 ption %7B%0A
+%0A%09%09/*%0A%09%09 * at titech%0A%09%09 */%0A%09%09System.setProperty(%22http.proxyHost%22, %22proxy.noc.titech.ac.jp%22);%0A%09%09System.setProperty(%22http.proxyPort%22, %223128%22);%0A%0A
 %09%09String
@@ -1058,24 +1058,25 @@
 ile(20);%0A%0A%09%09
+ 
 ShelterDatas
@@ -1129,16 +1129,17 @@
 (13);%0A%09%09
+ 
 // Syste
@@ -1175,19 +1175,24 @@
 ing());%0A
+%09%09//
 %0A%09%09
+ 
 File fil
@@ -1204,16 +1204,43 @@
 ew File(
+dir + File.separatorChar + 
 %22tokyo.t
@@ -1245,21 +1245,28 @@
 .txt%22);%0A
+%09%09//
 %0A%09%09//
+ //
  if file
@@ -1298,16 +1298,19 @@
 te it%0A%09%09
+// 
 if (!fil
@@ -1325,17 +1325,19 @@
 ()) %7B%0A%09%09
-%09
+// 
 file.cre
@@ -1356,13 +1356,21 @@
 ;%0A%09%09
-%7D%0A
+// %7D%0A%09%09//
 %0A%09%09
+ 
 File
@@ -1420,21 +1420,28 @@
 (file);%0A
+%09%09//
 %0A%09%09//
+ //
  FileWri
@@ -1500,16 +1500,19 @@
 e);%0A%09%09//
+ //
  Buffere
@@ -1548,24 +1548,27 @@
 er(fw);%0A%09%09//
+ //
  bw.write(to
@@ -1592,16 +1592,19 @@
 ));%0A%09%09//
+ //
  bw.clos
@@ -1608,19 +1608,24 @@
 lose();%0A
+%09%09//
 %0A%09%09
+ 
 tokyoDat
@@ -1676,18 +1676,16 @@
 le%22);%0A%09%09
-//
  outFile
@@ -1696,16 +1696,17 @@
 sh();%0A%09%09
+ 
 outFile.
@@ -1715,13 +1715,253 @@
 ose();%0A%0A
+//%09%09RandomProfileUtil profile = new RandomProfileUtil();%0A//%09%09NPeople%5B%5D profiles = profile.getDefault(); // 2 people at a time%0A//%0A//%09%09if (profiles != null && profiles.length %3E= 1)%0A//%09%09%09System.out.println(DataUtil.GSON.toJson(profiles%5B0%5D));%0A%0A
 %09%7D%0A%7D%0A

modify Main.java