Package cross.reputation.model

Examples of cross.reputation.model.ReputationImporterBehaviour


    }   
    List<Class<? extends ReputationBehaviour>> types =
      new ArrayList<Class<? extends ReputationBehaviour>>();
    types.add(ReputationImporterBehaviour.class);
    repImp = getReputationAlgorithm(model, resource,types);
    ReputationImporterBehaviour repImpBeh = null;
    for(ReputationBehaviour behaviour : repImp.getBehaviours()) {
      if(behaviour instanceof ReputationImporterBehaviour) {
        repImpBeh = (ReputationImporterBehaviour) 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 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")) {
          return null;
        }
      } else {
        ImportationUnit impUni = (ImportationUnit) getResourceFromCache(
            statement.getObject().asResource(), ImportationUnit.class);
        if(impUni == null) {
          impUni = getImportationUnit(model,
              statement.getObject().asResource());         
        }
        repImpBeh.addImportsFrom(impUni);
      }
    } 
    return repImp;
  }
View Full Code Here


    return repImp;
  }
 
  public ReputationBehaviour getReputationImporterBehaviour(Model model,
      Resource resource, Class<? extends ReputationBehaviour> type) throws Exception {
    ReputationImporterBehaviour behaviour = (
        ReputationImporterBehaviour) getResourceFromCache(
            resource, ReputationImporterBehaviour.class);
    if(behaviour != null) {     
      return behaviour;
    }
    behaviour = new ReputationImporterBehaviour();
    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")) {
          return null;
        }
      } else {
        ImportationUnit impUni = (ImportationUnit) getResourceFromCache(
            statement.getObject().asResource(),ImportationUnit.class);
        if(impUni == null) {
          impUni = getImportationUnit(model,
              statement.getObject().asResource());         
        }
        behaviour.addImportsFrom(impUni);
      }
    }
    return behaviour;
 
View Full Code Here

            metricMappings.addAll(findMetricMappings(repAlgInside));
          }
        }
      }
      if(ReputationImporterBehaviour.class.isInstance(behaviour)) {
        ReputationImporterBehaviour importer = (
            ReputationImporterBehaviour) behaviour;
        if(importer.getImportsFrom() != null) {
          metricMappings.addAll(importer.getMapsMetrics());
        }
        //We do not have to search if there are more ReputationImporter in the
        //importationUnit method of collectsReputationBy because it does not
        //have sense (to import from a community does not need importations from
        //other communities inside)
View Full Code Here

            importationUnitsMap.putAll(findImportationUnits(repAlgInside));
          }
        }
      }
      if(ReputationImporterBehaviour.class.isInstance(behaviour)) {
        ReputationImporterBehaviour importer = (
            ReputationImporterBehaviour) behaviour;
        if(importer.getImportsFrom() != null) {
          Set<ImportationUnit> importationUnits = new HashSet<ImportationUnit>();
          importationUnits.addAll(importer.getImportsFrom());
          importationUnitsMap.put(importer, importationUnits);
        }
        //We do not have to search if there are more ReputationImporter in the
        //importationUnit method of collectsReputationBy because it does not
        //have sense (to import from a community does not need importations from
View Full Code Here

TOP

Related Classes of cross.reputation.model.ReputationImporterBehaviour

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.