Examples of FixedCommunitiesTrust


Examples of cross.reputation.model.FixedCommunitiesTrust

        if (iters.hasNext()) {
            System.out.println("The database contains subjects of type FixedCommunitiesTrust:");
            while (iters.hasNext()) {
                Resource resource = iters.nextResource();
                System.out.println("  " + resource.getLocalName());
                FixedCommunitiesTrust fixComInstance = getFixedCommunitiesTrust(model,resource);
                System.out.println("     communityScorer:" +
                    fixComInstance.getCommunityScorer().getName());
                System.out.println("     communityScored:" +
                    fixComInstance.getCommunityScorer().getName());
                System.out.println("     value:" +
                    fixComInstance.getValue());
            }
        } else {
            System.out.println("No simple String riNamespace+Dimension were found in the database");
        }
  }
View Full Code Here

Examples of cross.reputation.model.FixedCommunitiesTrust

        }
  }
 
  public FixedCommunitiesTrust getFixedCommunitiesTrust(
      Model model, Resource resource) throws Exception {
    FixedCommunitiesTrust fixCom = (FixedCommunitiesTrust)
      getResourceFromCache(resource, FixedCommunitiesTrust.class);
    if(fixCom != null) {     
      return fixCom;
    }
    fixCom = (FixedCommunitiesTrust) getTrustBetweenCommunities(
        model, resource, FixedCommunitiesTrust.class);
    Property communityScorer = ResourceFactory.
        createProperty(riNamespace + "communityScorer");   
    // communityScorer //
        StmtIterator stmtI1 = model.listStatements(resource,
            communityScorer, (RDFNode)null);
    while(stmtI1.hasNext()) {
        Statement statement = stmtI1.nextStatement();
        // validate originatingCategory property //
        if(!statement.getObject().isResource()) {         
          if(!ModelException.throwException(ModelException.FIXEDCOMMUNITYTRUST,
            "communityScorer property of FixedCommunityTrust resource:"+
              resource.getURI()+" is not a resource")) {
            return null;
          }
        } else {
          Community community = (Community) getResourceFromCache(
              statement.getObject().asResource(), Community.class);
        if(community == null) {     
          //Community community = getCommunity(
          //    model, statement.getObject().asResource());
            community = getLimitedCommunity(
                model, statement.getObject().asResource());
        }
        fixCom.setCommunityScorer(community);         
        }
      }
    Property communityScored = ResourceFactory.
        createProperty(riNamespace + "communityScored");   
    // communityScored //
    stmtI1 = model.listStatements(resource,
        communityScored, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate communityScored property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.FIXEDCOMMUNITYTRUST,
            "communityScored property of FixedCommunityTrust resource:"+
            resource.getURI()+" is not a resource")) {
            return null;
          }
      } else {
        Community community = (Community) getResourceFromCache(
            statement.getObject().asResource(), Community.class);
        if(community == null) {     
          //Community community = getCommunity(
          //    model, statement.getObject().asResource());
            community = getLimitedCommunity(
                model, statement.getObject().asResource());
        }
        fixCom.setCommunityScored(community);         
      }
    }   
    return fixCom;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.