VIVO-1017 Fix stupid mistake from VIVO-1015

When the variables were given meaningful names, it became obvious that I was checking
the wrong one to see whether it was a faux property.
This commit is contained in:
Jim Blake 2015-04-15 11:13:27 -04:00
parent c8eca40385
commit c623e32cff

View file

@ -239,25 +239,25 @@ public class GroupedPropertyList extends BaseTemplateModel {
WebappDaoFactory wadf = vreq.getLanguageNeutralWebappDaoFactory(); WebappDaoFactory wadf = vreq.getLanguageNeutralWebappDaoFactory();
PropertyInstanceDao piDao = wadf.getPropertyInstanceDao(); PropertyInstanceDao piDao = wadf.getPropertyInstanceDao();
Collection<PropertyInstance> allPropInstColl = piDao Collection<PropertyInstance> allPossiblePI = piDao
.getAllPossiblePropInstForIndividual(subject.getURI()); .getAllPossiblePropInstForIndividual(subject.getURI());
if (allPropInstColl != null) { if (allPossiblePI != null) {
for (PropertyInstance pi : allPropInstColl) { for (PropertyInstance possiblePI : allPossiblePI) {
if (pi != null) { if (possiblePI != null) {
// use the language-aware wdf because redundancy check // use the language-aware wdf because redundancy check
// for display will depend on public label match // for display will depend on public label match
ObjectProperty piOp = assembleObjectProperty(pi); ObjectProperty possibleOP = assembleObjectProperty(possiblePI);
if (piOp == null) { if (possibleOP == null) {
continue; continue;
} }
boolean addToList = true; boolean addToList = true;
for(ObjectProperty op : populatedObjectPropertyList) { for(ObjectProperty populatedOP : populatedObjectPropertyList) {
if (redundant(op, piOp)) { if (redundant(populatedOP, possibleOP)) {
addToList = false; addToList = false;
} }
} }
if(addToList) { if(addToList) {
propertyList.add(piOp); propertyList.add(possibleOP);
} }
} else { } else {
log.error("a property instance in the Collection created by PropertyInstanceDao.getAllPossiblePropInstForIndividual() is unexpectedly null"); log.error("a property instance in the Collection created by PropertyInstanceDao.getAllPossiblePropInstForIndividual() is unexpectedly null");
@ -313,27 +313,28 @@ public class GroupedPropertyList extends BaseTemplateModel {
* (the unpopulated property) has a different range than op1 because of a restriction, * (the unpopulated property) has a different range than op1 because of a restriction,
* then we want to ignore that difference, so it appears to be redundant. * then we want to ignore that difference, so it appears to be redundant.
*/ */
private boolean redundant(ObjectProperty op, ObjectProperty op2) { private boolean redundant(ObjectProperty populatedOP, ObjectProperty possibleOP) {
if (new FullPropertyKey((Property)op).equals(new FullPropertyKey((Property)op2))) { if (new FullPropertyKey((Property)populatedOP).equals(
new FullPropertyKey((Property)possibleOP))) {
return true; return true;
} else if ( } else if (
new FullPropertyKey(fudgeBlankNodeInDomain(op.getDomainVClassURI()), new FullPropertyKey(fudgeBlankNodeInDomain(populatedOP.getDomainVClassURI()),
op.getURI(), populatedOP.getURI(),
op.getRangeVClassURI()).equals( populatedOP.getRangeVClassURI()).equals(
new FullPropertyKey(fudgeBlankNodeInDomain(op2.getDomainVClassURI()), new FullPropertyKey(fudgeBlankNodeInDomain(possibleOP.getDomainVClassURI()),
op2.getURI(), possibleOP.getURI(),
op2.getRangeVClassURI()))) { possibleOP.getRangeVClassURI()))) {
return true; return true;
} else if ( } else if (
new FullPropertyKey(op.getDomainVClassURI(), new FullPropertyKey(populatedOP.getDomainVClassURI(),
op.getURI(), populatedOP.getURI(),
fudgeBlankNodeInRange(op.getRangeVClassURI())).equals( fudgeBlankNodeInRange(populatedOP.getRangeVClassURI())).equals(
new FullPropertyKey(op2.getDomainVClassURI(), new FullPropertyKey(possibleOP.getDomainVClassURI(),
op2.getURI(), possibleOP.getURI(),
fudgeBlankNodeInRange(op2.getRangeVClassURI())))) { fudgeBlankNodeInRange(possibleOP.getRangeVClassURI())))) {
return true; return true;
} else if (!(op instanceof FauxObjectPropertyWrapper) && } else if (!(possibleOP instanceof FauxObjectPropertyWrapper) &&
op.getURI().equals(op2.getURI())) { // If not faux property, ignore range difference populatedOP.getURI().equals(possibleOP.getURI())) { // If not faux property, ignore range difference
return true; return true;
} else { } else {
return false; return false;