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

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


    Entity entity = getEntity(model, resource, Entity.class);
    // Specific Attributes and Properties of Foaf:Agent Class //
    // name //
    Property name = ResourceFactory.createProperty(
        foafNamespace + "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.FOAFAGENT,
            "name property of resource foaf:Agent:"+
            resource.getURI()+" is not a literal")) {
View Full Code Here


    Entity entity = (Entity) getResourceFromCache(resource, Entity.class);
    if(entity != null) {
      return entity;
    }
    if(clazz == null) {
      StmtIterator stmtI1 = model.listStatements(resource, RDF.type, (RDFNode)null);           
      while(stmtI1.hasNext()) {
        Statement typeStatement = stmtI1.nextStatement();
        for(Resource resourceType : foafAgentClasses) {
          if(typeStatement.getObject().asResource().getURI().equals(
              resourceType.getURI())) {
            return getFoafAgent(model, resource);
          }
        }               
      }
      //The default option:Entity class
      entity = new Entity();
      entity.setResource(resource);
      addResourceInstanceToCache(resource,entity);
    } else {   
      entity = (Entity) clazz.newInstance(); //new Entity();
      entity.setResource(resource);
      addResourceInstanceToCache(resource,entity);
    }   
   
    // Specific Attributes and Properties of Entity Class //
    // identifier //
    Property identifier = ResourceFactory.createProperty(
        riNamespace + "identifier");
    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.ENTITY,
            "identifier property of Entity resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        entity.setUniqueIdentificator(statement.getObject(
            ).asLiteral().getString());
      }
    }
    // hasReputation //
    Property hasReputation = ResourceFactory.createProperty(
        riNamespace + "hasMetric");   
    stmtI1 = model.listStatements(resource,
        hasReputation, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasReputation property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.ENTITY,
            "hasReputation property of Entity resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationObject repObj = (ReputationObject) getResourceFromCache(
            statement.getObject().asResource(), ReputationObject.class);
        if(repObj == null) {
          repObj = getReputationObject(model,
              statement.getObject().asResource());         
        }
        entity.addHasReputation(repObj);
      }
    }
    // hasValue //
    Property hasValue = ResourceFactory.createProperty(
        riNamespace + "hasValue");   
    stmtI1 = model.listStatements(resource,
        hasValue, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasValue property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.ENTITY,
            "hasValue property of Entity resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationValue repVal = (ReputationValue) getResourceFromCache(
            statement.getObject().asResource(), ReputationValue.class);
        if(repVal == null) {
          repVal = getReputationValue(model,
              statement.getObject().asResource());         
        }
        entity.addHasValue(repVal);
      }
    }
    // hasEvaluation //
    Property hasEvaluation = ResourceFactory.createProperty(
        riNamespace + "hasEvaluation");   
    stmtI1 = model.listStatements(resource,
        hasEvaluation, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasEvaluation property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.ENTITY,
            "hasEvaluation property of Entity resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationEvaluation repEva = (ReputationEvaluation) getResourceFromCache(
            statement.getObject().asResource(), ReputationEvaluation.class);
        if(repEva == null) {
          repEva = getReputationEvaluation(model,
              statement.getObject().asResource());         
        }
        entity.addHasEvaluation(repEva);
      }
    }
    // foafAccount //
    Property foafAccount = ResourceFactory.createProperty(
        foafNamespace + "account");   
    stmtI1 = model.listStatements(resource,
        foafAccount, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate foafAccount property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.ENTITY,
            "foafAccount property of Entity resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        entity.addOnlineAccount(getFoafOnlineAccount(model,
            statement.getObject().asResource()));
      }
    }
    // foafHoldsAccount //
    Property foafHoldsAccount = ResourceFactory.createProperty(
        foafNamespace + "holdsAccount");   
    stmtI1 = model.listStatements(resource,
        foafHoldsAccount, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate foafHoldsAccount property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.ENTITY,
            "foafHoldsAccount property of Entity resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    }
    // Specific Attributes and Properties of ReputationEvaluation Class //
    // fromCommunity //
    Property fromCommunity = ResourceFactory.createProperty(
        riNamespace + "fromCommunity");   
    StmtIterator stmtI1 = model.listStatements(resource,
        fromCommunity, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate fromCommunity property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONOBJECT,
            "fromCommunity property of ReputationObject resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Community community = (Community) getResourceFromCache(
            statement.getObject().asResource(), Community.class);
        if(community == null) {
          community = getCommunity(model,
              statement.getObject().asResource());         
        }
        repObj.setFromCommunity(community);
      }
    }
    // hasValue //
    Property hasValue = ResourceFactory.createProperty(
        riNamespace + "hasValue");   
    stmtI1 = model.listStatements(resource,
        hasValue, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasValue property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONOBJECT,
            "hasValue property of ReputationObject resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationValue repVal = (ReputationValue) getResourceFromCache(
            statement.getObject().asResource(), ReputationValue.class);
        if(repVal == null) {
          repVal = getReputationValue(model,
              statement.getObject().asResource());         
        }
        repObj.addHasValue(repVal);
      }
    }
    // owner //
    Property owner = ResourceFactory.createProperty(
        riNamespace + "owner");   
    stmtI1 = model.listStatements(resource,
        owner, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate owner property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONOBJECT,
            "owner property of ReputationObject resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    }
    // Specific Attributes and Properties of ReputationEvaluation Class //
    // collectionIdentifier //
    Property identifier = ResourceFactory.createProperty(
        riNamespace + "collectionIdentifier");
    StmtIterator stmtI1 = model.listStatements(resource,
        identifier, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate collectionIdentifier property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONEVALUATION,
            "collectionIdentifier property of ReputationEvaluation resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        repEva.setCollectionIdentifier(statement.getObject(
            ).asLiteral().getString());
      }
    }
    // target //
    Property target = ResourceFactory.createProperty(
        riNamespace + "target");   
    stmtI1 = model.listStatements(resource,
        target, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate target property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONEVALUATION,
            "target property of ReputationEvaluation resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Entity targetImp = (Entity) getResourceFromCache(
            statement.getObject().asResource(), Entity.class);
        if(targetImp == null) {
          targetImp = getEntity(model,statement.getObject().asResource(),null);         
        }
        repEva.setTarget(targetImp);
      }
    }
    // hasMetric //
    Property hasMetric = ResourceFactory.createProperty(
        riNamespace + "hasMetric");   
    stmtI1 = model.listStatements(resource,
        hasMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasMetric property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONEVALUATION,
            "hasMetric property of ReputationEvaluation resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    }
    // Specific Attributes and Properties of ReputationValue Class //
    // collectionIdentifier //
    Property identifier = ResourceFactory.createProperty(
        riNamespace + "collectionIdentifier");
    StmtIterator stmtI1 = model.listStatements(resource,
        identifier, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate collectionIdentifier property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONVALUE,
            "collectionIdentifier property of resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        repVal.setCollectionIdentifier(statement.getObject(
            ).asLiteral().getString());
      }
    }
    // timeStamp //
    Property homePage = ResourceFactory.createProperty(
        riNamespace + "timeStamp");
    stmtI1 = model.listStatements(resource,
        homePage, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate timeStamp property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONVALUE,
            "timeStamp property of resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        DateFormat dt = DateFormat.getDateTimeInstance();
        repVal.setTimeStamp(dt.parse(statement.getObject(
            ).asLiteral().getString()));
      }
    }
    // expirationTime //
    Property expirationTime = ResourceFactory.createProperty(
        riNamespace + "expirationTime");
    stmtI1 = model.listStatements(resource,
        expirationTime, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate expirationTime property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONVALUE,
            "expirationTime property of resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        DateFormat dt = DateFormat.getDateTimeInstance();
        repVal.setExpirationTime(dt.parse(statement.getObject(
            ).asLiteral().getString()));
      }
    }
    // obtainedBy //
    Property obtainedBy = ResourceFactory.createProperty(
        riNamespace + "obtainedBy");   
    stmtI1 = model.listStatements(resource,
        obtainedBy, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate obtainedBy property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONVALUE,
            "obtainedBy property of resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationAlgorithmImplementation repAlg = (ReputationAlgorithmImplementation)
          getResourceFromCache(statement.getObject().asResource(),
              ReputationAlgorithmImplementation.class);
        if(repAlg == null) {
          repAlg = getReputationAlgorithm(model,
              statement.getObject().asResource(),null);         
        }
        repVal.setObtainedBy(repAlg);
      }
    }
    // owner //
    Property owner = ResourceFactory.createProperty(
        riNamespace + "owner");   
    stmtI1 = model.listStatements(resource,
        owner, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate owner property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONVALUE,
            "owner property of resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Entity entity = (Entity) getResourceFromCache(
            statement.getObject().asResource(), Entity.class);
        if(entity == null) {
          entity = getEntity(model,statement.getObject().asResource(),null);         
        }
        repVal.setOwner(entity);
      }
    }
    // hasEvaluation //
    Property hasEvaluation = ResourceFactory.createProperty(
        riNamespace + "hasEvaluation");   
    stmtI1 = model.listStatements(resource,
        hasEvaluation, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasEvaluation property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONVALUE,
            "hasEvaluation property of resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    }
    // Specific Attributes and Properties of Community Class //
    // name //
    Property identifier = ResourceFactory.createProperty(
        riNamespace + "identifier");
    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.COMMUNITY,
            "identifier property of resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        community.setName(statement.getObject().asLiteral().getString());
      }
    }
    // homePage //
    Property homePage = ResourceFactory.createProperty(
        riNamespace + "homePage");
    stmtI1 = model.listStatements(resource,
        homePage, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate homePage property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.COMMUNITY,
            "homePage property of resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        community.setDomainName(statement.getObject().asLiteral().getString());
      }
    }
    // hasCategory //
    Property mapsMetric = ResourceFactory.createProperty(
        riNamespace + "hasCategory");   
    stmtI1 = model.listStatements(resource,
        mapsMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasCategory property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.COMMUNITY,
            "hasCategory property of 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());         
        }
        community.addCategory(category);
      }
    }
    // hasReputationModel //
    Property hasReputationModel = ResourceFactory.createProperty(
        riNamespace + "hasReputationModel");   
    stmtI1 = model.listStatements(resource,
        hasReputationModel, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasReputationModel property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.COMMUNITY,
            "hasReputationModel property of Community resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationAlgorithmImplementation repAlg = (ReputationAlgorithmImplementation)
          getResourceFromCache(statement.getObject().asResource(),
          ReputationAlgorithmImplementation.class);
        if(repAlg == null) {
          repAlg = getReputationAlgorithm(model,
              statement.getObject().asResource(),null);         
        }
        community.setReputationModel(repAlg);
      }
    }
    // hasEntity //
    Property hasEntity = ResourceFactory.createProperty(
        riNamespace + "hasEntity");   
    stmtI1 = model.listStatements(resource,
        hasEntity, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate hasEntity property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.COMMUNITY,
            "hasEntity property of Community resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    // Specific Attributes and Properties of ReputationImporter Class //   
    Property mapsMetric = ResourceFactory.createProperty(
        riNamespace + "mapsMetric");
    /* mapsMetric */
    StmtIterator stmtI1 = model.listStatements(resource,
        mapsMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate mapsMetric property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONIMPORTER,
            "mapsMetric property of ReputationAlgorithm resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        MetricMapping metMap = (MetricMapping) getResourceFromCache(
            statement.getObject().asResource(), MetricMapping.class);
        if(metMap == null) {
          metMap = getMetricMapping(model,
              statement.getObject().asResource());         
        }
        repImpBeh.addMapsMetrics(metMap);
      }
    }
    Property importsFrom = ResourceFactory.createProperty(
        riNamespace + "importsFrom");
    /* importsFrom */
    stmtI1 = model.listStatements(resource,
        importsFrom, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate importsFrom property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONALGORITHM,
            "importsFrom property of ReputationAlgorithm resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    addResourceInstanceToCache(resource, behaviour);
    // Specific Attributes and Properties of ReputationImporter Class //   
    Property mapsMetric = ResourceFactory.createProperty(
        riNamespace + "mapsMetric");
    /* mapsMetric */
    StmtIterator stmtI1 = model.listStatements(resource,
        mapsMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate mapsMetric property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONIMPORTER,
            "mapsMetric property of ReputationImporter resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        MetricMapping metMap = (MetricMapping) getResourceFromCache(
            statement.getObject().asResource(),MetricMapping.class);
        if(metMap == null) {
          metMap = getMetricMapping(model,
              statement.getObject().asResource());         
        }
        behaviour.addMapsMetrics(metMap);       
      }
    }
    Property importsFrom = ResourceFactory.createProperty(
        riNamespace + "importsFrom");
    /* importsFrom */
    stmtI1 = model.listStatements(resource,
        importsFrom, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate importsFrom property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.REPUTATIONIMPORTER,
            "importsFrom property of ReputationImporter resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    impUni.setResource(resource);
    addResourceInstanceToCache(resource, impUni);
    Property importedCommunity = ResourceFactory.createProperty(
        riNamespace + "importedCommunity");
    /* importedCommunity */
    StmtIterator stmtI1 = model.listStatements(resource,
        importedCommunity, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate importedCommunity property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.IMPORTATIONUNIT,
            "importedCommunity property of ImportationUnit resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Community community = (Community) getResourceFromCache(
            statement.getObject().asResource(), Community.class);
        if(community == null) {
          community = getCommunity(model,
              statement.getObject().asResource());         
        }
        impUni.setImportedCommunity(community);
      }
    }
    Property importedMetric = ResourceFactory.createProperty(
        riNamespace + "importedMetric");
    /* importedMetric */
    stmtI1 = model.listStatements(resource,
        importedMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate importedMetric property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.IMPORTATIONUNIT,
            "importedMetric property of MetricMapping resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Metric metric = (Metric) getResourceFromCache(
            statement.getObject().asResource(),Metric.class);
        if(metric == null) {
          metric = getMetric(model,
              statement.getObject().asResource());         
        }
        impUni.setImportedMetric(metric);
      }
    }
    Property collectsReputationBy = ResourceFactory.createProperty(
        riNamespace + "collectsReputationBy");
    /* collectsReputationBy */
    stmtI1 = model.listStatements(resource,
        collectsReputationBy, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate collectsReputationBy property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.IMPORTATIONUNIT,
            "collectsReputationBy property of ImportationUnit resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        ReputationAlgorithmImplementation colAlg = (
            ReputationAlgorithmImplementation) getResourceFromCache(
            statement.getObject().asResource(),ReputationAlgorithmImplementation.class);
        if(colAlg == null) {
          colAlg = getReputationAlgorithm(model,
              statement.getObject().asResource(),null);         
        }
        impUni.setCollectsReputationBy(colAlg);
      }
    }
    Property metricTransformation = ResourceFactory.createProperty(
        riNamespace + "metricTransformation");
    /* metricTransformation */
    stmtI1 = model.listStatements(resource,
        metricTransformation, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate metricTransformation property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.IMPORTATIONUNIT,
            "metricTransformation property of ImportationUnit resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        MetricTransformer metTra = (MetricTransformer)
          getResourceFromCache(statement.getObject().asResource(),
              MetricTransformer.class);
        if(metTra == null) {
          metTra = getMetricTransformer(model,
              statement.getObject().asResource(),null);         
        }
        impUni.setMetricTransformation(metTra);
      }
    }
    Property trust = ResourceFactory.createProperty(
        riNamespace + "trust");
    /* trust */
    stmtI1 = model.listStatements(resource,
        trust, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate trust property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.IMPORTATIONUNIT,
            "trust property of importationUnit ImportationUnit resource:"+
            resource.getURI()+" is not a resource")) {
View Full Code Here

    metMap.setResource(resource);
    addResourceInstanceToCache(resource, metMap);
    Property value = ResourceFactory.createProperty(
        riNamespace + "value");
    // value //
    StmtIterator stmtI1 = model.listStatements(resource,
        value, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate value property //
      if(!statement.getObject().isLiteral()) {         
        if(!ModelException.throwException(ModelException.METRICMAPPING,
            "value property of MetricMapping resource:"+
            resource.getURI()+" is not a literal")) {
          return null;
        }
      } else {
        metMap.setValue(statement.getObject().asLiteral().getDouble());
      }
    }   
    Property importedMetric = ResourceFactory.createProperty(
        riNamespace + "importedMetric");
    // importedMetric //
    stmtI1 = model.listStatements(resource,
        importedMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      /* validate importedMetric property */
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.METRICMAPPING,
            "importedMetric property of MetricMapping resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Metric metric = (Metric) getResourceFromCache(
            statement.getObject().asResource(),Metric.class);
        if(metric == null) {
          metric = getMetric(model,statement.getObject().asResource());         
        }
        metMap.setImportedMetric(metric);
      }
    }
    Property resultMetric = ResourceFactory.createProperty(
        riNamespace + "resultMetric");
    // resultMetric //
    stmtI1 = model.listStatements(resource,
        resultMetric, (RDFNode)null);
    while(stmtI1.hasNext()) {
      Statement statement = stmtI1.nextStatement();
      // validate resultMetric property //
      if(!statement.getObject().isResource()) {         
        if(!ModelException.throwException(ModelException.METRICMAPPING,
            "resultMetric property of MetricMapping resource:"+
            resource.getURI()+" is not a resource")) {
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.