Package cross.reputation.model

Examples of cross.reputation.model.ReputationObject


            "hasReputation property of Entity resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationObject repObj = (ReputationObject) getResourceFromCache(
            statement.getObject().asResource(), ReputationObject.class);
        if(repObj == null) {
          repObj = getReputationObject(model,
              statement.getObject().asResource());         
        }
View Full Code Here


    return entity;
  }
 
  public ReputationObject getReputationObject(Model model,
      Resource resource) throws Exception {
    ReputationObject repObj = (ReputationObject) getResourceFromCache(
        resource, ReputationObject.class);
    if(repObj == null) {
      repObj = new ReputationObject();
      repObj.setResource(resource);
      addResourceInstanceToCache(resource,repObj);
    } else {
      return repObj;
    }
    // Specific Attributes and Properties of ReputationEvaluation Class //
    // fromCommunity //
    Property fromCommunity = ResourceFactory.createProperty(
        riNamespace + "fromCommunity");   
    StmtIterator stmtI1 = model.listStatements(resource,
        fromCommunity, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate fromCommunity property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONOBJECT,
            "fromCommunity property of ReputationObject resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Community community = (Community) getResourceFromCache(
            statement.getObject().asResource(), Community.class);
        if(community == null) {
          community = getCommunity(model,
              statement.getObject().asResource());         
        }
        repObj.setFromCommunity(community);
      }
    }
    // hasValue //
    Property hasValue = ResourceFactory.createProperty(
        riNamespace + "hasValue");   
    stmtI1 = model.listStatements(resource,
        hasValue, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasValue property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONOBJECT,
            "hasValue property of ReputationObject resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationValue repVal = (ReputationValue) getResourceFromCache(
            statement.getObject().asResource(), ReputationValue.class);
        if(repVal == null) {
          repVal = getReputationValue(model,
              statement.getObject().asResource());         
        }
        repObj.addHasValue(repVal);
      }
    }
    // owner //
    Property owner = ResourceFactory.createProperty(
        riNamespace + "owner");   
    stmtI1 = model.listStatements(resource,
        owner, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate owner property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONOBJECT,
            "owner property of ReputationObject resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Entity entity = (Entity) getResourceFromCache(
            statement.getObject().asResource(), Entity.class);
        if(entity == null) {
          entity = getEntity(model,statement.getObject().asResource(),null);         
        }
        repObj.setOwner(entity);
      }
    }
    return repObj;
  }
View Full Code Here

    //Process collectingSystem with process of subgroups??   
  }
 
  static public ReputationObject getReputationObjectWithValues (
      Entity entity, Community community, List<ReputationValue> reputationValues) {
    ReputationObject repObj = new ReputationObject();
    repObj.setOwner(entity);
    repObj.setFromCommunity(community);
    for(ReputationValue repVal : reputationValues) {
      repObj.addHasValue(repVal);
    }
    return repObj;
  }
View Full Code Here

TOP

Related Classes of cross.reputation.model.ReputationObject

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.