modifications to NIHVIVO-3238 implementation based on Brian L. feedeback
This commit is contained in:
parent
7f8fe2e846
commit
57aca13052
2 changed files with 18 additions and 39 deletions
|
@ -10,6 +10,7 @@ import java.util.Set;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
|
||||||
|
@ -40,32 +41,42 @@ public class ModelUtils {
|
||||||
* BFO Process and a parent that is not a BFO Process and issue
|
* BFO Process and a parent that is not a BFO Process and issue
|
||||||
* a warning if so.
|
* a warning if so.
|
||||||
*/
|
*/
|
||||||
public static PropertyURIPair getPropertyForRoleInClass(String classURI, WebappDaoFactory wadf) {
|
public static ObjectProperty getPropertyForRoleInClass(String classURI, WebappDaoFactory wadf) {
|
||||||
|
|
||||||
PropertyURIPair propertyURIPair= null;
|
|
||||||
|
|
||||||
if (classURI == null) {
|
if (classURI == null) {
|
||||||
log.error("input classURI is null");
|
log.error("input classURI is null");
|
||||||
return propertyURIPair;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wadf == null) {
|
if (wadf == null) {
|
||||||
log.error("input WebappDaoFactory is null");
|
log.error("input WebappDaoFactory is null");
|
||||||
return propertyURIPair;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
VClassDao vcd = wadf.getVClassDao();
|
VClassDao vcd = wadf.getVClassDao();
|
||||||
List<String> superClassURIs = vcd.getSuperClassURIs(classURI, false);
|
List<String> superClassURIs = vcd.getSuperClassURIs(classURI, false);
|
||||||
Iterator<String> iter = superClassURIs.iterator();
|
Iterator<String> iter = superClassURIs.iterator();
|
||||||
|
|
||||||
|
ObjectProperty op = new ObjectProperty();
|
||||||
|
boolean isBFOProcess = false;
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
String superClassURI = iter.next();
|
String superClassURI = iter.next();
|
||||||
|
|
||||||
if (processClass.contains(superClassURI)) {
|
if (processClass.contains(superClassURI)) {
|
||||||
return new PropertyURIPair(processPropertyURI, processPropertyInverseURI);
|
isBFOProcess = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PropertyURIPair(nonProcessPropertyURI, nonProcessPropertyInverseURI);
|
if (isBFOProcess) {
|
||||||
|
op.setURI(processPropertyURI);
|
||||||
|
op.setURIInverse(processPropertyInverseURI);
|
||||||
|
} else {
|
||||||
|
op.setURI(nonProcessPropertyURI);
|
||||||
|
op.setURIInverse(nonProcessPropertyInverseURI);
|
||||||
|
}
|
||||||
|
|
||||||
|
return op;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
|
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
||||||
|
|
||||||
package org.vivoweb.webapp.util;
|
|
||||||
|
|
||||||
public class PropertyURIPair {
|
|
||||||
private String propURI = null;
|
|
||||||
private String inversePropURI = null;
|
|
||||||
|
|
||||||
public PropertyURIPair(){};
|
|
||||||
|
|
||||||
public PropertyURIPair(String propURI, String inversePropURI) {
|
|
||||||
this.propURI = propURI;
|
|
||||||
this.inversePropURI = inversePropURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPropURI() {
|
|
||||||
return propURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPropURI(String propURI) {
|
|
||||||
this.propURI = propURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInversePropURI() {
|
|
||||||
return inversePropURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInversePropURI(String inversePropURI) {
|
|
||||||
this.inversePropURI = inversePropURI;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue