Package cross.reputation.model

Examples of cross.reputation.model.Community


   
    //Set All Model
    ConfigureModel.buildCrossReputationGlobalModel();
   
    //Set the destination community to import the other community reputations
    Community destinationCommunity = GlobalModel.getCommunities().get("semanticWiki");
   
    //Add all entities configured to all metrics in the destination community
    for(Entity entity : ConfigureModel.SetWikiUserEntitiesAndAccounts()) {
      destinationCommunity.addEntityToAllMetrics(entity);
    }
   
    //Set that all rest communities and theirs metrics are valid to the importation
    List<CommunityMetricToImport> metricsToImport = ConfigureModel.
      buildMetricsFromAllCommunitiesToAllMetrics(destinationCommunity);
View Full Code Here


   
    GlobalModel.addScale(new NumericScale("stackOverflowScale",30000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("stackOverflowMetric", reputationInQandA,
        GlobalModel.getScales().get("stackOverflowScale")));
    String stackOverflowCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("stackoverflow.com","stackoverflow.com",
        stackOverflowCategories,GlobalModel.getMetrics().get("stackOverflowMetric")));   
   
    GlobalModel.addScale(new NumericScale("serverFaultScale",20000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("serverFaultMetric", reputationInQandA,
        GlobalModel.getScales().get("serverFaultScale")));
    String serverFaultCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("serverfault.com","serverfault.com",
        serverFaultCategories,GlobalModel.getMetrics().get("serverFaultMetric")));
       
    GlobalModel.addScale(new NumericScale("webAppsStackExchangeScale",20000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("webAppsStackExchangeMetric", reputationInQandA,
        GlobalModel.getScales().get("webAppsStackExchangeScale")));
    String webAppsStackExchangeCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("webapps.stackexchange.com","webapps.stackexchange.com",
        webAppsStackExchangeCategories,GlobalModel.getMetrics().get("webAppsStackExchangeMetric")));
       
    GlobalModel.addScale(new NumericScale("questionsSecuritytubeScale",20000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("questionsSecuritytubeMetric", reputationInQandA,
        GlobalModel.getScales().get("questionsSecuritytubeScale")));
    String questionsSecuritytubeCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("questions.securitytube.net","questions.securitytube.net",
        questionsSecuritytubeCategories,GlobalModel.getMetrics().get("questionsSecuritytubeMetric")));
       
    GlobalModel.addScale(new NumericScale("security.StackexchangeScale",2000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("security.StackexchangeMetric", reputationInQandA,
        GlobalModel.getScales().get("security.StackexchangeScale")));
    String securityStackexchangeCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("security.stackexchange.com","security.stackexchange.com",
        securityStackexchangeCategories,GlobalModel.getMetrics().get("security.StackexchangeMetric")));
   
    GlobalModel.addScale(new NumericScale("semanticWikiScale",10.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("semanticWikiMetric", reputationInQandA,
        GlobalModel.getScales().get("semanticWikiScale")){
      public Object aggregateValues(Map<CommunityMetricToImport,Object> values) {
        Object total = null;
        int sum = 0;
        for(CommunityMetricToImport comMetToImp: values.keySet()) {
          if(comMetToImp.getCommunity() ==
              GlobalModel.getCommunities().get("ohloh.net")) {
            if(total != null) {
              total = getScale().mulValues(total,values.get(comMetToImp),0.1/0.9);
            } else {
              total = values.get(comMetToImp);
            }
            if(sum == 0) {
              sum = 1;
            }
            //System.out.println("new total in mul:"+total);
          }                   
        }
        for(CommunityMetricToImport comMetToImp: values.keySet()) {
          if(comMetToImp.getCommunity() ==
            GlobalModel.getCommunities().get("ohloh.net")) {
            continue;
          }
          //System.out.println("total:"+total+" next value to sum:"+values.get(comMetToImp));         
          total = getScale().sumValues(total, values.get(comMetToImp));
          sum++;
        }       
        //return doAverage(total,sum);
        return total;
      }
    });   
    String semanticWikiCategories[] = {securityWebAppCategory};
    Community wiki = new Community("semanticWiki","lab.gsi.dit.upm.es/semanticwiki",
        semanticWikiCategories,GlobalModel.getMetrics().get("semanticWikiMetric"));
   
    String ohlohCategories[] = {projectConnCategory};   
    Set<Metric> ohlohMetrics = new HashSet<Metric>();
    GlobalModel.addScale(new NumericScale("ohlohKudoScale",10.0,0.0,1.0));
    Metric ohlohKudoMetric = GlobalModel.addMetric(new Metric("ohlohKudoMetric",
        projectsReputation,GlobalModel.getScales().get("ohlohKudoScale")));
    ohlohMetrics.add(ohlohKudoMetric)
    GlobalModel.addScale(new NumericScale("ohlohRankScale",450000.0,0.0,1.0));
    Metric ohlohRankMetric = GlobalModel.addMetric(new Metric("ohlohRankMetric", rankReputation,
        GlobalModel.getScales().get("ohlohRankScale")));
    ohlohMetrics.add(ohlohRankMetric);   
    GlobalModel.addCommunity(new Community("ohloh.net","ohloh.net",
        ohlohCategories,ohlohMetrics));
   
    GlobalModel.addScale(new NumericScale("slackersScale",10.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("slackersMetric", reputationInQandA,
        GlobalModel.getScales().get("slackersScale")));
    String slackersCategories[] = {GlobalModel.addCategory("QandA")};
    GlobalModel.addCommunity(new Community("sla.ckers.org","sla.ckers.org",
        slackersCategories,GlobalModel.getMetrics().get("slackersMetric")));
   
   
    GlobalModel.addCommunity(wiki);
   
View Full Code Here

        new ArrayList<CommunityMetricToImport>();   
    for(String communityId : GlobalModel.getCommunities().keySet()) {
      if(communityId == community.getName()) {
        continue;
      }
      Community sourceCommunity = GlobalModel.getCommunities().get(communityId);
      for(Metric sourceMetric : sourceCommunity.getMetrics()) {
        communityMetricsToImport.addAll(buildCommunityMetricToImportToAllMetrics(
            sourceCommunity, community, sourceMetric));
      }
    }
    //printMetricsFromCommunity(communityMetricsToImport);
View Full Code Here

    for(Entity entity : GlobalModel.getEntities().values()) {
      Map<Community,EntityIdentifier> usuario = entity.getIdentificatorInCommunities();
      //In this form of iteration, we dont search accounts in the new accounts found or
      //  accounts updated that have already been iterated
      for(Object object : usuario.keySet().toArray()) {
        Community community = (Community) object;
        String userName = usuario.get(community).getName();
        //System.out.println(userName+":"+community);
        String url = usuario.get(community).getUrl();
        try {
          if(url != null) {
            accounts = Scrapper.UserAccountsByURL(url);
          } else {
            accounts = Scrapper.UserAccounts(userName,community.getDomainName());
          }
          if(accounts != null) {
            SetAccountsInEntity(entity, userName, accounts);
          }
        } catch (Exception e) {
          System.out.println("Error to get more accounts for entity:"+
            entity.getUniqueIdentificator()+" with comunnity: "+community.getName()
            +(url==null?" and user:"+userName:" and url:"+url));
          e.printStackTrace();
        }
      }
    }   
View Full Code Here

    }   
  }
 
  static private void SetAccountsInEntity(Entity entity, String userName, List<String> accounts) {
    for(String accountName : accounts) {
      Community community = getCommunityByAccountName(accountName);
      if(community == null)
        continue;
      EntityIdentifier id = entity.getIdentificatorInCommunities().get(community);
      if(id == null) {
        System.out.println("New account:"+entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        entity.addIdentificatorInCommunities(community,
          new EntityIdentifier(userName, accountName));
      } else if(id.getUrl() == null) {
        System.out.println("Update account:"+entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        id.setUrl(accountName);
      }
    }
  }
View Full Code Here

   
    GlobalModel.addScale(new NumericScale("stackOverflowScale",30000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("stackOverflowMetric", reputationInQandA,
        GlobalModel.getScales().get("stackOverflowScale")));
    String stackOverflowCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("stackoverflow.com","stackoverflow.com",
        stackOverflowCategories,GlobalModel.getMetrics().get("stackOverflowMetric")));   
   
    GlobalModel.addScale(new NumericScale("serverFaultScale",20000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("serverFaultMetric", reputationInQandA,
        GlobalModel.getScales().get("serverFaultScale")));
    String serverFaultCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("serverfault.com","serverfault.com",
        serverFaultCategories,GlobalModel.getMetrics().get("serverFaultMetric")));
       
    GlobalModel.addScale(new NumericScale("webAppsStackExchangeScale",20000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("webAppsStackExchangeMetric", reputationInQandA,
        GlobalModel.getScales().get("webAppsStackExchangeScale")));
    String webAppsStackExchangeCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("webapps.stackexchange.com","webapps.stackexchange.com",
        webAppsStackExchangeCategories,GlobalModel.getMetrics().get("webAppsStackExchangeMetric")));
       
    GlobalModel.addScale(new NumericScale("questionsSecuritytubeScale",20000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("questionsSecuritytubeMetric", reputationInQandA,
        GlobalModel.getScales().get("questionsSecuritytubeScale")));
    String questionsSecuritytubeCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("questions.securitytube.net","questions.securitytube.net",
        questionsSecuritytubeCategories,GlobalModel.getMetrics().get("questionsSecuritytubeMetric")));
       
    GlobalModel.addScale(new NumericScale("security.StackexchangeScale",2000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("security.StackexchangeMetric", reputationInQandA,
        GlobalModel.getScales().get("security.StackexchangeScale")));
    String securityStackexchangeCategories[] = {qandACategory};
    GlobalModel.addCommunity(new Community("security.stackexchange.com","security.stackexchange.com",
        securityStackexchangeCategories,GlobalModel.getMetrics().get("security.StackexchangeMetric")));
   
    GlobalModel.addScale(new NumericScale("semanticWikiScale",10.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("semanticWikiMetric", reputationInQandA,
        GlobalModel.getScales().get("semanticWikiScale")){
      public Object aggregateValues(Map<CommunityMetricToImport,Object> values) {
        Object total = null;
        int sum = 0;
        for(CommunityMetricToImport comMetToImp: values.keySet()) {
          if(comMetToImp.getCommunity() ==
              GlobalModel.getCommunities().get("ohloh.net")) {
            if(total != null) {
              total = getScale().mulValues(total,values.get(comMetToImp),0.1/0.9);
            } else {
              total = values.get(comMetToImp);
            }
            if(sum == 0) {
              sum = 1;
            }
            //System.out.println("new total in mul:"+total);
          }                   
        }
        for(CommunityMetricToImport comMetToImp: values.keySet()) {
          if(comMetToImp.getCommunity() ==
            GlobalModel.getCommunities().get("ohloh.net")) {
            continue;
          }
          //System.out.println("total:"+total+" next value to sum:"+values.get(comMetToImp));         
          total = getScale().sumValues(total, values.get(comMetToImp));
          sum++;
        }       
        //return doAverage(total,sum);
        return total;
      }
    });   
    String semanticWikiCategories[] = {securityWebAppCategory};
    Community wiki = new Community("semanticWiki","lab.gsi.dit.upm.es/semanticwiki",
        semanticWikiCategories,GlobalModel.getMetrics().get("semanticWikiMetric"));
   
    String ohlohCategories[] = {projectConnCategory};   
    Set<Metric> ohlohMetrics = new HashSet<Metric>();
    GlobalModel.addScale(new NumericScale("ohlohKudoScale",10.0,0.0,1.0));
    Metric ohlohKudoMetric = GlobalModel.addMetric(new Metric("ohlohKudoMetric",
        projectsReputation,GlobalModel.getScales().get("ohlohKudoScale")));
    ohlohMetrics.add(ohlohKudoMetric)
    GlobalModel.addScale(new NumericScale("ohlohRankScale",450000.0,0.0,1.0));
    Metric ohlohRankMetric = GlobalModel.addMetric(new Metric("ohlohRankMetric", rankReputation,
        GlobalModel.getScales().get("ohlohRankScale")));
    ohlohMetrics.add(ohlohRankMetric);   
    GlobalModel.addCommunity(new Community("ohloh.net","ohloh.net",
        ohlohCategories,ohlohMetrics));
   
    GlobalModel.addScale(new NumericScale("slackersScale",10.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("slackersMetric", reputationInQandA,
        GlobalModel.getScales().get("slackersScale")));
    String slackersCategories[] = {GlobalModel.addCategory("QandA")};
    GlobalModel.addCommunity(new Community("sla.ckers.org","sla.ckers.org",
        slackersCategories,GlobalModel.getMetrics().get("slackersMetric")));
   
   
    GlobalModel.addCommunity(wiki);
   
View Full Code Here

        new ArrayList<CommunityMetricToImport>();   
    for(String communityId : GlobalModel.getCommunities().keySet()) {
      if(communityId == community.getName()) {
        continue;
      }
      Community sourceCommunity = GlobalModel.getCommunities().get(communityId);
      for(Metric sourceMetric : sourceCommunity.getMetrics()) {
        communityMetricsToImport.addAll(buildCommunityMetricToImportToAllMetrics(
            sourceCommunity, community, sourceMetric));
      }
    }
    //printMetricsFromCommunity(communityMetricsToImport);
View Full Code Here

    for(Entity entity : GlobalModel.getEntities().values()) {
      Map<Community,EntityIdentifier> usuario = entity.getIdentificatorInCommunities();
      //In this form of iteration, we dont search accounts in the new accounts found or
      //  accounts updated that have already been iterated
      for(Object object : usuario.keySet().toArray()) {
        Community community = (Community) object;
        String userName = usuario.get(community).getName();
        //System.out.println(userName+":"+community);
        String url = usuario.get(community).getUrl();
        try {
          if(url != null) {
            accounts = Scrapper.UserAccountsByURL(url);
          } else {
            accounts = Scrapper.UserAccounts(userName,community.getDomainName());
          }
          if(accounts != null) {
            SetAccountsInEntity(entity, userName, accounts);
          }
        } catch (Exception e) {
          System.out.println("Error to get more accounts for entity:"+
            entity.getUniqueIdentificator()+" with comunnity: "+community.getName()
            +(url==null?" and user:"+userName:" and url:"+url));
          e.printStackTrace();
        }
      }
    }   
View Full Code Here

    }   
  }
 
  static private void SetAccountsInEntity(Entity entity, String userName, List<String> accounts) {
    for(String accountName : accounts) {
      Community community = getCommunityByAccountName(accountName);
      if(community == null)
        continue;
      EntityIdentifier id = entity.getIdentificatorInCommunities().get(community);
      if(id == null) {
        System.out.println("New account:"+entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        entity.addIdentificatorInCommunities(community,
          new EntityIdentifier(userName, accountName));
      } else if(id.getUrl() == null) {
        System.out.println("Update account:"+entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        id.setUrl(accountName);
      }
    }
  }
View Full Code Here

   
    //Set All Model
    ConfigureModel.buildCrossReputationGlobalModel();
   
    //Set the destination community to import the other community reputations
    Community destinationCommunity = GlobalModel.getCommunities().get("semanticWiki");
   
    //Set user accounts from file generated by the mediawiki python bot
    try {
      setUserAccountsFromFile(lastFileName);
    } catch (IOException e) {
      System.out.println("Error: ioexception at reading file:"+lastFileName
          +"\n "+e.getMessage());
    }
    //Add all entities configured to all metrics in the destination community
    for(Entity entity : GlobalModel.getEntities().values()) {
      destinationCommunity.addEntityToAllMetrics(entity);
    }   
   
    //Set that all rest communities and theirs metrics are valid to the importation
    List<CommunityMetricToImport> metricsToImport = ConfigureModel.
      buildMetricsFromAllCommunitiesToAllMetrics(destinationCommunity);
View Full Code Here

TOP

Related Classes of cross.reputation.model.Community

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.