Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.StmtIterator


    }   
    // Specific Attributes and Properties of ReputationModule Class //   
    // obtainsReputationsBy //
    Property obtainsReputationsBy = ResourceFactory.createProperty(
        riNamespace + "obtainsReputationsBy");
    StmtIterator stmtI1 = model.listStatements(resource,
        obtainsReputationsBy, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate obtainsReputationsBy property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONMODULE,
            "obtainsReputationsBy property of resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here


    addResourceInstanceToCache(resource, behaviour);
    // Specific Attributes and Properties of ReputationModule Class //
    // obtainsReputationBy //
    Property obtainsReputationBy = ResourceFactory.createProperty(
        riNamespace + "obtainsReputationBy");
    StmtIterator stmtI1 = model.listStatements(resource,
        obtainsReputationBy, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate obtainsReputationBy property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONMODULE,
            "obtainsReputationBy property of resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

      }
    }
    // reputationModule //
    Property reputationModule = ResourceFactory.createProperty(
        riNamespace + "reputationModule");
    StmtIterator stmtI1 = model.listStatements(resource,
        reputationModule, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate reputationModel property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONMODEL,
            "reputationModule property of resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    addResourceInstanceToCache(resource, behaviour);
    // Specific Attributes and Properties of ReputationModel Class //
    // reputationModule //
    Property reputationModule = ResourceFactory.createProperty(
        riNamespace + "reputationModule");
    StmtIterator stmtI1 = model.listStatements(resource,
        reputationModule, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate reputationModule property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONMODEL,
            "reputationModule property of resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    // Specific Attributes and Properties of CollectingSystem Class //
   
    // uriFormat //
    Property uriFormat = ResourceFactory.createProperty(
        riNamespace + "uriFormat");   
    StmtIterator stmtI1 = model.listStatements(resource,
        uriFormat, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate uriFormat property */
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.COLLECTINGSYSTEM,
            "uriFormat property of CollectingSystem resource:"+
            resource.getURI()+" is not a literal")) {
View Full Code Here

   
    // Specific Attributes and Properties of CollectingAlgorithm Class //
    // uriFormat //
    Property uriFormat = ResourceFactory.createProperty(
        riNamespace + "uriFormat");
    StmtIterator stmtI1 = model.listStatements(resource,
        uriFormat, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate uriFormat property */
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.COLLECTINGSYSTEM,
            "uriFormat property of CollectingSystem resource:"+
            resource.getURI()+" is not a literal")) {
View Full Code Here

      getResourceFromCache(resource, MetricTransformer.class);
    if(metTra != null) {     
      return metTra;
    }
    if(type == null) {
      StmtIterator stmtI1 = model.listStatements(resource, RDF.type, (RDFNode)null);
      Map<Resource,Method> childrenType = new HashMap<Resource,Method>();
      List<Class<? extends MetricTransformer>> subclasses =
        NumericTransformer.listSubclasses();
      while(!subclasses.isEmpty()) {
        Class<?> subclass = subclasses.get(0);
        try {
          Method method = subclass.getMethod("listSubclasses");
          List<Class<? extends MetricTransformer>> subsubclasses =
            (List<Class<? extends MetricTransformer>>) method.invoke(null);
          subclasses.addAll(subsubclasses);
        } catch (Exception e) {         
        }
        childrenType.put(ResourceFactory.createResource(
            riNamespace + subclass.getSimpleName()),
            this.getClass().getMethod("get"+subclass.getSimpleName(),
                Model.class, Resource.class));
        subclasses.remove(0);
      }
      while(stmtI1.hasNext()) {
        Statement typeStatement = stmtI1.nextStatement();
        for(Resource resourceType : childrenType.keySet()) {
          if(typeStatement.getObject().asResource().getURI().equals(
              resourceType.getURI())) {
            return (MetricTransformer) childrenType.get(
                resourceType).invoke(this, model, resource);
View Full Code Here

      Model model, Resource resource) throws Exception {
    Property identifier = ResourceFactory.
        createProperty(riNamespace + "identifier");
    /* identifier */
    String identifierInstance = null;   
    StmtIterator stmtI1 = model.listStatements(resource,
        identifier, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate identifier property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.METRICTRANSFORMER,
            "identifier property of MetricTransformer resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        identifierInstance = statement.getObject().asLiteral().getString();         
      }
    }
    Property sourceMetric = ResourceFactory.
        createProperty(riNamespace + "sourceMetric");
    /* sourceMetric */
    Metric sourceInstance = null;   
    stmtI1 = model.listStatements(resource, sourceMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate sourceMetric property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.METRICTRANSFORMER,
            "sourceMetric property of MetricTransformer resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        sourceInstance = (Metric) getResourceFromCache(
          statement.getObject().asResource(),Metric.class);
        if(sourceInstance == null) {
          sourceInstance = getMetric(model, statement.getObject().asResource());         
        }                       
      }
    }
    Property destinationMetric = ResourceFactory.
        createProperty(riNamespace + "destinationMetric");
    /* destinationMetric */
    Metric destinationInstance = null;
    stmtI1 = model.listStatements(resource,
        destinationMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate destinationMetric property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.METRICTRANSFORMER,
            "destinationMetric property of MetricTransformer resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        destinationInstance = (Metric) getResourceFromCache(
            statement.getObject().asResource(),Metric.class);
        if(destinationInstance == null) {
          destinationInstance = getMetric(model, statement.getObject().asResource());         
        }                           
      }
    }
       
    //TODO: correlationBetweenMetrics
    /*Property correlationBetweenMetrics = ResourceFactory.
    createProperty(riNamespace + "correlationBetweenMetrics");
    Double correlationInstance = null;
    stmtI1 = model.listStatements(resource,
        correlationBetweenMetrics, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate correlationBetweenMetrics property //
      if(!statement.getObject().isLiteral()) {         
        throw new Exception("correlationBetweenMetrics property of resource:"+
            resource.getURI()+" is not a literal");
      } else {
        correlationInstance =
            Double.parseDouble(statement.getObject().toString());         
      }
    }*/
    List<Double> correlationsInstance = new ArrayList<Double>();
    Property correlationBetweenDimensions = ResourceFactory.
        createProperty(riNamespace + "correlationBetweenDimensions");
    stmtI1 = model.listStatements(resource,
        correlationBetweenDimensions, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate correlationBetweenMetrics property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.METRICTRANSFORMER,
            "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");
    // description //
    String descriptionInstance = null;
    stmtI1 = model.listStatements(resource,
        description, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate description property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.METRICTRANSFORMER,
            "dc:description property of MetricTransformer resource:"+
            resource.getURI()+" is not a literal")) {
View Full Code Here

 
  public Double getBaseObject(Model model, Resource resource) throws Exception {
    Property base = ResourceFactory.
        createProperty(riNamespace + "base");
    // base //
    StmtIterator stmtI1 = model.listStatements(resource,
        base, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate base property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.NUMERICTRANSFORMER,
            "base property of NumericTransformer resource:"+
            resource.getURI()+" is not a literal")) {
View Full Code Here

    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")) {
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.StmtIterator

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.