createResource(riNamespace + "CategoricScale");
while(stmtI1.hasNext()) {
Statement typeStatement = stmtI1.nextStatement();
if(typeStatement.getObject().asResource().getURI().equals(
numericScale.getURI())) {
Scale scale = getNumericScale(model, resource);
return scale;
} else if (typeStatement.getObject().asResource().getURI().equals(
categoricScale.getURI())) {
Scale scale = getCategoricScale(model, resource);
return scale;
}
}
if(type == null) {
if(!ModelException.throwException(ModelException.SCALE,
"Impossible to instanciate a generic Scale(resource:"+resource+"" +
"Please, see the model and assign a specific type.")) {
return null;
}
}
}
Scale scale = (Scale) getResourceFromCache(resource, type);
if(scale != null) {
return scale;
}
scale = type.newInstance();
scale.setResource(resource);
addResourceInstanceToCache(resource, scale);
// name //
Property name = ResourceFactory.createProperty(riNamespace + "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.SCALE,
"name property of scale resource:"+
resource.getURI()+" is not a literal")) {
return null;
}
} else {
scale.setName(statement.getObject().asLiteral().getString());
}
}
return scale;
}