Package cross.reputation.model

Examples of cross.reputation.model.NumericScale


    String qandACategory = GlobalModel.addCategory("QandA");
    String securityWebAppCategory = GlobalModel.addCategory("SecurityWebApp");
    String projectConnCategory = GlobalModel.addCategory("ProjectConnection");
   
   
    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")));
View Full Code Here


    String qandACategory = GlobalModel.addCategory("QandA");
    String securityWebAppCategory = GlobalModel.addCategory("SecurityWebApp");
    String projectConnCategory = GlobalModel.addCategory("ProjectConnection");
   
   
    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")));
View Full Code Here

    return categoricScale;
  }
 
  public NumericScale getNumericScale(Model model,
      Resource resource) throws Exception {
    NumericScale numericScale = (NumericScale) getResourceFromCache(
        resource, NumericScale.class);
    if(numericScale != null) {     
      return numericScale;
    }
    numericScale = (NumericScale) getScale(model, resource, NumericScale.class);
    // minimum //
    Property minimum = ResourceFactory.createProperty(
        riNamespace + "minimum");
    StmtIterator stmtI1 = model.listStatements(resource,
        minimum, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate minimum property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.NUMERIC_SCALE,
            "minimum property of NumericScale resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        numericScale.setMinimum(statement.getObject().asLiteral().getDouble());
      }
    }
    Property maximum = ResourceFactory.createProperty(
        riNamespace + "maximum");
    // maximum //
    stmtI1 = model.listStatements(resource,
        maximum, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate maximum property */
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.NUMERIC_SCALE,
            "maximum property of NumericScale resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        numericScale.setMaximum(statement.getObject().asLiteral().getDouble());
      }
    }
    Property step = ResourceFactory.createProperty(
        riNamespace + "step");
    // step //
    stmtI1 = model.listStatements(resource,
        step, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate step property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.NUMERIC_SCALE,
            "step property of NumericScale resource:"+
            resource.getURI()+" is not a literal")){
          return null;
        }
      } else {
        numericScale.setStep(statement.getObject().asLiteral().getDouble());
      }
    }
    return numericScale;
  }
View Full Code Here

        System.out.println("The database contains subjects" +
            " of type NumericScale:");
        while (iters.hasNext()) {
            Resource resource = iters.nextResource();
            System.out.println("  " + resource.getLocalName());
            NumericScale numScaInstance =
              getNumericScale(model,resource);
            System.out.println("     name:" +
                numScaInstance.getName());
            System.out.println("     maximum:" +
                numScaInstance.getMaximum());
            System.out.println("     minimum:" +
                numScaInstance.getMinimum());
            System.out.println("     step:" +
                numScaInstance.getStep());
        }
    } else {
        System.out.println("No simple String riNamespace+" +
            "scale were found in the database");
    }
View Full Code Here

    Category qandACategory = GlobalModel.addCategory("QandA");
    Category securityWebAppCategory = GlobalModel.addCategory("SecurityWebApp");
    Category projectConnCategory = GlobalModel.addCategory("ProjectConnection");
   
   
    GlobalModel.addScale(new NumericScale("stackOverflowScale",200000.0,0.0,1.0));
    GlobalModel.addMetric(new Metric("stackOverflowMetric", reputationInQandA,
        GlobalModel.getScales().get("stackOverflowScale")));
    Category 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")));
    Category 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")));
    Category 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")));
    Category 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")));
    Category 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;
      }
    });   
    Category semanticWikiCategories[] = {securityWebAppCategory};
    Community wiki = new Community("semanticWiki","lab.gsi.dit.upm.es/semanticwiki",
        semanticWikiCategories,GlobalModel.getMetrics().get("semanticWikiMetric"));
   
    Category 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")));
    Category slackersCategories[] = {GlobalModel.addCategory("QandA")};
    GlobalModel.addCommunity(new Community("sla.ckers.org","sla.ckers.org",
        slackersCategories,GlobalModel.getMetrics().get("slackersMetric")));
View Full Code Here

TOP

Related Classes of cross.reputation.model.NumericScale

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.