org.apache.flink.graph.examples.data.MusicProfilesData Java Examples

The following examples show how to use org.apache.flink.graph.examples.data.MusicProfilesData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MusicProfiles.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static DataSet<Tuple3<String, String, Integer>> getUserSongTripletsData(ExecutionEnvironment env) {
	if (fileOutput) {
		return env.readCsvFile(userSongTripletsInputPath)
				.lineDelimiter("\n").fieldDelimiter("\t")
				.types(String.class, String.class, Integer.class);
	} else {
		return MusicProfilesData.getUserSongTriplets(env);
	}
}
 
Example #2
Source File: MusicProfiles.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static DataSet<String> getMismatchesData(ExecutionEnvironment env) {
	if (fileOutput) {
		return env.readTextFile(mismatchesInputPath);
	} else {
		return MusicProfilesData.getMismatches(env);
	}
}
 
Example #3
Source File: MusicProfilesITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Before
public void before() throws Exception {
	topSongsResultPath = tempFolder.newFile().toURI().toString();
	communitiesResultPath = tempFolder.newFile().toURI().toString();

	File tripletsFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(tripletsFile, MusicProfilesData.USER_SONG_TRIPLETS);
	tripletsPath = tripletsFile.toURI().toString();

	File mismatchesFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(mismatchesFile, MusicProfilesData.MISMATCHES);
	mismatchesPath = mismatchesFile.toURI().toString();
}
 
Example #4
Source File: MusicProfiles.java    From flink with Apache License 2.0 5 votes vote down vote up
private static DataSet<Tuple3<String, String, Integer>> getUserSongTripletsData(ExecutionEnvironment env) {
	if (fileOutput) {
		return env.readCsvFile(userSongTripletsInputPath)
				.lineDelimiter("\n").fieldDelimiter("\t")
				.types(String.class, String.class, Integer.class);
	} else {
		return MusicProfilesData.getUserSongTriplets(env);
	}
}
 
Example #5
Source File: MusicProfiles.java    From flink with Apache License 2.0 5 votes vote down vote up
private static DataSet<String> getMismatchesData(ExecutionEnvironment env) {
	if (fileOutput) {
		return env.readTextFile(mismatchesInputPath);
	} else {
		return MusicProfilesData.getMismatches(env);
	}
}
 
Example #6
Source File: MusicProfilesITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void before() throws Exception {
	topSongsResultPath = tempFolder.newFile().toURI().toString();
	communitiesResultPath = tempFolder.newFile().toURI().toString();

	File tripletsFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(tripletsFile, MusicProfilesData.USER_SONG_TRIPLETS);
	tripletsPath = tripletsFile.toURI().toString();

	File mismatchesFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(mismatchesFile, MusicProfilesData.MISMATCHES);
	mismatchesPath = mismatchesFile.toURI().toString();
}
 
Example #7
Source File: MusicProfiles.java    From flink with Apache License 2.0 5 votes vote down vote up
private static DataSet<Tuple3<String, String, Integer>> getUserSongTripletsData(ExecutionEnvironment env) {
	if (fileOutput) {
		return env.readCsvFile(userSongTripletsInputPath)
				.lineDelimiter("\n").fieldDelimiter("\t")
				.types(String.class, String.class, Integer.class);
	} else {
		return MusicProfilesData.getUserSongTriplets(env);
	}
}
 
Example #8
Source File: MusicProfiles.java    From flink with Apache License 2.0 5 votes vote down vote up
private static DataSet<String> getMismatchesData(ExecutionEnvironment env) {
	if (fileOutput) {
		return env.readTextFile(mismatchesInputPath);
	} else {
		return MusicProfilesData.getMismatches(env);
	}
}
 
Example #9
Source File: MusicProfilesITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void before() throws Exception {
	topSongsResultPath = tempFolder.newFile().toURI().toString();
	communitiesResultPath = tempFolder.newFile().toURI().toString();

	File tripletsFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(tripletsFile, MusicProfilesData.USER_SONG_TRIPLETS);
	tripletsPath = tripletsFile.toURI().toString();

	File mismatchesFile = tempFolder.newFile();
	FileUtils.writeFileUtf8(mismatchesFile, MusicProfilesData.MISMATCHES);
	mismatchesPath = mismatchesFile.toURI().toString();
}
 
Example #10
Source File: MusicProfilesITCase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testMusicProfilesExample() throws Exception {
	MusicProfiles.main(new String[]{tripletsPath, mismatchesPath, topSongsResultPath, "0", communitiesResultPath,
			MusicProfilesData.MAX_ITERATIONS + ""});
	expectedTopSongs = MusicProfilesData.TOP_SONGS_RESULT;
}
 
Example #11
Source File: MusicProfilesITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testMusicProfilesExample() throws Exception {
	MusicProfiles.main(new String[]{tripletsPath, mismatchesPath, topSongsResultPath, "0", communitiesResultPath,
			MusicProfilesData.MAX_ITERATIONS + ""});
	expectedTopSongs = MusicProfilesData.TOP_SONGS_RESULT;
}
 
Example #12
Source File: MusicProfilesITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testMusicProfilesExample() throws Exception {
	MusicProfiles.main(new String[]{tripletsPath, mismatchesPath, topSongsResultPath, "0", communitiesResultPath,
			MusicProfilesData.MAX_ITERATIONS + ""});
	expectedTopSongs = MusicProfilesData.TOP_SONGS_RESULT;
}