diff --git a/WikiRating/src/main/java/controllers/Secondrun.java b/WikiRating/src/main/java/controllers/Secondrun.java index 72ae515..1afa97d 100644 --- a/WikiRating/src/main/java/controllers/Secondrun.java +++ b/WikiRating/src/main/java/controllers/Secondrun.java @@ -1,79 +1,79 @@ package main.java.controllers; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; import main.java.computations.BadgeGenerator; import main.java.computations.NormalisedVotes; import main.java.computations.PageRating; import main.java.computations.Pagerank; import main.java.computations.Reliability; import main.java.computations.UserCredibility; import main.java.models.AddNewPages; import main.java.models.User; import main.java.utilities.PropertiesAccess; /** * This class will be used for detecting and storing any new changes like * Page addition, Page modification and User Addition to the platform. */ @Path("secondRun") public class Secondrun { @GET @Produces("application/json") /** * This method will call suitable methods to insert all the new users and * update the database for any new changes * @return Response object showing time taken to run the computation */ public Response pCompute() { long startTime = System.currentTimeMillis(); /*Now we will check for new pages and add revisions to them too. *Make links to the user contributions too *Calculate the user votes and then calculate the recursive votes too. *We will calculate the backlinks too *Drop backlinks and then create the new ones again *Calculate the votes *Calculate the user reliability */ - //PropertiesAccess.putParameter("maxPageRainting", 20.0); - /*User.insertAllUsers(); + + User.insertAllUsers(); System.out.println("==================Checked for new User's insertion====================="); AddNewPages.checkForPages(); System.out.println("==================Checked for any new pages,revisions and linked the user contributions and made backlinks====================="); NormalisedVotes.calculatePageVotes(); System.out.println("==================Calculated new page votes====================="); Reliability.calculateReliability(); System.out.println("==================Calculated new reliabilities====================="); Pagerank.pageRankCompute(); System.out.println("==================Page rank over====================="); UserCredibility.getUserCredibility(); System.out.println("==================User Credibility computed====================="); PageRating.computePageRatings(); System.out.println("==================Page Ratings computed====================="); new BadgeGenerator().generateBadges(); - System.out.println("==================Badges given=====================");*/ + System.out.println("==================Badges given====================="); long estimatedTime = System.currentTimeMillis() - startTime; estimatedTime = estimatedTime / 60000; return Response.status(200).entity("Successful and took" + estimatedTime + "Minutes").build(); } } diff --git a/WikiRating/src/main/java/models/AddNewPages.java b/WikiRating/src/main/java/models/AddNewPages.java index f5abe72..44ffd48 100644 --- a/WikiRating/src/main/java/models/AddNewPages.java +++ b/WikiRating/src/main/java/models/AddNewPages.java @@ -1,287 +1,292 @@ package main.java.models; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.tinkerpop.blueprints.Direction; import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.impls.orient.OrientGraph; import main.java.controllers.WikiUtil; import main.java.utilities.AllowedNamespaces; import main.java.utilities.Connections; import main.java.utilities.PropertiesAccess; /** * This class will check for new pages, revisions made on previous pages and add them. * Further it will link them to the corresponding User contributions. * It will also link a page to other pages that has a back link towards it. */ public class AddNewPages { /** * This method will check for all the changes and then call suitable methods to handle them. */ public static void checkForPages(){ OrientGraph graph = Connections.getInstance().getDbGraph(); String allPages=""; try { //Now we will be iterating over all the namespaces to get all the pages in each og them. for(AllowedNamespaces namespace:AllowedNamespaces.values()){ //JSON interpretation try { //Getting the JSON formatted String to process. allPages =Page.getAllPages(namespace.getValue()); JSONObject js=new JSONObject(allPages); JSONObject js2=js.getJSONObject("query"); JSONArray arr=js2.getJSONArray("allpages"); JSONObject currentJsonObject; //Storing all the pages in a particular namespace for(int i=0;i