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 a086957046
commit 8fc32d28ed
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. * one of the labels will be returned, which one is undefined.
*/ */
String getRdfsLabel(); String getRdfsLabel();
void setRdfsLabel(String in);
String getVClassURI(); String getVClassURI();
void setVClassURI(String in); void setVClassURI(String in);

View file

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

View file

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

View file

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