Package cross.reputation.model

Examples of cross.reputation.model.Entity


    }
    Resource repObjResource = reputationObject.getResource();
    if(!repObjResource.hasProperty(RDF.type, JenaVocabulary.reputationObject)) {
      repObjResource.addProperty(RDF.type, JenaVocabulary.reputationObject);
    }
    Entity finalOwner = getFinalOwner(null, null, reputationObject,
          owner, true);
    if(finalOwner != null) {     
      Property property = model.createProperty(reputationParser
           .getRiNamespace(), "owner");
      Statement statement = repObjResource.getProperty(property);
      if(statement == null) {
        repObjResource.addProperty(property, finalOwner.getResource());
      } else {
        statement.changeObject(finalOwner.getResource());
      }
    }
    Property property = model.createProperty(reputationParser
         .getRiNamespace(), "fromCommunity");
    Statement statement = repObjResource.getProperty(property);
View Full Code Here


    }
    Resource repValResource = reputationValue.getResource();
    if(!repValResource.hasProperty(RDF.type, JenaVocabulary.reputationValue)) {
      repValResource.addProperty(RDF.type, JenaVocabulary.reputationValue);
    }
    Entity finalOwner = getFinalOwner(null, reputationValue, repObj,
          owner, true);
    if(finalOwner != null) {     
      Property property = model.createProperty(reputationParser
           .getRiNamespace(), "owner");
      Statement statement = repValResource.getProperty(property);
      if(statement == null) {
        repValResource.addProperty(property, finalOwner.getResource());
      } else {
        statement.changeObject(finalOwner.getResource());
      }
    }
    Property property = model.createProperty(reputationParser
         .getRiNamespace(), "obtainedBy");
    Statement statement = repValResource.getProperty(property);
View Full Code Here

    }
    Resource repEvaResource = reputationEvaluation.getResource();
    if(!repEvaResource.hasProperty(RDF.type, JenaVocabulary.reputationEvaluation)) {
      repEvaResource.addProperty(RDF.type, JenaVocabulary.reputationEvaluation);
    }
    Entity finalOwner = getFinalOwner(reputationEvaluation, repValue, null,
        owner, true);
    if(finalOwner != null) {     
      Property property = model.createProperty(reputationParser
           .getRiNamespace(), "owner");
      Statement statement = repEvaResource.getProperty(property);
      if(statement == null) {
        repEvaResource.addProperty(property, finalOwner.getResource());
      } else {
        statement.changeObject(finalOwner.getResource());
      }
    } 
   
    Property property = model.createProperty(reputationParser
         .getRiNamespace(), "hasMetric");
View Full Code Here

    if(reputationObject.getFromCommunity() == null ||
        reputationObject.getFromCommunity().getResource() == null ||
        reputationObject.getFromCommunity().getName() == null) {
      return null;
    }
    Entity finalOwner = getFinalOwner(null, null, reputationObject,
        owner, true);
    if(finalOwner == null) {
      return null;
    }
    Resource repObjectRes = null;
    if(reputationObject.getResource() != null) {
      repObjectRes = model.createResource(getResourceString(
          reputationObject.getResource().getURI(),base));
    } else if(owner != null) {
      repObjectRes = model.createResource();
    } else {
      repObjectRes = model.createResource(getResourceString(
        base+finalOwner.getUniqueIdentificator()+"-"+
        reputationObject.getFromCommunity().getName(),base));
    }
    repObjectRes.addProperty(RDF.type, JenaVocabulary.reputationObject);
    Property property = model.createProperty(reputationParser
         .getRiNamespace(), "owner");
    repObjectRes.addProperty(property, finalOwner.getResource());
    property = model.createProperty(reputationParser
         .getRiNamespace(), "fromCommunity");
    repObjectRes.addProperty(property, reputationObject.getFromCommunity().getResource());
    if(reputationObject.getHasValue() != null) {
      for(ReputationValue reputationValue :
View Full Code Here

 
  static public Resource addReputationValueToModel(Model model,
      ReputationValue reputationValue,
      ReputationParser reputationParser, String base, Entity owner,
      ReputationObject repObj) {
    Entity finalOwner = getFinalOwner(null, reputationValue, repObj,
        owner, true);
    if(finalOwner == null) {
      return null;
    }
    Resource repValueRes = null;
    if(reputationValue.getResource() != null) {
      repValueRes = model.createResource(getResourceString(
          reputationValue.getResource().getURI(),base));
    } else if(owner != null || repObj != null){
      repValueRes = model.createResource();
    } else {
      if(reputationValue.getObtainedBy().getResource().getURI() != null) {
        repValueRes = model.createResource(getResourceString(
            base+finalOwner.getUniqueIdentificator()
            +"-"+reputationValue.getObtainedBy().getResource(),base));
      } else {
        repValueRes = model.createResource(getResourceString(
          base+finalOwner.getUniqueIdentificator()
          +"-"+reputationValue.getObtainedBy().getName(),base));
      }
    }
    repValueRes.addProperty(RDF.type, JenaVocabulary.reputationValue);
    Property property = model.createProperty(reputationParser
         .getRiNamespace(), "owner");
    repValueRes.addProperty(property, finalOwner.getResource());
    property = model.createProperty(reputationParser
         .getRiNamespace(), "obtainedBy");
    repValueRes.addProperty(property,reputationValue.getObtainedBy().getResource());
    if(reputationValue.getTimeStamp() != null) {
      property = model.createProperty(reputationParser
View Full Code Here

      ReputationParser reputationParser, String base, Entity owner,
      ReputationValue repValue) {
    if(reputationEvaluation.getValue() == null) {
      return null;
    }
    Entity finalOwner = getFinalOwner(reputationEvaluation, repValue,
        null, owner, true);
    if(finalOwner == null) {
      return null;
    }
    Resource repEvaluationRes = null;
    if(reputationEvaluation.getResource() != null) {
      repEvaluationRes = model.createResource(getResourceString(
          reputationEvaluation.getResource().getURI(),base));
    } else if(owner != null || repValue != null) {
      repEvaluationRes = model.createResource();
    } else {
      if(reputationEvaluation.getCollectionIdentifier() != null) {
        repEvaluationRes = model.createResource(getResourceString(
            base+finalOwner.getUniqueIdentificator()+"-"+
            reputationEvaluation.getCollectionIdentifier()+"-"+
            reputationEvaluation.getValue(),base));
      } else {
        repEvaluationRes = model.createResource(getResourceString(
          base+finalOwner.getUniqueIdentificator()+"-"+
          reputationEvaluation.getValue(),base));
      }
    }
    repEvaluationRes.addProperty(RDF.type, JenaVocabulary.reputationEvaluation);
    Property property = model.createProperty(reputationParser
         .getRiNamespace(), "target");
    repEvaluationRes.addProperty(property, finalOwner.getResource());
    property = model.createProperty(reputationParser
         .getRiNamespace(), "hasMetric");
    if(reputationEvaluation.getHasMetric() != null &&
        reputationEvaluation.getHasMetric().getResource() != null) {
      repEvaluationRes.addProperty(property,
View Full Code Here

        contents[1] = line.substring(line.indexOf(":")+1);
        //System.out.println("line:"+contents[1]);
      }
      try {
        Double value = Double.parseDouble(contents[1]);
        userPredefined.add(new Ent_Eva(new Entity(contents[0]),value));
        continue;
      } catch (Exception e) {}
      Entity entity = new Entity(contents[0]);
      contents = contents[1].split(",");
      for(int i = 0; i < contents.length; i++) {
        int coincidence = contents[i].indexOf("^#^");
        if(coincidence == -1) {
          String domain = findDomain(contents[i]);
          if(domain == null) {
            System.out.println("Error: domain is not known from user:"+
            entity.getUniqueIdentificator()+" and it is discarted: "+contents[i]);
            continue;
          }
          entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
              new EntityIdentifier(entity.getUniqueIdentificator(),contents[i]));
        } else {
          String userName = contents[i].substring(0,coincidence);
          //System.out.println("iu:"+entity.getUniqueIdentificator()+",u:"+userName);
          String domain = findDomain(contents[i].substring(coincidence+3));
          //System.out.println("d:"+domain);         
          if(domain == null) {
            System.out.println("Error: domain is not known from user:"+
                entity.getUniqueIdentificator()+"-nickname:"+userName+
                " and it is discarted: "+contents[i].substring(coincidence+3));
            continue;
          }
          entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
              new EntityIdentifier(userName,null));
        }         
      }
      if(!entity.getIdentificatorInCommunities().isEmpty()) {
        GlobalModel.addEntity(entity);
      }
    }
    reader.close();
    ConfigureModel.GetMoreAccounts();
View Full Code Here

        contents[1] = line.substring(line.indexOf(":")+1);
        //System.out.println("line:"+contents[1]);
      }
      try {
        Double value = Double.parseDouble(contents[1]);
        userPredefined.add(new Ent_Eva(new Entity(contents[0]),value));
        continue;
      } catch (Exception e) {}
      Entity entity = new Entity(contents[0]);
      contents = contents[1].split(",");
      for(int i = 0; i < contents.length; i++) {
        int coincidence = contents[i].indexOf("^#^");
        if(coincidence == -1) {
          String domain = findDomain(contents[i]);
          if(domain == null) {
            System.out.println("Error: domain is not known from user:"+
            entity.getUniqueIdentificator()+" and it is discarted: "+contents[i]);
            continue;
          }
          entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
              new EntityIdentifier(entity.getUniqueIdentificator(),contents[i]));
        } else {
          String userName = contents[i].substring(0,coincidence);
          //System.out.println("iu:"+entity.getUniqueIdentificator()+",u:"+userName);
          String domain = findDomain(contents[i].substring(coincidence+3));
          //System.out.println("d:"+domain);         
          if(domain == null) {
            System.out.println("Error: domain is not known from user:"+
                entity.getUniqueIdentificator()+"-nickname:"+userName+
                " and it is discarted: "+contents[i].substring(coincidence+3));
            continue;
          }
          entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
              new EntityIdentifier(userName,null));
        }         
      }
      if(!entity.getIdentificatorInCommunities().isEmpty()) {
        GlobalModel.addEntity(entity);
      }
    }
    reader.close();
    ConfigureModel.GetMoreAccounts();
View Full Code Here

        System.out.println("  Entity:"+entity);
    }
  }
 
  static public Collection<Entity> SetWikiUserEntitiesAndAccounts() {
    Entity administrator = GlobalModel.addEntity(new Entity("Administrator"));
    administrator.addIdentificatorInCommunities(GlobalModel.getCommunities().get("serverfault.com"),
        new EntityIdentifier("Ben Torell",null));
    Entity pblanco = GlobalModel.addEntity(new Entity("PBlanco"));
    pblanco.addIdentificatorInCommunities(GlobalModel.getCommunities().get("serverfault.com"),
        new EntityIdentifier("wayne koorts",null));
    pblanco.addIdentificatorInCommunities(GlobalModel.getCommunities().get("security.stackexchange.com"),
        new EntityIdentifier("kk-sjp-kk","http://security.stackexchange.com/users/1337/sjp"));
    pblanco.addIdentificatorInCommunities(GlobalModel.getCommunities().get("ohloh.net"),
        new EntityIdentifier("Arjan van de Ven",null));
    Entity jAMaldonado = GlobalModel.addEntity(new Entity("Jamaldonado"));
    jAMaldonado.addIdentificatorInCommunities(GlobalModel.getCommunities().get("questions.securitytube.net"),
        new EntityIdentifier("Andre G",null));
    jAMaldonado.addIdentificatorInCommunities(GlobalModel.getCommunities().get("security.stackexchange.com"),
        new EntityIdentifier("Karrax",null));
    jAMaldonado.addIdentificatorInCommunities(GlobalModel.getCommunities().get("stackoverflow.com"),
        new EntityIdentifier("Karrax",null));
    Entity dPozog = GlobalModel.addEntity(new Entity("DPozog"));
    dPozog.addIdentificatorInCommunities(GlobalModel.getCommunities().get("stackoverflow.com"),
        new EntityIdentifier("347915/Jose",null));
    dPozog.addIdentificatorInCommunities(GlobalModel.getCommunities().get("security.stackexchange.com"),
        new EntityIdentifier("sdanelson",null));
    Entity ebarear = GlobalModel.addEntity(new Entity("Ebarear"));
    ebarear.addIdentificatorInCommunities(GlobalModel.getCommunities().get("stackoverflow.com"),
        new EntityIdentifier("Jon Skeet",null));
    Entity edukun = GlobalModel.addEntity(new Entity("Edukun"));
    edukun.addIdentificatorInCommunities(GlobalModel.getCommunities().get("ohloh.net"),
        new EntityIdentifier("Gavin Sharp",null));
    edukun.addIdentificatorInCommunities(GlobalModel.getCommunities().get("security.stackexchange.com"),
        new EntityIdentifier("Sairam Kunala",null));
    Entity racker = GlobalModel.addEntity(new Entity("Racker"));
    racker.addIdentificatorInCommunities(GlobalModel.getCommunities().get("ohloh.net"),
        new EntityIdentifier("janosch","http://www.ohloh.net/p/linux-omap/contributors/34615288934090"));
    //racker.addIdentificatorInCommunities(GlobalModel.getCommunities().get("sla.ckers.org"),
    //    new EntityIdentifier("rsnake",null));
    GetMoreAccounts();
    return GlobalModel.getEntities().values();
View Full Code Here

    Entity edukun = GlobalModel.addEntity(new Entity("Edukun"));
    edukun.addIdentificatorInCommunities(GlobalModel.getCommunities().get("ohloh.net"),
        new EntityIdentifier("Gavin Sharp",null));
    edukun.addIdentificatorInCommunities(GlobalModel.getCommunities().get("security.stackexchange.com"),
        new EntityIdentifier("Sairam Kunala",null));*/
    Entity racker = GlobalModel.addEntity(new Entity("Racker"));
    //racker.addIdentificatorInCommunities(GlobalModel.getCommunities().get("ohloh.net"),
    //    new EntityIdentifier("janosch","http://www.ohloh.net/p/linux-omap/contributors/34615288934090"));
    racker.addIdentificatorInCommunities(GlobalModel.getCommunities().get("sla.ckers.org"),
        new EntityIdentifier("rsnake",null));
    GetMoreAccounts();
    return GlobalModel.getEntities().values();
  }
View Full Code Here

TOP

Related Classes of cross.reputation.model.Entity

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.