VIVO-799: only display individuals with rdfs labels in custom form picklists

This commit is contained in:
Tim Worrall 2014-06-18 14:24:32 -04:00
parent 7e514f3cfd
commit 667f89bb2d
4 changed files with 19 additions and 7 deletions

View file

@ -24,7 +24,8 @@ public interface Individual extends ResourceBean, Comparable<Individual> {
* one of the labels will be returned, which one is undefined.
*/
String getRdfsLabel();
void setRdfsLabel(String in);
String getVClassURI();
void setVClassURI(String in);

View file

@ -345,6 +345,11 @@ public class IndividualFiltering implements Individual {
_innerIndividual.setName(in);
}
@Override
public void setRdfsLabel(String in) {
_innerIndividual.setRdfsLabel(in);
}
@Override
public void setNamespace(String namespace) {
_innerIndividual.setNamespace(namespace);

View file

@ -278,6 +278,7 @@ public class IndividualDaoSDB extends IndividualDaoJena {
this.dwf, datasetMode, wadf,
SKIP_INITIALIZATION);
ent.setName(label);
ent.setRdfsLabel(label);
return ent;
}

View file

@ -129,13 +129,18 @@ public class IndividualsViaObjectPropetyOptions implements FieldOptions {
for (Individual ind : individuals) {
String uri = ind.getURI();
if (uri != null) {
String label = ind.getName().trim();
List<String> msTypes = ind.getMostSpecificTypeURIs();
if ( hasSubclasses && msTypes.size() > 0 ) {
label += " (" + getMsTypeLocalName(msTypes.get(0), wDaoFact) + ")";
// The picklist should only display individuals with rdfs labels.
// SO changing the following line -- tlw72
// String label = ind.getName().trim();
String label = ind.getRdfsLabel();
if ( label != null ) {
List<String> msTypes = ind.getMostSpecificTypeURIs();
if ( hasSubclasses && msTypes.size() > 0 ) {
label += " (" + getMsTypeLocalName(msTypes.get(0), wDaoFact) + ")";
}
optionsMap.put(uri, label);
++optionsCount;
}
optionsMap.put(uri, label);
++optionsCount;
}
}
return optionsMap;