Package cross.reputation.model

Examples of cross.reputation.model.ScaleCorrelation


            "correlationBetweenScales property of MetricTransformer resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ScaleCorrelation correlationInstance = getScaleCorrelation(
            model,statement.getObject().asResource());
        //TODO: validate scales are the same of source and destination metrics
        correlationsInstance.add(correlationInstance.getCorrelationValue());                 
      }
    }   
   
    Property description = ResourceFactory.
        createProperty(dcNamespace + "description");
View Full Code Here


    }
  }
 
  public ScaleCorrelation getScaleCorrelation(
      Model model, Resource resource) throws Exception {
    ScaleCorrelation scaCor = (ScaleCorrelation)
      getResourceFromCache(resource, ScaleCorrelation.class);
    if(scaCor != null) {     
      return scaCor;
    }   
    scaCor = new ScaleCorrelation();
    scaCor.setResource(resource);
    addResourceInstanceToCache(resource, scaCor);
    Property sourceScale = ResourceFactory.
        createProperty(riNamespace + "sourceScale");   
    // sourceScale //
        StmtIterator stmtI1 = model.listStatements(resource,
            sourceScale, (RDFNode)null);
    while(stmtI1.hasNext()) {
        Statement statement = stmtI1.nextStatement();
        // validate sourceScale property //
        if(!statement.getObject().isResource()) {         
          if(!ModelException.throwException(ModelException.SCALECORRELATION,
            "sourceScale property of ScaleCorrelation resource:"+
              resource.getURI()+" is not a resource")) {
            return null;
          }
        } else {
          scaCor.setSourceScale(getScale(
            model, statement.getObject().asResource(),null));         
        }
      }
    Property targetScale = ResourceFactory.
        createProperty(riNamespace + "targetScale");
    // targetScale //
        stmtI1 = model.listStatements(resource,
            targetScale, (RDFNode)null);
    while(stmtI1.hasNext()) {
        Statement statement = stmtI1.nextStatement();
        // validate targetScale property //
        if(!statement.getObject().isResource()) {         
          if(!ModelException.throwException(ModelException.SCALECORRELATION,
            "targetScale property of ScaleCorrelation resource:"+
              resource.getURI()+" is not a resource")) {
            return null;
          }
        } else {
          scaCor.setTargetScale(getScale(
            model, statement.getObject().asResource(),null));         
        }
      }
    Property correlationValue = ResourceFactory.
        createProperty(riNamespace + "correlationValue");   
    // correlationValue //
    stmtI1 = model.listStatements(resource,
        correlationValue, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate correlationValue property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.SCALECORRELATION,
            "correlationValue property of ScaleCorrelation resource:"+
            resource.getURI()+" is not a literal")) {
            return null;
          }
      } else {
        scaCor.setCorrelationValue(
            statement.getObject().asLiteral().getDouble());         
      }
    }   
    return scaCor;
  }
View Full Code Here

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

TOP

Related Classes of cross.reputation.model.ScaleCorrelation

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.