VIVO-303 picklist sorting
This commit is contained in:
parent
946c40a13e
commit
e2c48e65f9
26 changed files with 94 additions and 123 deletions
|
@ -239,27 +239,7 @@ public class FormUtils {
|
|||
for (VClass vclass : wadf.getVClassDao().getAllVclasses()) {
|
||||
Option option = new Option();
|
||||
option.setValue(vclass.getURI());
|
||||
if ( (selectedVClassURI != null)
|
||||
&& (vclass.getURI() != null)
|
||||
&& (selectedVClassURI.equals(vclass.getURI())) ) {
|
||||
option.setSelected(true);
|
||||
}
|
||||
String ontologyPrefix = null;
|
||||
if (vclass.getNamespace() != null) {
|
||||
Ontology ont = wadf.getOntologyDao().getOntologyByURI(
|
||||
vclass.getNamespace());
|
||||
if ( (ont != null) && (ont.getPrefix() != null) ) {
|
||||
ontologyPrefix = ont.getPrefix();
|
||||
}
|
||||
}
|
||||
StringBuffer classNameBuffer = new StringBuffer();
|
||||
if (ontologyPrefix != null) {
|
||||
classNameBuffer.append(ontologyPrefix).append(":");
|
||||
}
|
||||
if (vclass.getName() != null) {
|
||||
classNameBuffer.append(vclass.getName());
|
||||
}
|
||||
option.setBody(classNameBuffer.toString());
|
||||
option.setBody(vclass.getPickListName());
|
||||
vclassOptionList.add(option);
|
||||
}
|
||||
return vclassOptionList;
|
||||
|
|
|
@ -60,8 +60,8 @@ public class Classes2ClassesRetryController extends BaseEditController {
|
|||
populateBeanFromParams(objectForEditing, request);
|
||||
|
||||
HashMap hash = new HashMap();
|
||||
hash.put("SuperclassURI", FormUtils.makeOptionListFromBeans(vcDao.getAllVclasses(),"URI","LocalNameWithPrefix",objectForEditing.getSuperclassURI(),null));
|
||||
hash.put("SubclassURI", FormUtils.makeOptionListFromBeans(vcDao.getAllVclasses(),"URI","LocalNameWithPrefix",objectForEditing.getSubclassURI(),null));
|
||||
hash.put("SuperclassURI", FormUtils.makeOptionListFromBeans(vcDao.getAllVclasses(),"URI","PickListName",objectForEditing.getSuperclassURI(),null));
|
||||
hash.put("SubclassURI", FormUtils.makeOptionListFromBeans(vcDao.getAllVclasses(),"URI","PickListName",objectForEditing.getSubclassURI(),null));
|
||||
|
||||
FormObject foo = new FormObject();
|
||||
foo.setOptionLists(hash);
|
||||
|
|
|
@ -24,6 +24,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
|
@ -101,7 +102,9 @@ public class DatapropEditController extends BaseEditController {
|
|||
// TODO - need unionOf/intersectionOf-style domains for domain class
|
||||
String domainStr="";
|
||||
try {
|
||||
domainStr = (dp.getDomainClassURI() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(dp.getDomainClassURI(),"UTF-8")+"\">"+dp.getDomainClassURI()+"</a>";
|
||||
VClass domainClass = getWebappDaoFactory().getVClassDao().getVClassByURI(dp.getDomainClassURI());
|
||||
String domainLinkAnchor = (domainClass != null) ? domainClass.getPickListName() : dp.getDomainClassURI();
|
||||
domainStr = (dp.getDomainClassURI() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(dp.getDomainClassURI(),"UTF-8")+"\">"+domainLinkAnchor+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class Properties2PropertiesRetryController extends BaseEditController {
|
|||
? dpDao.getAllDataProperties()
|
||||
: opDao.getAllObjectProperties();
|
||||
|
||||
Collections.sort(propList);
|
||||
sortForPickList(propList, request);
|
||||
|
||||
String superpropertyURIstr = request.getParameter("SuperpropertyURI");
|
||||
String subpropertyURIstr = request.getParameter("SubpropertyURI");
|
||||
|
|
|
@ -86,7 +86,7 @@ public class PropertyEditController extends BaseEditController {
|
|||
ObjectProperty parent = propDao.getObjectPropertyByURI(p.getParentURI());
|
||||
if (parent != null && parent.getURI() != null) {
|
||||
try {
|
||||
parentPropertyStr = "<a href=\"propertyEdit?uri="+URLEncoder.encode(parent.getURI(),"UTF-8")+"\">"+parent.getLocalNameWithPrefix()+"</a>";
|
||||
parentPropertyStr = "<a href=\"propertyEdit?uri="+URLEncoder.encode(parent.getURI(),"UTF-8")+"\">"+parent.getPickListName()+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
|
@ -121,12 +121,12 @@ public class PropertyEditController extends BaseEditController {
|
|||
String domainStr = "";
|
||||
if (p.getDomainVClassURI() != null) {
|
||||
VClass domainClass = vcDao.getVClassByURI(p.getDomainVClassURI());
|
||||
if (domainClass != null && domainClass.getURI() != null && domainClass.getLocalNameWithPrefix() != null) {
|
||||
if (domainClass != null && domainClass.getURI() != null && domainClass.getPickListName() != null) {
|
||||
try {
|
||||
if (domainClass.isAnonymous()) {
|
||||
domainStr = domainClass.getLocalNameWithPrefix();
|
||||
domainStr = domainClass.getPickListName();
|
||||
} else {
|
||||
domainStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(domainClass.getURI(),"UTF-8")+"\">"+domainClass.getLocalNameWithPrefix()+"</a>";
|
||||
domainStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(domainClass.getURI(),"UTF-8")+"\">"+domainClass.getPickListName()+"</a>";
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e, e);
|
||||
|
@ -138,12 +138,12 @@ public class PropertyEditController extends BaseEditController {
|
|||
String rangeStr = "";
|
||||
if (p.getRangeVClassURI() != null) {
|
||||
VClass rangeClass = vcDao.getVClassByURI(p.getRangeVClassURI());
|
||||
if (rangeClass != null && rangeClass.getURI() != null && rangeClass.getLocalNameWithPrefix() != null) {
|
||||
if (rangeClass != null && rangeClass.getURI() != null && rangeClass.getPickListName() != null) {
|
||||
try {
|
||||
if (rangeClass.isAnonymous()) {
|
||||
rangeStr = rangeClass.getLocalNameWithPrefix();
|
||||
rangeStr = rangeClass.getPickListName();
|
||||
} else {
|
||||
rangeStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(rangeClass.getURI(),"UTF-8")+"\">"+rangeClass.getLocalNameWithPrefix()+"</a>";
|
||||
rangeStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(rangeClass.getURI(),"UTF-8")+"\">"+rangeClass.getPickListName()+"</a>";
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e, e);
|
||||
|
@ -175,22 +175,6 @@ public class PropertyEditController extends BaseEditController {
|
|||
results.add(p.getSelectFromExisting() ? "true" : "false"); // column 21
|
||||
results.add(p.getOfferCreateNewOption() ? "true" : "false"); // column 22
|
||||
|
||||
/*
|
||||
String datapropStr = "";
|
||||
if (p.getObjectIndividualSortPropertyURI() != null) {
|
||||
DataProperty dProp = dpDao.getDataPropertyByURI(p.getObjectIndividualSortPropertyURI());
|
||||
if (dProp != null && dProp.getURI() != null && dProp.getLocalNameWithPrefix() != null) {
|
||||
try {
|
||||
datapropStr = "<a href=\"datapropEdit?uri="+URLEncoder.encode(dProp.getURI(),"UTF-8")+"\">"+dProp.getLocalNameWithPrefix()+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
results.add(datapropStr); // column 16
|
||||
} else {
|
||||
results.add("name (rdfs:label)"); // column 16
|
||||
}
|
||||
*/
|
||||
results.add(p.getDomainEntitySortDirection() == null ? "ascending" : p.getDomainEntitySortDirection()); // column 23
|
||||
|
||||
results.add(p.getURI()); // column 24
|
||||
|
|
|
@ -54,7 +54,7 @@ public class RefactorRetryController extends BaseEditController {
|
|||
epo.setFormObject(foo);
|
||||
HashMap<String,List<Option>> optMap = new HashMap<String,List<Option>>();
|
||||
foo.setOptionLists(optMap);
|
||||
List<Option> subjectClassOpts = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getVClassDao().getAllVclasses(),"URI","Name", null, null);
|
||||
List<Option> subjectClassOpts = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getVClassDao().getAllVclasses(),"URI","PickListName", null, null);
|
||||
subjectClassOpts.add(0,new Option("","? wildcard",true));
|
||||
optMap.put("SubjectClassURI", subjectClassOpts);
|
||||
optMap.put("ObjectClassURI", subjectClassOpts);
|
||||
|
@ -90,7 +90,7 @@ public class RefactorRetryController extends BaseEditController {
|
|||
epo.setFormObject(foo);
|
||||
HashMap<String,List<Option>> optMap = new HashMap<String,List<Option>>();
|
||||
foo.setOptionLists(optMap);
|
||||
List<Option> newClassURIopts = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getVClassDao().getAllVclasses(),"URI","LocalNameWithPrefix", null, null);
|
||||
List<Option> newClassURIopts = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getVClassDao().getAllVclasses(),"URI","PickListName", null, null);
|
||||
newClassURIopts.add(new Option ("","move to trash"));
|
||||
optMap.put("NewVClassURI", newClassURIopts);
|
||||
request.setAttribute("editAction","refactorOp");
|
||||
|
|
|
@ -201,9 +201,9 @@ public class ClassHierarchyListingController extends BaseEditController {
|
|||
Integer numCols = (NUM_COLS-1)-position;
|
||||
|
||||
try {
|
||||
numCols = addColToResults(((vcw.getLocalNameWithPrefix() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(vcw.getURI(),"UTF-8")+"\">"+vcw.getLocalNameWithPrefix()+"</a>"), results, numCols);
|
||||
numCols = addColToResults(((vcw.getPickListName() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(vcw.getURI(),"UTF-8")+"\">"+vcw.getPickListName()+"</a>"), results, numCols);
|
||||
} catch (Exception e) {
|
||||
numCols = addColToResults(((vcw.getLocalNameWithPrefix() == null) ? "" : vcw.getLocalNameWithPrefix()), results, numCols); // column 2
|
||||
numCols = addColToResults(((vcw.getPickListName() == null) ? "" : vcw.getPickListName()), results, numCols); // column 2
|
||||
}
|
||||
numCols = addColToResults(((vcw.getShortDef() == null) ? "" : vcw.getShortDef()), results, numCols); // column 3
|
||||
numCols = addColToResults(((vcw.getExample() == null) ? "" : vcw.getExample()), results, numCols); // column 4
|
||||
|
|
|
@ -187,13 +187,13 @@ public class DataPropertyHierarchyListingController extends BaseEditController {
|
|||
|
||||
String nameStr = dp.getPublicName()==null ? dp.getName()==null ? dp.getURI()==null ? "(no name)" : dp.getURI() : dp.getName() : dp.getPublicName();
|
||||
try {
|
||||
numCols=addColToResults("<a href=\"datapropEdit?uri="+URLEncoder.encode(dp.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+dp.getLocalNameWithPrefix()+"</span>",results,numCols); // column 2
|
||||
numCols=addColToResults("<a href=\"datapropEdit?uri="+URLEncoder.encode(dp.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+dp.getPickListName()+"</span>",results,numCols); // column 2
|
||||
} catch (Exception e) {
|
||||
numCols=addColToResults(nameStr + " <i>" + dp.getLocalNameWithPrefix() + "</i>",results,numCols); // column 2
|
||||
numCols=addColToResults(nameStr + " <i>" + dp.getPickListName() + "</i>",results,numCols); // column 2
|
||||
}
|
||||
VClass tmp = null;
|
||||
try {
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(dp.getDomainClassURI())) != null && (tmp.getLocalNameWithPrefix() == null)) ? "" : vcDao.getVClassByURI(dp.getDomainClassURI()).getLocalNameWithPrefix()), results, numCols); // column 3
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(dp.getDomainClassURI())) != null && (tmp.getPickListName() == null)) ? "" : vcDao.getVClassByURI(dp.getDomainClassURI()).getPickListName()), results, numCols); // column 3
|
||||
} catch (NullPointerException e) {
|
||||
numCols = addColToResults("-",results,numCols);
|
||||
}
|
||||
|
|
|
@ -111,9 +111,9 @@ public class DatatypePropertiesListingController extends BaseEditController {
|
|||
results.add("XX"); // column 1
|
||||
String nameStr = prop.getPublicName()==null ? prop.getName()==null ? prop.getURI()==null ? "(no name)" : prop.getURI() : prop.getName() : prop.getPublicName();
|
||||
try {
|
||||
results.add("<a href=\"datapropEdit?uri="+URLEncoder.encode(prop.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+prop.getLocalNameWithPrefix()+"</span>"); // column 2
|
||||
results.add("<a href=\"datapropEdit?uri="+URLEncoder.encode(prop.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+prop.getPickListName()+"</span>"); // column 2
|
||||
} catch (Exception e) {
|
||||
results.add(nameStr + " <span style='font-style:italic; color:\"grey\";'>" + prop.getLocalNameWithPrefix() + "</span>"); // column 2
|
||||
results.add(nameStr + " <span style='font-style:italic; color:\"grey\";'>" + prop.getPickListName() + "</span>"); // column 2
|
||||
}
|
||||
VClass vc = null;
|
||||
String domainStr="";
|
||||
|
|
|
@ -187,16 +187,16 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
|
|||
}
|
||||
|
||||
numCols = addColToResults( ((hyperlink != null) ? hyperlink : getDisplayLabel(op))
|
||||
+ "<br/><span style='font-style:italic; color:\"grey\";'>"+op.getLocalNameWithPrefix()+"</span>", results, numCols); // column 2
|
||||
+ "<br/><span style='font-style:italic; color:\"grey\";'>"+op.getPickListName()+"</span>", results, numCols); // column 2
|
||||
|
||||
VClass tmp = null;
|
||||
try {
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(op.getDomainVClassURI())) != null && (tmp.getLocalNameWithPrefix() == null)) ? "" : vcDao.getVClassByURI(op.getDomainVClassURI()).getLocalNameWithPrefix()), results, numCols); // column 3
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(op.getDomainVClassURI())) != null && (tmp.getPickListName() == null)) ? "" : vcDao.getVClassByURI(op.getDomainVClassURI()).getPickListName()), results, numCols); // column 3
|
||||
} catch (NullPointerException e) {
|
||||
numCols = addColToResults("",results,numCols);
|
||||
}
|
||||
try {
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(op.getRangeVClassURI())) != null && (tmp.getLocalNameWithPrefix() == null)) ? "" : vcDao.getVClassByURI(op.getRangeVClassURI()).getLocalNameWithPrefix()), results, numCols); // column 4
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(op.getRangeVClassURI())) != null && (tmp.getPickListName() == null)) ? "" : vcDao.getVClassByURI(op.getRangeVClassURI()).getPickListName()), results, numCols); // column 4
|
||||
} catch (NullPointerException e) {
|
||||
numCols = addColToResults("",results,numCols);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public class ObjectPropertyStatementListingController extends
|
|||
|
||||
if (count == 0) {
|
||||
results.add("XX");
|
||||
results.add("No statements found for property \""+op.getLocalNameWithPrefix()+"\"");
|
||||
results.add("No statements found for property \""+op.getPickListName()+"\"");
|
||||
results.add("");
|
||||
results.add("");
|
||||
if (showVClasses) {
|
||||
|
|
|
@ -165,16 +165,16 @@ public class PropertyWebappsListingController extends BaseEditController {
|
|||
results.add(propNameStr); // column 2
|
||||
}
|
||||
|
||||
results.add(prop.getLocalNameWithPrefix()); // column 3
|
||||
results.add(prop.getPickListName()); // column 3
|
||||
|
||||
VClass vc = (prop.getDomainVClassURI() != null) ?
|
||||
vcDao.getVClassByURI(prop.getDomainVClassURI()) : null;
|
||||
String domainStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String domainStr = (vc != null) ? vc.getPickListName() : "";
|
||||
results.add(domainStr); // column 4
|
||||
|
||||
vc = (prop.getRangeVClassURI() != null) ?
|
||||
vcDao.getVClassByURI(prop.getRangeVClassURI()) : null;
|
||||
String rangeStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String rangeStr = (vc != null) ? vc.getPickListName() : "";
|
||||
results.add(rangeStr); // column 5
|
||||
|
||||
if (prop.getGroupURI() != null) {
|
||||
|
|
|
@ -79,9 +79,9 @@ public class VClassWebappsListingController extends BaseEditController {
|
|||
if (cls.getName() != null)
|
||||
try {
|
||||
//String className = (cls.getName()==null || cls.getName().length()==0) ? cls.getURI() : cls.getName();
|
||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"\">"+cls.getLocalNameWithPrefix()+"</a>");
|
||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"\">"+cls.getPickListName()+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(cls.getLocalNameWithPrefix());
|
||||
results.add(cls.getPickListName());
|
||||
}
|
||||
else
|
||||
results.add("");
|
||||
|
|
|
@ -124,7 +124,7 @@ public class RestrictionsListingController extends BaseEditController {
|
|||
results.add("XX");
|
||||
Property onProperty = rest.getOnProperty();
|
||||
ObjectProperty op = opDao.getObjectPropertyByURI(onProperty.getURI());
|
||||
results.add(op.getLocalNameWithPrefix());
|
||||
results.add(op.getPickListName());
|
||||
if (rest.isAllValuesFromRestriction()) {
|
||||
results.add("all values from");
|
||||
AllValuesFromRestriction avfrest = (AllValuesFromRestriction) rest.as(AllValuesFromRestriction.class);
|
||||
|
|
|
@ -92,7 +92,7 @@ public class ListDatatypePropertiesController extends FreemarkerHttpServlet {
|
|||
}
|
||||
|
||||
if (props != null) {
|
||||
Collections.sort(props);
|
||||
sortForPickList(props, vreq);
|
||||
}
|
||||
|
||||
String json = new String();
|
||||
|
@ -107,7 +107,7 @@ public class ListDatatypePropertiesController extends FreemarkerHttpServlet {
|
|||
json += ", ";
|
||||
}
|
||||
|
||||
String nameStr = prop.getPublicName()==null ? prop.getName()==null ? prop.getURI()==null ? "(no name)" : prop.getURI() : prop.getName() : prop.getPublicName();
|
||||
String nameStr = prop.getPickListName()==null ? prop.getName()==null ? prop.getURI()==null ? "(no name)" : prop.getURI() : prop.getName() : prop.getPublicName();
|
||||
|
||||
try {
|
||||
json += "{ \"name\": " + JSONUtils.quote("<a href='datapropEdit?uri="+ URLEncoder.encode(prop.getURI())+"'>" + nameStr + "</a>") + ", ";
|
||||
|
@ -115,7 +115,7 @@ public class ListDatatypePropertiesController extends FreemarkerHttpServlet {
|
|||
json += "{ \"name\": " + JSONUtils.quote(nameStr) + ", ";
|
||||
}
|
||||
|
||||
json += "\"data\": { \"internalName\": " + JSONUtils.quote(prop.getLocalNameWithPrefix()) + ", ";
|
||||
json += "\"data\": { \"internalName\": " + JSONUtils.quote(prop.getPickListName()) + ", ";
|
||||
|
||||
/* VClass vc = null;
|
||||
String domainStr="";
|
||||
|
@ -131,7 +131,7 @@ public class ListDatatypePropertiesController extends FreemarkerHttpServlet {
|
|||
}
|
||||
*/
|
||||
VClass vc = (prop.getDomainClassURI() != null) ? vcDao.getVClassByURI(prop.getDomainClassURI()) : null;
|
||||
String domainStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String domainStr = (vc != null) ? vc.getPickListName() : "";
|
||||
json += "\"domainVClass\": " + JSONUtils.quote(domainStr) + ", " ;
|
||||
|
||||
Datatype rangeDatatype = dDao.getDatatypeByURI(prop.getRangeDatatypeURI());
|
||||
|
|
|
@ -161,11 +161,11 @@ public class ListPropertyWebappsController extends FreemarkerHttpServlet {
|
|||
json += "\"data\": { \"internalName\": " + JSONUtils.quote(prop.getLocalNameWithPrefix()) + ", ";
|
||||
|
||||
VClass vc = (prop.getDomainVClassURI() != null) ? vcDao.getVClassByURI(prop.getDomainVClassURI()) : null;
|
||||
String domainStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String domainStr = (vc != null) ? vc.getPickListName() : "";
|
||||
json += "\"domainVClass\": " + JSONUtils.quote(domainStr) + ", " ;
|
||||
|
||||
vc = (prop.getRangeVClassURI() != null) ? vcDao.getVClassByURI(prop.getRangeVClassURI()) : null;
|
||||
String rangeStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String rangeStr = (vc != null) ? vc.getPickListName() : "";
|
||||
json += "\"rangeVClass\": " + JSONUtils.quote(rangeStr) + ", " ;
|
||||
|
||||
if (prop.getGroupURI() != null) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ListVClassWebappsController extends FreemarkerHttpServlet {
|
|||
String ontologyURI = vreq.getParameter("ontologyUri");
|
||||
|
||||
if (classes != null) {
|
||||
Collections.sort(classes);
|
||||
sortForPickList(classes, vreq);
|
||||
Iterator<VClass> classesIt = classes.iterator();
|
||||
while (classesIt.hasNext()) {
|
||||
if ( counter > 0 ) {
|
||||
|
@ -79,9 +79,9 @@ public class ListVClassWebappsController extends FreemarkerHttpServlet {
|
|||
if ( (ontologyURI==null) || ( (ontologyURI != null) && (cls.getNamespace()!=null) && (ontologyURI.equals(cls.getNamespace())) ) ) {
|
||||
if (cls.getName() != null)
|
||||
try {
|
||||
json += "{ \"name\": " + JSONUtils.quote("<a href='./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"'>"+cls.getLocalNameWithPrefix()+"</a>") + ", ";
|
||||
json += "{ \"name\": " + JSONUtils.quote("<a href='./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"'>"+cls.getPickListName()+"</a>") + ", ";
|
||||
} catch (Exception e) {
|
||||
json += "{ \"name\": " + JSONUtils.quote(cls.getLocalNameWithPrefix()) + ", ";
|
||||
json += "{ \"name\": " + JSONUtils.quote(cls.getPickListName()) + ", ";
|
||||
}
|
||||
else
|
||||
json += "{ \"name\": \"\"";
|
||||
|
|
|
@ -97,7 +97,7 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
roots.add(vreq.getUnfilteredWebappDaoFactory().getVClassDao()
|
||||
.getTopConcept());
|
||||
}
|
||||
Collections.sort(roots);
|
||||
sortForPickList(roots, vreq);
|
||||
int counter = 0;
|
||||
|
||||
Iterator<VClass> rootIt = roots.iterator();
|
||||
|
@ -109,7 +109,8 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
while (rootIt.hasNext()) {
|
||||
VClass root = (VClass) rootIt.next();
|
||||
if (root != null) {
|
||||
json += addChildren(vreq.getUnfilteredWebappDaoFactory(), root, 0, ontologyUri,counter);
|
||||
json += addChildren(vreq.getUnfilteredWebappDaoFactory(),
|
||||
root, 0, ontologyUri, counter, vreq);
|
||||
counter += 1;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +124,8 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
return new TemplateResponseValues(TEMPLATE_NAME, body);
|
||||
}
|
||||
|
||||
private String addChildren(WebappDaoFactory wadf, VClass parent, int position, String ontologyUri, int counter) {
|
||||
private String addChildren(WebappDaoFactory wadf, VClass parent, int position,
|
||||
String ontologyUri, int counter, VitroRequest vreq) {
|
||||
String rowElts = addVClassDataToResultsList(wadf, parent, position, ontologyUri, counter);
|
||||
int childShift = (rowElts.length() > 0) ? 1 : 0; // if addVClassDataToResultsList filtered out the result, don't shift the children over
|
||||
int length = rowElts.length();
|
||||
|
@ -142,11 +144,11 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
Collections.sort(childClasses);
|
||||
sortForPickList(childClasses, vreq);
|
||||
Iterator<VClass> childClassIt = childClasses.iterator();
|
||||
while (childClassIt.hasNext()) {
|
||||
VClass child = (VClass) childClassIt.next();
|
||||
leaves += addChildren(wadf, child, position + childShift, ontologyUri, counter);
|
||||
leaves += addChildren(wadf, child, position + childShift, ontologyUri, counter, vreq);
|
||||
if (!childClassIt.hasNext()) {
|
||||
if ( ontologyUri == null ) {
|
||||
leaves += " }] ";
|
||||
|
@ -197,10 +199,10 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
try {
|
||||
tempString += JSONUtils.quote("<a href='vclassEdit?uri=" +
|
||||
URLEncoder.encode(vcw.getURI(),"UTF-8") + "'>" +
|
||||
vcw.getLocalNameWithPrefix() + "</a>") +", ";
|
||||
vcw.getPickListName() + "</a>") +", ";
|
||||
} catch (Exception e) {
|
||||
tempString += JSONUtils.quote(((vcw.getLocalNameWithPrefix() == null)
|
||||
? "" : vcw.getLocalNameWithPrefix())) + ", ";
|
||||
tempString += JSONUtils.quote(((vcw.getPickListName() == null)
|
||||
? "" : vcw.getPickListName())) + ", ";
|
||||
}
|
||||
|
||||
String shortDef = ((vcw.getShortDef() == null) ? "" : vcw.getShortDef()) ;
|
||||
|
|
|
@ -94,7 +94,7 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
} else {
|
||||
roots = dpDao.getRootDataProperties();
|
||||
if (roots!=null){
|
||||
Collections.sort(roots);
|
||||
sortForPickList(roots, vreq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
while (rootIt.hasNext()) {
|
||||
DataProperty root = rootIt.next();
|
||||
if ( (ontologyUri==null) || ( (ontologyUri!=null) && (root.getNamespace()!=null) && (ontologyUri.equals(root.getNamespace())) ) ) {
|
||||
json += addChildren(root, 0, ontologyUri, counter);
|
||||
json += addChildren(root, 0, ontologyUri, counter, vreq);
|
||||
counter += 1;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,8 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
return new TemplateResponseValues(TEMPLATE_NAME, body);
|
||||
}
|
||||
|
||||
private String addChildren(DataProperty parent, int position, String ontologyUri, int counter) {
|
||||
private String addChildren(DataProperty parent, int position, String ontologyUri,
|
||||
int counter, VitroRequest vreq) {
|
||||
if (parent == null) {
|
||||
return "";
|
||||
}
|
||||
|
@ -149,11 +150,11 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
DataProperty child = dpDao.getDataPropertyByURI(URIstr);
|
||||
childProps.add(child);
|
||||
}
|
||||
Collections.sort(childProps);
|
||||
sortForPickList(childProps, vreq);
|
||||
Iterator<DataProperty> childPropIt = childProps.iterator();
|
||||
while (childPropIt.hasNext()) {
|
||||
DataProperty child = childPropIt.next();
|
||||
leaves += addChildren(child, position+1, ontologyUri, counter);
|
||||
leaves += addChildren(child, position+1, ontologyUri, counter, vreq);
|
||||
if (!childPropIt.hasNext()) {
|
||||
if ( ontologyUri == null ) {
|
||||
leaves += " }] ";
|
||||
|
@ -204,7 +205,7 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
tempString += "}, { \"name\": ";
|
||||
}
|
||||
|
||||
String nameStr = dp.getPublicName() == null
|
||||
String nameStr = dp.getPickListName() == null
|
||||
? dp.getName() == null
|
||||
? dp.getURI() == null
|
||||
? "(no name)" : dp.getURI() : dp.getName() : dp.getPublicName();
|
||||
|
@ -214,17 +215,17 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
dp.getURI()) + "'>" + nameStr + "</a>") + ", ";
|
||||
|
||||
tempString += "\"data\": { \"internalName\": " + JSONUtils.quote(
|
||||
dp.getLocalNameWithPrefix()) + ", ";
|
||||
dp.getPickListName()) + ", ";
|
||||
|
||||
VClass tmp = null;
|
||||
try {
|
||||
tempString += "\"domainVClass\": " + JSONUtils.quote(
|
||||
((tmp = vcDao.getVClassByURI(dp.getDomainClassURI())) != null
|
||||
&& (tmp.getLocalNameWithPrefix() == null))
|
||||
&& (tmp.getPickListName() == null))
|
||||
? ""
|
||||
: vcDao.getVClassByURI(
|
||||
dp.getDomainClassURI())
|
||||
.getLocalNameWithPrefix()) + ", " ;
|
||||
.getPickListName()) + ", " ;
|
||||
} catch (NullPointerException e) {
|
||||
tempString += "\"domainVClass\": \"\",";
|
||||
}
|
||||
|
|
|
@ -219,11 +219,11 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
tempString += "\"domainVClass\": " + JSONUtils.quote(
|
||||
((tmp = vcDao.getVClassByURI(
|
||||
op.getDomainVClassURI())) != null
|
||||
&& (tmp.getLocalNameWithPrefix() == null))
|
||||
&& (tmp.getPickListName() == null))
|
||||
? ""
|
||||
: vcDao.getVClassByURI(
|
||||
op.getDomainVClassURI())
|
||||
.getLocalNameWithPrefix()) + ", " ;
|
||||
.getPickListName()) + ", " ;
|
||||
} catch (NullPointerException e) {
|
||||
tempString += "\"domainVClass\": \"\",";
|
||||
}
|
||||
|
@ -231,11 +231,11 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
tempString += "\"rangeVClass\": " + JSONUtils.quote(
|
||||
((tmp = vcDao.getVClassByURI(
|
||||
op.getRangeVClassURI())) != null
|
||||
&& (tmp.getLocalNameWithPrefix() == null))
|
||||
&& (tmp.getPickListName() == null))
|
||||
? ""
|
||||
: vcDao.getVClassByURI(
|
||||
op.getRangeVClassURI())
|
||||
.getLocalNameWithPrefix()) + ", " ;
|
||||
.getPickListName()) + ", " ;
|
||||
} catch (NullPointerException e) {
|
||||
tempString += "\"rangeVClass\": \"\",";
|
||||
}
|
||||
|
@ -267,8 +267,8 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
} else if (op2 == null) {
|
||||
return -1;
|
||||
}
|
||||
String propLabel1 = getDisplayLabel(op1);
|
||||
String propLabel2 = getDisplayLabel(op2);
|
||||
String propLabel1 = op1.getPickListName();
|
||||
String propLabel2 = op2.getPickListName();
|
||||
if (propLabel1 == null) {
|
||||
return 1;
|
||||
} else if (propLabel2 == null) {
|
||||
|
@ -283,9 +283,9 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
* should never be null
|
||||
*/
|
||||
public static String getDisplayLabel(ObjectProperty op) {
|
||||
String domainPublic = op.getDomainPublic();
|
||||
String displayLabel = (domainPublic != null && domainPublic.length() > 0)
|
||||
? domainPublic
|
||||
String displayLabel = op.getPickListName();
|
||||
displayLabel = (displayLabel != null && displayLabel.length() > 0)
|
||||
? displayLabel
|
||||
: op.getLocalName();
|
||||
return (displayLabel != null) ? displayLabel : "[object property]" ;
|
||||
}
|
||||
|
|
|
@ -178,9 +178,9 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
|||
dp.setNamespace(op.getNameSpace());
|
||||
dp.setLocalName(op.getLocalName());
|
||||
dp.setLocalNameWithPrefix(getWebappDaoFactory().makeLocalNameWithPrefix(dp));
|
||||
dp.setPickListName(getWebappDaoFactory().makePickListName(dp));
|
||||
dp.setName(op.getLocalName());
|
||||
dp.setPublicName(getLabelOrId(op));
|
||||
dp.setPickListName(getWebappDaoFactory().makePickListName(dp));
|
||||
Resource dRes = op.getDomain();
|
||||
if (dRes != null) {
|
||||
dp.setDomainClassURI(dRes.getURI());
|
||||
|
|
|
@ -95,14 +95,13 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
|||
p.setNamespace(op.getNameSpace());
|
||||
p.setLocalName(op.getLocalName());
|
||||
p.setLocalNameWithPrefix(getWebappDaoFactory().makeLocalNameWithPrefix(p));
|
||||
p.setPickListName(getWebappDaoFactory().makePickListName(p));
|
||||
String propertyName = getPropertyStringValue(op,PROPERTY_FULLPROPERTYNAMEANNOT);
|
||||
if (op.getLabel(null) != null)
|
||||
p.setDomainPublic(getLabelOrId(op));
|
||||
else
|
||||
p.setDomainPublic(op.getLocalName());
|
||||
if (p.getDomainPublic() == null)
|
||||
p.setDomainPublic("[related to]");
|
||||
p.setPickListName(getWebappDaoFactory().makePickListName(p));
|
||||
if (op.getDomain() != null)
|
||||
p.setDomainVClassURI( (op.getDomain().isAnon()) ? PSEUDO_BNODE_NS+op.getDomain().getId().toString() : op.getDomain().getURI());
|
||||
if (op.getRange() != null)
|
||||
|
|
|
@ -558,18 +558,20 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
|||
public String makePickListName(ResourceBean bean) {
|
||||
OntologyDao oDao = this.getOntologyDao();
|
||||
Ontology o = oDao.getOntologyByURI(bean.getNamespace());
|
||||
String label = (bean.getLabel() != null) ? bean.getLabel () : bean.getLocalName();
|
||||
label = (label != null) ? label : bean.getURI();
|
||||
if (o == null) {
|
||||
if (VitroVocabulary.vitroURI.equals(bean.getNamespace())) {
|
||||
return bean.getLabel() + " (vitro)";
|
||||
return label + " (vitro)";
|
||||
} else {
|
||||
log.debug("no ontology object found for namespace " + bean.getNamespace());
|
||||
return bean.getLabel();
|
||||
return label;
|
||||
}
|
||||
} else {
|
||||
String prefix = o.getPrefix() == null ? (
|
||||
o.getName() == null ?
|
||||
"unspec" : o.getName()) : o.getPrefix();
|
||||
return bean.getLabel() + " (" + prefix + ")";
|
||||
return label + " (" + prefix + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
<input type="hidden" name="VClassName" value="this anonymous class"/>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<input type="hidden" name="VClassName" value="${VClass.localNameWithPrefix}"/>
|
||||
<input type="hidden" name="VClassName" value="${VClass.pickListName}"/>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<input type="hidden" name="mode" value="moveInstances"/>
|
||||
|
@ -99,10 +99,10 @@
|
|||
<li><input type="checkbox" name="SuperclassURI" value="${superclass.URI}" class="form-item"/>
|
||||
<c:choose>
|
||||
<c:when test="${!superclass.anonymous}">
|
||||
<a href="${superclassURL}">${superclass.localNameWithPrefix}</a>
|
||||
<a href="${superclassURL}">${superclass.pickListName}</a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
${superclass.localNameWithPrefix}
|
||||
${superclass.pickListName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</li>
|
||||
|
@ -137,10 +137,10 @@
|
|||
<li><input type="checkbox" name="SubclassURI" value="${subclass.URI}" class="form-item"/>
|
||||
<c:choose>
|
||||
<c:when test="${!subclass.anonymous}">
|
||||
<a href="${subclassURL}"> ${subclass.localNameWithPrefix} </a>
|
||||
<a href="${subclassURL}"> ${subclass.pickListName} </a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
${subclass.localNameWithPrefix}
|
||||
${subclass.pickListName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</li>
|
||||
|
@ -181,10 +181,10 @@
|
|||
<li><input type="checkbox" name="SubclassURI" value="${subclass.URI}" class="form-item"/>
|
||||
<c:choose>
|
||||
<c:when test="${!subclass.anonymous}">
|
||||
<a href="${subclassURL}"> ${subclass.localNameWithPrefix} </a>
|
||||
<a href="${subclassURL}"> ${subclass.pickListName} </a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
${subclass.localNameWithPrefix}
|
||||
${subclass.pickListName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</li>
|
||||
|
@ -223,10 +223,10 @@
|
|||
<li><input type="checkbox" name="SubclassURI" value="${subclass.URI}" class="form-item"/>
|
||||
<c:choose>
|
||||
<c:when test="${!subclass.anonymous}">
|
||||
<a href="${subclassURL}"> ${subclass.localNameWithPrefix} </a>
|
||||
<a href="${subclassURL}"> ${subclass.pickListName} </a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
${subclass.localNameWithPrefix}
|
||||
${subclass.pickListName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</li>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<c:param name="uri" value="${superproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SuperpropertyURI" value="${superproperty.URI}" class="form-item"/>
|
||||
<a href="${superpropertyURL}">${superproperty.localNameWithPrefix}</a>
|
||||
<a href="${superpropertyURL}">${superproperty.pickListName}</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
@ -114,7 +114,7 @@
|
|||
<c:param name="uri" value="${subproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SubpropertyURI" value="${subproperty.URI}" class="form-item"/>
|
||||
<a href="${subpropertyURL}"> ${subproperty.localNameWithPrefix} </a>
|
||||
<a href="${subpropertyURL}"> ${subproperty.pickListName} </a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
@ -147,7 +147,7 @@
|
|||
<c:param name="uri" value="${eqproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SubpropertyURI" value="${eqproperty.URI}" class="form-item"/>
|
||||
<a href="${eqpropertyURL}"> ${eqproperty.localNameWithPrefix} </a>
|
||||
<a href="${eqpropertyURL}"> ${eqproperty.pickListName} </a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<c:param name="uri" value="${superproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SuperpropertyURI" value="${superproperty.URI}" class="form-item"/>
|
||||
<a href="${superpropertyURL}">${superproperty.localNameWithPrefix}</a>
|
||||
<a href="${superpropertyURL}">${superproperty.pickListName}</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
@ -135,7 +135,7 @@
|
|||
<c:param name="uri" value="${subproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SubpropertyURI" value="${subproperty.URI}" class="form-item"/>
|
||||
<a href="${subpropertyURL}"> ${subproperty.localNameWithPrefix} </a>
|
||||
<a href="${subpropertyURL}"> ${subproperty.pickListName} </a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
@ -172,7 +172,7 @@
|
|||
<c:param name="uri" value="${eqproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SubpropertyURI" value="${eqproperty.URI}" class="form-item"/>
|
||||
<a href="${eqpropertyURL}"> ${eqproperty.localNameWithPrefix} </a>
|
||||
<a href="${eqpropertyURL}"> ${eqproperty.pickListName} </a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Reference in a new issue