public static int splitSample(String filename, String sampleName, int count, int userLevel, int resLevel, int tagLevel, boolean resSplit) {
		
		String resultfile = sampleName + "_core_u" + userLevel + "_r" + resLevel + "_t" + tagLevel;
		BookmarkReader reader = new BookmarkReader(0, false);
		reader.readFile(filename);		
		
		System.out.println("Unique users before filtering: " + reader.getUsers().size());
		System.out.println("Unique resources before filtering: " + reader.getResources().size());
		System.out.println("Unique tags before filtering: " + reader.getTags().size());
		System.out.println("Lines before filtering: " + reader.getBookmarks().size());
		if (userLevel > 0 || resLevel > 0 || tagLevel > 0) {		
			int i = 0;
			while (true) {
				System.out.println("Core iteration: " + i);
				int size = reader.getBookmarks().size();
				CoreFiltering filtering = new CoreFiltering(reader);
				reader = filtering.filterOrphansIterative(userLevel, resLevel, tagLevel);
				String coreResultfile = resultfile + "_c" + ++i;
				writeWikiSample(reader, reader.getBookmarks(), coreResultfile, null);
				if (reader.getBookmarks().size() >= size) {
					return reader.getBookmarks().size();
				}
				
				// re-read the filtered dataset			
				reader = new BookmarkReader(0, false);
				reader.readFile(coreResultfile);
				File file = new File("./data/csv/" + coreResultfile + ".txt");
				file.delete();
			}			
		} else {		
			BookmarkSplitter splitter = new BookmarkSplitter(reader);
			// TODOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
			Collections.sort(reader.getBookmarks());
			for (int i = 1; i <= count; i++) {
				//splitter.splitFile(sampleName, 10);
				if (resSplit) {
					splitter.leavePercentageOutSplit(sampleName, 10, false);
				} else {
					splitter.leaveLastOutSplit(sampleName, true);
				}
				//splitter.splitUserPercentage(filename, 15);
			}
		}
		return -1;
	}