work on application ontology support for property/class configuration

This commit is contained in:
brianjlowe 2013-08-06 10:34:33 -04:00
parent d8d704064e
commit dd80f542ea
2 changed files with 10 additions and 16 deletions

View file

@ -286,7 +286,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
public ObjectProperty getObjectPropertyByURIAndRangeURI(String propertyURI, String rangeURI) { public ObjectProperty getObjectPropertyByURIAndRangeURI(String propertyURI, String rangeURI) {
ObjectProperty op = getObjectPropertyByURI(propertyURI); ObjectProperty op = getObjectPropertyByURI(propertyURI);
if (op == null) { if (op == null || rangeURI == null) {
return op; return op;
} }
op.setRangeVClassURI(rangeURI); op.setRangeVClassURI(rangeURI);

View file

@ -215,9 +215,9 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
// *** check for a predicate URI in the request // *** check for a predicate URI in the request
}else if( predicateUri != null && !predicateUri.isEmpty() ){ }else if( predicateUri != null && !predicateUri.isEmpty() ){
Property prop = getProperty( predicateUri, vreq); Property prop = getProperty( predicateUri, rangeUri, vreq);
if (prop != null && rangeUri != null) { if (prop != null && rangeUri != null) {
editConfGeneratorName = getCustomEntryFormForPropertyAndRange(prop, rangeUri); editConfGeneratorName = getCustomEntryForm(prop);
} else if( prop != null && prop.getCustomEntryForm() != null ){ } else if( prop != null && prop.getCustomEntryForm() != null ){
//there is a custom form, great! let's use it. //there is a custom form, great! let's use it.
editConfGeneratorName = prop.getCustomEntryForm(); editConfGeneratorName = prop.getCustomEntryForm();
@ -247,25 +247,19 @@ public class EditRequestDispatchController extends FreemarkerHttpServlet {
return editConfGeneratorName; return editConfGeneratorName;
} }
private String getCustomEntryFormForPropertyAndRange(Property prop, String rangeUri){ private String getCustomEntryForm(Property prop){
String entryFormName = null; if (prop.getCustomEntryForm() == null) {
// = ApplicationConfigurationOntologyUtils.getEntryForm(prop.getURI(), rangeUri);
if (entryFormName == null) {
if (prop.getCustomEntryForm() != null) {
return prop.getCustomEntryForm();
} else {
return DEFAULT_OBJ_FORM; return DEFAULT_OBJ_FORM;
}
} else { } else {
prop.setCustomEntryForm(entryFormName); return prop.getCustomEntryForm();
return entryFormName;
} }
} }
private Property getProperty(String predicateUri, VitroRequest vreq) { private Property getProperty(String predicateUri, String rangeUri, VitroRequest vreq) {
Property p = null; Property p = null;
try{ try{
p = vreq.getWebappDaoFactory().getObjectPropertyDao().getObjectPropertyByURI(predicateUri); p = vreq.getWebappDaoFactory().getObjectPropertyDao().getObjectPropertyByURIAndRangeURI(
predicateUri, rangeUri);
if(p == null) { if(p == null) {
p = vreq.getWebappDaoFactory().getDataPropertyDao().getDataPropertyByURI(predicateUri); p = vreq.getWebappDaoFactory().getDataPropertyDao().getDataPropertyByURI(predicateUri);
} }