try {
while ((results != null) && (results.hasNext())) {
QuerySolution qs = results.next();
ControlPolicy cp = new ControlPolicy();
String controlPolicyUri = qs.getResource("objective").getURI();
String controlPolicyName = qs.getLiteral("objective_label").toString();
String measureUri = qs.getResource("measure").toString();
String modality = qs.getResource("modality").getLocalName();
String value = qs.getLiteral("value").getString();
Resource qualifier = qs.getResource("qualifier");
Measure m = criteriaManager.getMeasure(measureUri);
cp.setUri(controlPolicyUri);
cp.setName(controlPolicyName);
cp.setValue(value);
cp.setMeasure(m);
if (qualifier != null) {
cp.setQualifier(ControlPolicy.Qualifier.valueOf(qualifier.getLocalName()));
} else {
cp.setQualifier(ControlPolicy.Qualifier.EQ);
}
cp.setModality(ControlPolicy.Modality.valueOf(modality));
pc.getControlPolicies().add(cp);
}
} finally {
qe.close();