Package cross.reputation.model

Examples of cross.reputation.model.Scale


            "hasScale property of Metric resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Scale scale = (Scale) getResourceFromCache(
            statement.getObject().asResource(),Scale.class);
        if(scale == null) {
          scale = getScale(model,statement.getObject().asResource(),null);         
        }
        metric.setScale(scale);
View Full Code Here


          createResource(riNamespace + "CategoricScale");
      while(stmtI1.hasNext()) {
        Statement typeStatement = stmtI1.nextStatement();
        if(typeStatement.getObject().asResource().getURI().equals(
            numericScale.getURI())) {
          Scale scale = getNumericScale(model, resource);
          return scale;
        } else if (typeStatement.getObject().asResource().getURI().equals(
            categoricScale.getURI())) {
          Scale scale = getCategoricScale(model, resource);
          return scale;
        }       
      }
      if(type == null) {
        if(!ModelException.throwException(ModelException.SCALE,
            "Impossible to instanciate a generic Scale(resource:"+resource+"" +
            "Please, see the model and assign a specific type.")) {
          return null;
        }
      }
    }   
    Scale scale = (Scale) getResourceFromCache(resource, type);
    if(scale != null) {     
      return scale;
    }   
    scale = type.newInstance();
    scale.setResource(resource);
    addResourceInstanceToCache(resource, scale);   
    // name //
    Property name = ResourceFactory.createProperty(riNamespace + "name");
    StmtIterator stmtI1 = model.listStatements(resource,
        name, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate name property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.SCALE,
            "name property of scale resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        scale.setName(statement.getObject().asLiteral().getString());
      }
    }
    return scale;
  }
View Full Code Here

        System.out.println("The database contains subjects" +
            " of type scale:");
        while (iters.hasNext()) {
            Resource resource = iters.nextResource();
            System.out.println("  " + resource.getLocalName());
            Scale scaleInstance =
              getScale(model,resource,null);
            System.out.println("     name:" +
                scaleInstance.getName());                     
        }
    } else {
        System.out.println("No simple String riNamespace+" +
            "Scale were found in the database");
    }
View Full Code Here

TOP

Related Classes of cross.reputation.model.Scale

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.