}
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;
}