V IVO-989 Don't show a property twice just because its range is a blank node.

This commit is contained in:
Jim Blake 2015-03-20 15:37:03 -04:00
parent abea644f46
commit 5476ba66e1

View file

@ -128,7 +128,6 @@ public class GroupedPropertyList extends BaseTemplateModel {
if (editing) { if (editing) {
mergeAllPossibleDataProperties(propertyList); mergeAllPossibleDataProperties(propertyList);
} }
sort(propertyList); sort(propertyList);
// Put the list into groups // Put the list into groups
@ -305,21 +304,29 @@ public class GroupedPropertyList extends BaseTemplateModel {
/** /**
* Don't know what the real problem is with VIVO-976, but somehow we have the same property * Don't know what the real problem is with VIVO-976, but somehow we have the same property
* showing up once with a blank node as a domain, and once with null or OWL:Thing as a domain. * showing up once with a blank node as a domain, and once with null or OWL:Thing as a domain.
*
* Similarly, don't know the real problem with VIVO-989, except that the ranges are both
* blank nodes - probably the same blank node but on two different reads.
*/ */
private boolean redundant(ObjectProperty op, ObjectProperty op2) { private boolean redundant(ObjectProperty op, ObjectProperty op2) {
if (new FullPropertyKey((Property)op).equals(new FullPropertyKey((Property)op2))) { if (new FullPropertyKey((Property)op).equals(new FullPropertyKey((Property)op2))) {
return true; return true;
} else if ( } else if (
new FullPropertyKey( new FullPropertyKey(fudgeBlankNodeInDomain(op.getDomainVClassURI()),
fudgeBlankNodeInDomain(op.getDomainVClassURI()),
op.getURI(), op.getURI(),
op.getRangeVClassURI()) op.getRangeVClassURI()).equals(
.equals( new FullPropertyKey(fudgeBlankNodeInDomain(op2.getDomainVClassURI()),
new FullPropertyKey(
fudgeBlankNodeInDomain(op2.getDomainVClassURI()),
op2.getURI(), op2.getURI(),
op2.getRangeVClassURI()))) { op2.getRangeVClassURI()))) {
return true; return true;
} else if (
new FullPropertyKey(op.getDomainVClassURI(),
op.getURI(),
fudgeBlankNodeInRange(op.getRangeVClassURI())).equals(
new FullPropertyKey(op2.getDomainVClassURI(),
op2.getURI(),
fudgeBlankNodeInRange(op2.getRangeVClassURI())))) {
return true;
} else { } else {
return false; return false;
} }
@ -335,6 +342,16 @@ public class GroupedPropertyList extends BaseTemplateModel {
} }
} }
private String fudgeBlankNodeInRange(String rawRangeUri) {
if (rawRangeUri == null) {
return null;
} else if (rawRangeUri.contains("http://vitro.mannlib.cornell.edu/ns/bnode#")) {
return "http://vitro.mannlib.cornell.edu/ns/bnode#-deadbeef";
} else {
return rawRangeUri;
}
}
private void addObjectPropertyToPropertyList(String propertyUri, String domainUri, String rangeUri, private void addObjectPropertyToPropertyList(String propertyUri, String domainUri, String rangeUri,
List<Property> propertyList) { List<Property> propertyList) {
ObjectPropertyDao opDao = wdf.getObjectPropertyDao(); ObjectPropertyDao opDao = wdf.getObjectPropertyDao();