Package cross.reputation.model

Examples of cross.reputation.model.CategoryMatching


        if (iters.hasNext()) {
            System.out.println("The database contains subjects of type categoryMatching:");
            while (iters.hasNext()) {
                Resource resource = iters.nextResource();
                System.out.println("  " + resource.getLocalName());
                CategoryMatching catMatInstance = getCategoryMatching(model,resource);
                System.out.println(catMatInstance.toString("     "));
            }
        } else {
            System.out.println("No simple String riNamespace+Dimension were found" +
                " in the database");
        }
View Full Code Here


        }
  }
 
  public CategoryMatching getCategoryMatching(Model model,
      Resource resource) throws Exception {
    CategoryMatching catMat = (CategoryMatching)
      getResourceFromCache(resource, CategoryMatching.class);
    if(catMat != null) {     
      return catMat;
    }
    catMat = (CategoryMatching) getTrustBetweenCommunities(
        model, resource, CategoryMatching.class);;
    // originatingCategory //
    Property originatingCategory = ResourceFactory.
        createProperty(riNamespace + "originatingCategory");   
    StmtIterator stmtI1 = model.listStatements(resource,
            originatingCategory, (RDFNode)null);
    while(stmtI1.hasNext()) {
        Statement statement = stmtI1.nextStatement();
        /* validate originatingCategory property */
        if(!statement.getObject().isResource()) {         
          if(!ModelException.throwException(ModelException.CATEGORYMATCHING,
            "originatingCategory property of CategoryMatching resource:"+
              resource.getURI()+" is not a resource")) {
            return null;
          }
        } else {
          Category category = (Category) getResourceFromCache(
              statement.getObject().asResource(), Category.class);
        if(category == null) {     
          category = getCategory(model, statement.getObject().asResource());
        }
          catMat.setOriginatingCategory(category);         
        }
      }
    Property receivingCategory = ResourceFactory.
        createProperty(riNamespace + "receivingCategory");   
    /* receivingCategory */
    stmtI1 = model.listStatements(resource,
        receivingCategory, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate receivingCategory property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.CATEGORYMATCHING,
            "receivingCategory property of CategoryMatching resource:"+
            resource.getURI()+" is not a resource")) {
            return null;
          }
      } else {
        Category category = (Category) getResourceFromCache(
            statement.getObject().asResource(), Category.class);
        if(category == null) {     
          category = getCategory(model, statement.getObject().asResource());
        }
          catMat.setReceivingCategory(category);         
      }
    }   
    return catMat;
  }
View Full Code Here

TOP

Related Classes of cross.reputation.model.CategoryMatching

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.