Merge branch 'maint-rel-1.6' of git+ssh://github.com/vivo-project/Vitro into maint-rel-1.6

This commit is contained in:
j2blake 2013-11-06 11:45:17 -05:00
commit 171f47d392
2 changed files with 28 additions and 15 deletions

View file

@ -271,7 +271,6 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
public ObjectProperty getObjectPropertyByURI(String propertyURI) { public ObjectProperty getObjectPropertyByURI(String propertyURI) {
long start = System.currentTimeMillis();
if( propertyURI == null ) return null; if( propertyURI == null ) return null;
OntModel ontModel = getOntModel(); OntModel ontModel = getOntModel();
@ -279,7 +278,16 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
ontModel.enterCriticalSection(Lock.READ); ontModel.enterCriticalSection(Lock.READ);
try { try {
localModel.add(ontModel.listStatements(ontModel.getResource(propertyURI), null, (RDFNode) null)); Resource prop = ontModel.getResource(propertyURI);
localModel.add(ontModel.listStatements(prop, null, (RDFNode) null));
StmtIterator invit = ontModel.listStatements(prop, OWL.inverseOf, (RDFNode) null);
while (invit.hasNext()) {
Statement invSit = invit.nextStatement();
if (invSit.getObject().isURIResource()) {
Resource invProp = (Resource) invSit.getObject();
localModel.add(ontModel.listStatements(invProp, null, (RDFNode) null));
}
}
OntProperty op = localModel.getObjectProperty(propertyURI); OntProperty op = localModel.getObjectProperty(propertyURI);
return propertyFromOntProperty(op); return propertyFromOntProperty(op);
} finally { } finally {

View file

@ -300,21 +300,26 @@ public class GroupedPropertyList extends BaseTemplateModel {
return false; return false;
} }
for (ObjectProperty op : opList) { for (ObjectProperty op : opList) {
if (op.getURI() != null && op.getURI().equals(pi.getPropertyURI())) { boolean uriMatches = (op.getURI() != null
&& op.getURI().equals(pi.getPropertyURI()));
boolean domainMatches = false;
boolean rangeMatches = false;
if(op.getDomainVClassURI() == null) { if(op.getDomainVClassURI() == null) {
if(pi.getDomainClassURI() == null) { if(pi.getDomainClassURI() == null) {
return true; domainMatches = true;
} }
} else if (op.getDomainVClassURI().equals(pi.getDomainClassURI())) { } else if (op.getDomainVClassURI().equals(pi.getDomainClassURI())) {
return true; domainMatches = true;
} }
if(op.getRangeVClassURI() == null) { if(op.getRangeVClassURI() == null) {
if (pi.getDomainClassURI() == null) { if (pi.getDomainClassURI() == null) {
return true; rangeMatches = true;
} }
} else if (op.getRangeVClassURI().equals(pi.getRangeClassURI())) { } else if (op.getRangeVClassURI().equals(pi.getRangeClassURI())) {
return true; rangeMatches = true;
} }
if (uriMatches && domainMatches && rangeMatches) {
return true;
} }
} }
return false; return false;