Browse Source

Fixed bug with friend fetching.

games-graph
jrtechs 4 years ago
parent
commit
86331008fb
1 changed files with 52 additions and 52 deletions
  1. +52
    -52
      src/main/java/net/jrtechs/www/graphDB/SteamGraph.java

+ 52
- 52
src/main/java/net/jrtechs/www/graphDB/SteamGraph.java View File

@ -254,8 +254,7 @@ public class SteamGraph
return con.getTraversal().V() return con.getTraversal().V()
.hasLabel(SteamGraph.KEY_PLAYER) .hasLabel(SteamGraph.KEY_PLAYER)
.has(Player.KEY_STEAM_ID, id) .has(Player.KEY_STEAM_ID, id)
.outE()
.inV()
.both()
.hasLabel(SteamGraph.KEY_PLAYER) .hasLabel(SteamGraph.KEY_PLAYER)
.valueMap() .valueMap()
.toStream() .toStream()
@ -383,68 +382,69 @@ public class SteamGraph
public static void main(String[] args) public static void main(String[] args)
{ {
SteamGraph graph = new SteamGraph(); SteamGraph graph = new SteamGraph();
System.out.println(
graph.con.getTraversal().E().hasLabel(Game.KEY_RELATIONSHIP).count().next()
);
//
Object o =
graph.con.getTraversal()
.V()
.hasLabel(Game.KEY_DB)
.match(
__.as("c").values(Game.KEY_STEAM_GAME_ID).as("gameID"),
__.as("c").values(Game.KEY_GAME_NAME).as("gameName"),
__.as("c").inE(Game.KEY_RELATIONSHIP).values(Game.KEY_PLAY_TIME).as("time")
).select("gameID", "time", "gameName").toList();
// System.out.println(new Gson().toJson(o));
WrappedFileWriter.writeToFile(new Gson().toJson(o).toLowerCase(), "games.json");
// System.out.println( // System.out.println(
// graph.con.getTraversal()
// .V()
// .hasLabel(Game.KEY_DB)
// .match(
// __.as("c").values(Game.KEY_STEAM_GAME_ID).as("gameID"),
// __.as("c").values(Game.KEY_GAME_NAME).as("gameName"),
// __.as("c").inE(Game.KEY_RELATIONSHIP).values(Game.KEY_PLAY_TIME).as("averageGameTime")
// ).select("gameID", "time", "averageGameTime").toList()
// graph.con.getTraversal().E().hasLabel(Game.KEY_RELATIONSHIP).count().next()
// ); // );
////
// Object o =
// graph.con.getTraversal()
// .V()
// .hasLabel(Game.KEY_DB)
// .match(
// __.as("c").values(Game.KEY_STEAM_GAME_ID).as("gameID"),
// __.as("c").values(Game.KEY_GAME_NAME).as("gameName"),
// __.as("c").inE(Game.KEY_RELATIONSHIP).values(Game.KEY_PLAY_TIME).as("time")
// ).select("gameID", "time", "gameName").toList();
//
//// System.out.println(new Gson().toJson(o));
// WrappedFileWriter.writeToFile(new Gson().toJson(o).toLowerCase(), "games.json");
//
//// System.out.println(
//// graph.con.getTraversal()
//// .V()
//// .hasLabel(Game.KEY_DB)
//// .match(
//// __.as("c").values(Game.KEY_STEAM_GAME_ID).as("gameID"),
//// __.as("c").values(Game.KEY_GAME_NAME).as("gameName"),
//// __.as("c").inE(Game.KEY_RELATIONSHIP).values(Game.KEY_PLAY_TIME).as("averageGameTime")
//// ).select("gameID", "time", "averageGameTime").toList()
//// );
//
//// System.out.println(
//// graph.con.getTraversal().V()
//// .hasLabel(Game.KEY_DB)
//// .as("g").inE()
//// .hasLabel(Game.KEY_RELATIONSHIP)
//// .as("p")
//// .project(Game.KEY_PLAY_TIME, Game.KEY_STEAM_GAME_ID).value().toList()
//// );
//
// System.out.println( // System.out.println(
// graph.con.getTraversal().V()
// .hasLabel(Game.KEY_DB)
// .as("g").inE()
// .hasLabel(Game.KEY_RELATIONSHIP)
// .as("p")
// .project(Game.KEY_PLAY_TIME, Game.KEY_STEAM_GAME_ID).value().toList()
// graph.con.getTraversal().E()
// .hasLabel(Game.KEY_RELATIONSHIP).values(Game.KEY_PLAY_TIME).max().toList()
// ); // );
System.out.println(
graph.con.getTraversal().E()
.hasLabel(Game.KEY_RELATIONSHIP).values(Game.KEY_PLAY_TIME).max().toList()
);
//
// graph.getPlayer("76561198188400721")
// .getFriends().forEach(f->
// {
// graph.getGameList(f.getId());
////
graph.getPlayer("76561198127662477");
graph.getGameList("76561198127662477");
graph.getPlayer("76561198406334664")
.getFriends().forEach(f->
{
graph.getGameList(f.getId());
// graph.getPlayer(f.getId()).getFriends().forEach(f2-> // graph.getPlayer(f.getId()).getFriends().forEach(f2->
// { // {
// graph.getGameList(f2.getId()); // graph.getGameList(f2.getId());
// graph.getPlayer(f2.getId()); // graph.getPlayer(f2.getId());
// }); // });
// });
});
//
// System.out.println(
// graph.con.getTraversal().V().hasLabel(SteamGraph.KEY_PLAYER)
// .has(SteamGraph.KEY_CRAWLED_GAME_STATUS, 1)
// .count().next()
// );
System.out.println(
graph.con.getTraversal().V().hasLabel(SteamGraph.KEY_PLAYER)
.has(SteamGraph.KEY_CRAWLED_GAME_STATUS, 1)
.count().next()
);
// graph.getPlayer("76561198062300654");
//graph.getGameList("76561198188400721");
// //graph.getPlayer("76561198068098265").getFriends().stream().forEach(System.out::println); // //graph.getPlayer("76561198068098265").getFriends().stream().forEach(System.out::println);
//// graph.indexPersonFriends("76561198188400721"); //// graph.indexPersonFriends("76561198188400721");
// graph.indexPersonsGames("76561198188400721"); // graph.indexPersonsGames("76561198188400721");

Loading…
Cancel
Save