Examples of TrustBetweenCommunities


Examples of cross.reputation.model.TrustBetweenCommunities

            "trust property of importationUnit ImportationUnit resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        TrustBetweenCommunities truBet = (TrustBetweenCommunities)
          getResourceFromCache(statement.getObject().asResource(),
              TrustBetweenCommunities.class);
        if(truBet == null) {
          truBet = getTrustBetweenCommunities(model,
              statement.getObject().asResource(),null);         
View Full Code Here

Examples of cross.reputation.model.TrustBetweenCommunities

  }
 
  public TrustBetweenCommunities getTrustBetweenCommunities(
      Model model, Resource resource,
      Class<? extends TrustBetweenCommunities> type) throws Exception {
    TrustBetweenCommunities truBet = (TrustBetweenCommunities)
      getResourceFromCache(resource, type);
    if(truBet != null) {     
      return truBet;
    }
    if(type != null) {
      truBet = type.newInstance();
      truBet.setResource(resource);
      addResourceInstanceToCache(resource, truBet);
    } else {
      StmtIterator stmtI1 = model.listStatements(resource, RDF.type, (RDFNode)null);
      Resource fixedCommunitiesTrust = ResourceFactory.
          createResource(riNamespace + "FixedCommunitiesTrust");
      Resource categoryMatching = ResourceFactory.
          createResource(riNamespace + "CategoryMatching");
      while(stmtI1.hasNext()) {
        Statement typeStatement = stmtI1.nextStatement();
        if(typeStatement.getObject().asResource().getURI().equals(
            fixedCommunitiesTrust.getURI())) {
          return getFixedCommunitiesTrust(model, resource);
        } else if (typeStatement.getObject().asResource().getURI().equals(
            categoryMatching.getURI())) {
          return getCategoryMatching(model, resource);
        }     
      }
      if(truBet == null) {
        truBet = new TrustBetweenCommunities();
        truBet.setResource(resource);
        addResourceInstanceToCache(resource, truBet);
      }
    }
    Property trustProvidedBy = ResourceFactory.
        createProperty(riNamespace + "trustProvidedBy");   
    // trustProvidedBy //
    StmtIterator stmtI1 = model.listStatements(resource,
        trustProvidedBy, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate trustProvidedBy property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.TRUSTBETWEENCOMMUNITIES,
            "trustProvidedBy property of TrustBetweenCommunities resource:"+
            resource.getURI()+" is not a resource")) {
            return null;
          }
      } else {
        TrustBetweenCommunities truBetInside = (TrustBetweenCommunities)
            getResourceFromCache(statement.getObject().asResource(),
                TrustBetweenCommunities.class);
        if(truBetInside == null) {     
          truBetInside = getTrustBetweenCommunities(
              model, statement.getObject().asResource(), null);
View Full Code Here

Examples of cross.reputation.model.TrustBetweenCommunities

    if (iters.hasNext()) {
        System.out.println("The database contains subjects of type TrustBetweenCommunities:");
        while (iters.hasNext()) {
                Resource resource = iters.nextResource();
                System.out.println("  " + resource.getLocalName());
                TrustBetweenCommunities truBetInstance = null;
               
                /* boolean isASubclass = false;
                Resource fixedCommunitiesTrust = ResourceFactory.
            createResource(riNamespace + "FixedCommunitiesTrust");
        Resource categoryMatching = ResourceFactory.
            createResource(riNamespace + "CategoryMatching");
                StmtIterator stmtI1 = model.listStatements(resource, RDF.type, (RDFNode)null);
        while(stmtI1.hasNext()) {
          Statement statementType = stmtI1.nextStatement();
          if(statementType.getObject().asResource().getURI().equals(
              fixedCommunitiesTrust.getURI())) {
            truBetInstance = getFixedCommunitiesTrust(model,resource);
            isASubclass = true;
            break;
          } else if (statementType.getObject().asResource().getURI().equals(
              categoryMatching.getURI())) {
            truBetInstance = getFixedCommunitiesTrust(model,resource);
            isASubclass = true;
            break;           
          }         
        }
        if(!isASubclass) {
          truBetInstance = getTrustBetweenCommunities(model,resource);
        }*/
               
                truBetInstance = getTrustBetweenCommunities(model,resource, null);
        if(truBetInstance != null) {         
              System.out.println("     class:" +
                  truBetInstance.getClass());
              System.out.println(truBetInstance.toString("     "));             
        }
        }       
    } else {
        System.out.println("No simple String riNamespace+Dimension were found in the database");
    }
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.