}
params.put("PUID", puid);
for (MeasurementInfoUri info: measurementInfoUris) {
Scale scale = descriptor.getMeasurementScale(info);
if (scale == null) {
// This means that I am not entitled to evaluate this measurementInfo and therefore supposed to skip it:
continue;
}
Value value = scale.createValue();
String propertyURI = info.getAsURI();
if (ACTION_BATCH_SUPPORT.equals(propertyURI)) {
if (alternative.getAction() instanceof IMigrationAction) {
// 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(propertyURI);
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 "+propertyURI);
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 (propertyURI.startsWith(FORMAT_NUMBEROFTOOLS)){
// _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 "+propertyURI);
} else if ((FORMAT_LICENSE_OPEN.equals(propertyURI))||
(FORMAT_LICENSE_IPR_PROTECTED.equals(propertyURI))||
(FORMAT_LICENSE_PROPRIETARY.equals(propertyURI))) {
if (resultSet.size() > 0) {
// we query for rights information in general, this way we can clarify the deduced result
// e.g. open = false, comment: "Format is encumbered by IPR"
boolean open = false;
boolean ipr = false;
boolean proprietary = false;
String comment = "";
for (int i=0; i < resultSet.size(); i++) {
// collect all results, even though there should be only one, the user can take care of it
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)) {
ipr = true;
} else if (P2_RESOURCE_FORMAT_LICENSE_RIGHTS_PROPRIETARY.equals(type)) {
proprietary = true;
}else if (P2_RESOURCE_FORMAT_LICENSE_RIGHTS_OPEN.equals(type)) {
open = true;
}
}
if (resultSet.size() > 1) {
comment = comment + "more than one right category applies to this format, check for reason of this conflict.\n";
}
boolean boolResult = false;
if (FORMAT_LICENSE_OPEN.equals(propertyURI)) {
boolResult = open;
} else if (FORMAT_LICENSE_IPR_PROTECTED.equals(propertyURI)) {
boolResult = ipr;
} else if (FORMAT_LICENSE_PROPRIETARY.equals(propertyURI)) {
boolResult = proprietary;
}
value = scale.createValue();
((BooleanValue)value).bool(boolResult);
value.setComment(comment + "according to MiniREEF/P2 knowledge base");
listener.updateStatus("MiniREEF evaluated "+propertyURI);
}
listener.updateStatus("P2 does not contain enough information to evaluate "+propertyURI+" for this format.");
} else if ((FORMAT_COMPLEXITY.equals(propertyURI)) ||
(FORMAT_DISCLOSURE.equals(propertyURI)) ||
(FORMAT_UBIQUITY.equals(propertyURI)) ||
(FORMAT_DOCUMENTATION_QUALITY.equals(propertyURI))||
(FORMAT_STABILITY.equals(propertyURI))||
(FORMAT_LICENSE.equals(propertyURI))) {
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 "+propertyURI);
} else {