return repMod;
}
public ReputationBehaviour getReputationModelBehaviour(Model model,
Resource resource, Class<? extends ReputationBehaviour> type) throws Exception {
ReputationModelBehaviour behaviour = (ReputationModelBehaviour)
getResourceFromCache(resource, ReputationModelBehaviour.class);
if(behaviour != null) {
return behaviour;
}
behaviour = new ReputationModelBehaviour();
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")) {
return null;
}
} else {
ReputationAlgorithmImplementation repAlg =
(ReputationAlgorithmImplementation) getResourceFromCache(
statement.getObject().asResource(),ReputationAlgorithmImplementation.class);
if(repAlg == null) {
repAlg = getReputationAlgorithm(model,
statement.getObject().asResource(), null);
}
behaviour.addReputationModules(repAlg);
}
}
return behaviour;
}