return reputationModule;
}
public ReputationBehaviour getReputationModuleBehaviour(Model model,
Resource resource, Class<? extends ReputationBehaviour> type) throws Exception {
ReputationModuleBehaviour behaviour = (ReputationModuleBehaviour)
getResourceFromCache(resource, ReputationModuleBehaviour.class);
if(behaviour != null) {
//System.out.println("CACHE FOUND with reputationModuleBehaviour:"+behaviour);
return behaviour;
}
behaviour = new ReputationModuleBehaviour();
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")) {
return null;
}
} else {
ReputationAlgorithmImplementation repAlg =
(ReputationAlgorithmImplementation) getResourceFromCache(
statement.getObject().asResource(),ReputationAlgorithmImplementation.class);
if(repAlg == null) {
repAlg = getReputationAlgorithm(model,
statement.getObject().asResource(), null);
}
behaviour.addObtainsReputationsBy(repAlg);
}
}
return behaviour;
}