Package cross.reputation.model

Examples of cross.reputation.model.DimensionCorrelation


            "correlationBetweenDimensions property of MetricTransformer resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        DimensionCorrelation correlationInstance = getDimensionCorrelation(
            model,statement.getObject().asResource());
        //TODO: validate dimensions are the same of source and destination metrics
        correlationsInstance.add(correlationInstance.getCorrelationValue());
      }
    }
    Property correlationBetweenScales = ResourceFactory.
    createProperty(riNamespace + "correlationBetweenScales");
    stmtI1 = model.listStatements(resource,
        correlationBetweenScales, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate correlationBetweenMetrics property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.METRICTRANSFORMER,
            "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 DimensionCorrelation getDimensionCorrelation(
      Model model, Resource resource) throws Exception {
    DimensionCorrelation dimCor = (DimensionCorrelation)
      getResourceFromCache(resource, DimensionCorrelation.class);
    if(dimCor != null) {     
      return dimCor;
    }   
    dimCor = new DimensionCorrelation();
    dimCor.setResource(resource);
    addResourceInstanceToCache(resource, dimCor);
    Property sourceDimension = ResourceFactory.
        createProperty(riNamespace + "sourceDimension");   
    // sourceDimension //
        StmtIterator stmtI1 = model.listStatements(resource,
            sourceDimension, (RDFNode)null);
    while(stmtI1.hasNext()) {
        Statement statement = stmtI1.nextStatement();
        // validate sourceDimension property //
        if(!statement.getObject().isResource()) {         
          if(!ModelException.throwException(ModelException.DIMENSIONCORRELATION,
            "sourceDimension property of DimensionCorrelation resource:"+
              resource.getURI()+" is not a resource")) {
            return null;
          }
        } else {
          Dimension dimension = (Dimension) getResourceFromCache(
              statement.getObject().asResource(), Dimension.class);
        if(dimension == null) {     
          dimension = getDimension(model, statement.getObject().asResource());
        }
          dimCor.setSourceDimension(dimension);         
        }
      }
    Property targetDimension = ResourceFactory.
        createProperty(riNamespace + "targetDimension");
    // targetDimension //
        stmtI1 = model.listStatements(resource,
            targetDimension, (RDFNode)null);
    while(stmtI1.hasNext()) {
        Statement statement = stmtI1.nextStatement();
        // validate targetDimension property //
        if(!statement.getObject().isResource()) {         
          if(!ModelException.throwException(ModelException.DIMENSIONCORRELATION,
            "targetDimension property of DimensionCorrelation resource:"+
              resource.getURI()+" is not a resource")) {
            return null;
          }
        } else {
          Dimension dimension = (Dimension) getResourceFromCache(
              statement.getObject().asResource(), Dimension.class);
        if(dimension == null) {     
          dimension = getDimension(model, statement.getObject().asResource());
        }
          dimCor.setTargetDimension(dimension);         
        }
      }
    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.DIMENSIONCORRELATION,
            "correlationValue property of DimensionCorrelation resource:"+
            resource.getURI()+" is not a literal")) {
            return null;
          }
      } else {
        dimCor.setCorrelationValue(
            statement.getObject().asLiteral().getDouble());         
      }
    }   
    return dimCor;
 
View Full Code Here

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

TOP

Related Classes of cross.reputation.model.DimensionCorrelation

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.