}
params.put("PUID", puid);
for (String measureId : measureUris) {
Scale scale = null;
Value value = null;
if (MeasureConstants.BATCHPROCESSING_SUPPORTED.equals(measureId)) {
scale = new BooleanScale();
value = scale.createValue();
if (!alternative.getAction().isEmulated() && alternative.getAction().isExecutable()) {
// this alternative is wrapped as service and therefore
// provides batch support
value.parse("Yes");
value.setComment("this alternative is wrapped as service and therefore provides batch support");
}
}
String statement = statements.get(measureId);
if (statement == null) {
// this leaf cannot be evaluated by MiniREEF - skip it
continue;
}
String result = null;
// add additional params if necessary
// ...
ResultSet resultSet = MiniREEFResolver.getInstance().resolve(statement, params);
listener.updateStatus("MiniREEF is attempting to evaluate " + measureId);
if (resultSet == null) {
// this should not happen, if MiniREEF is properly configured
listener.updateStatus("querying MiniREEF/P2 knowledge base failed for statement: " + statement);
// skip this leaf
continue;
}
// evaluation was successful!
if (measureId.startsWith(MeasureConstants.NUMBER_OF_TOOLS)) {
scale = new PositiveIntegerScale();
value = scale.createValue();
// _measure_ is the number of tools found
result = "" + resultSet.size();
value.parse(result);
// add names of tools as comment
value.setComment(toCommaSeparated(resultSet.getColResults("swname"))
+ "; - according to miniREEF/P2 knowledge base");
listener.updateStatus("MiniREEF evaluated " + measureId);
} else if (MeasureConstants.FORMAT_IPR_PROTECTION.equals(measureId)) {
scale = new OrdinalScale();
if (resultSet.size() > 0) {
// e.g. open = false, comment: "Format is encumbered by IPR"
String comment = "";
String valueStr = "";
for (int i = 0; i < resultSet.size(); i++) {
List<String> vals = resultSet.getRow(i);
comment = comment + vals.get(0) + "\n";
String type = vals.get(1);
if (P2_RESOURCE_FORMAT_LICENSE_RIGHTS_IPR_PROTECTED.equals(type)) {
valueStr = "ipr_protected";
comment = comment + valueStr;
} else if (P2_RESOURCE_FORMAT_LICENSE_RIGHTS_PROPRIETARY.equals(type)) {
valueStr = "proprietary";
comment = comment + valueStr;
} else if (P2_RESOURCE_FORMAT_LICENSE_RIGHTS_OPEN.equals(type)) {
valueStr = "open";
comment = comment + valueStr;
}
}
if (resultSet.size() > 1) {
comment = comment
+ ": more than one right category applies to this format, check for reason of this conflict.\n";
}
value = scale.createValue();
value.parse(valueStr);
value.setComment(comment + ": according to MiniREEF/P2 knowledge base");
listener.updateStatus("MiniREEF evaluated " + measureId);
}
listener.updateStatus("P2 does not contain enough information to evaluate " + measureId
+ " for this format.");
} else if ((MeasureConstants.FORMAT_COMPLEXITY.equals(measureId))) {
// || (MeasureConstants.FORMAT_DISCLOSURE.equals(measureId))
// FIXME: the results from p2 have to be matched to the defined
// measures
// || (MeasureConstants.FORMAT_UBIQUITY.equals(measureId))
// ||
// (MeasureConstants.FORMAT_DOCUMENTATION_QUALITY.equals(measureId))
// || (MeasureConstants.FORMAT_STABILITY.equals(measureId))
// || (MeasureConstants.FORMAT_LICENSE.equals(measureId))) {
scale = new OrdinalScale();
if (resultSet.size() > 0) {
String text = resultSet.getRow(0).get(0);
if (text.trim().length() > 0) {
value = scale.createValue();
value.parse(text);
value.setComment("according to miniREEF/P2 knowledge base");
}
listener.updateStatus("MiniREEF evaluated " + measureId);
} else {