NIHVIVO-1715 Use local name instead of label for properties that don't have a label (vitro props). Fixes errors in GroupedPropertyList.

This commit is contained in:
rjy7 2011-01-14 20:58:05 +00:00
parent 13cfc80bc2
commit 416d42e963
2 changed files with 14 additions and 3 deletions

View file

@ -896,7 +896,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
QuerySolution soln = results.next();
Resource resource = soln.getResource("property");
String uri = resource.getURI();
log.debug("Found populated object property " + uri + " for individual " + subjectUri);
log.debug("Found populated object property " + uri);
ObjectProperty property = getObjectPropertyByURI(uri);
properties.add(property);
}

View file

@ -278,7 +278,9 @@ public class GroupedPropertyList extends BaseTemplateModel {
// RY How could it happen that it's already in the group? Maybe we can remove this test.
if (!alreadyOnPropertyList(groupForUnassignedProperties.getPropertyList(),p)) {
groupForUnassignedProperties.getPropertyList().add(p);
log.debug("adding property "+p.getLabel()+" to group for unassigned properties");
if (log.isDebugEnabled()) {
log.debug("adding property " + getLabel(p) + " to group for unassigned properties");
}
}
}
// Otherwise, if the property is assigned to this group, add it to the group if it's not already there
@ -349,7 +351,7 @@ public class GroupedPropertyList extends BaseTemplateModel {
if (diff==0) {
diff = determineDisplayRank(p1) - determineDisplayRank(p2);
if (diff==0) {
return p1.getLabel().compareTo(p2.getLabel());
return getLabel(p1).compareTo(getLabel(p2));
} else {
return diff;
}
@ -376,6 +378,15 @@ public class GroupedPropertyList extends BaseTemplateModel {
}
}
// Since we're now including some vitro properties in the property list, which don't have labels,
// use their local name instead.
private String getLabel(Property property) {
String label = property.getLabel();
if (label == null) {
label = property.getLocalName();
}
return label;
}
/* Access methods for templates */