Fixed object property sorting on individual page for default list view. NIHVIVO-3415

Removed unused domainEntitySortField and rangeEntitySortField from ObjectProperty.
Added rangeEntitySortField back to property_retry.jsp.
This commit is contained in:
briancaruso 2012-06-21 17:10:14 +00:00
parent ceaf27a713
commit 9b30ecdcb1
8 changed files with 172 additions and 169 deletions

View file

@ -52,14 +52,12 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
private String namespaceInverse = null;
private String localNameInverse = null;
private String domainEntitySortField = null;
private String domainEntitySortDirection = null;
private Integer domainDisplayTier = null;
private Integer domainDisplayLimit = 5;
private String objectIndividualSortPropertyURI = null;
private String rangeEntitySortField = null;
private String rangeEntitySortDirection = null;
private Integer rangeDisplayTier = null;
private Integer rangeDisplayLimit = 5;

View file

@ -29,12 +29,22 @@ public interface ObjectPropertyStatementDao {
Individual fillExistingObjectPropertyStatements( Individual entity );
int insertNewObjectPropertyStatement(ObjectPropertyStatement objPropertyStmt );
public List<Map<String, String>> getObjectPropertyStatementsForIndividualByProperty(String subjectUri, String propertyUri, String objectKey, String query);
public List<Map<String, String>> getObjectPropertyStatementsForIndividualByProperty(String subjectUri, String propertyUri, String objectKey, String query, Set<String> constructQueries);
int insertNewObjectPropertyStatement(ObjectPropertyStatement objPropertyStmt );
// public List<Map<String, String>> getObjectPropertyStatementsForIndividualByProperty(
// String subjectUri,
// String propertyUri,
// String objectKey,
// String queryString,
// Set<String> constructQueryStrings);
public Map<String, String> getMostSpecificTypesInClassgroupsForIndividual(String subjectUri);
List<Map<String, String>> getObjectPropertyStatementsForIndividualByProperty(
String subjectUri, String propertyUri, String objectKey,
String queryString, Set<String> constructQueryStrings,
String sortDirection);
}

View file

@ -82,20 +82,16 @@ class ObjectPropertyStatementDaoFiltering extends BaseFiltering implements Objec
@Override
public int insertNewObjectPropertyStatement(ObjectPropertyStatement objPropertyStmt) {
return innerObjectPropertyStatementDao.insertNewObjectPropertyStatement(objPropertyStmt);
}
}
@Override
public List<Map<String, String>> getObjectPropertyStatementsForIndividualByProperty(
String subjectUri, String propertyUri, String objectKey, String query) {
return getObjectPropertyStatementsForIndividualByProperty(subjectUri, propertyUri, objectKey, query, null);
}
@Override
public List<Map<String, String>> getObjectPropertyStatementsForIndividualByProperty(
String subjectUri, String propertyUri, String objectKey, String query, Set<String> queryStrings) {
String subjectUri, String propertyUri, String objectKey, String query,
Set<String> queryStrings, String sortDirection) {
List<Map<String, String>> data = innerObjectPropertyStatementDao.
getObjectPropertyStatementsForIndividualByProperty(subjectUri, propertyUri, objectKey, query, queryStrings);
List<Map<String, String>> data =
innerObjectPropertyStatementDao.getObjectPropertyStatementsForIndividualByProperty(
subjectUri, propertyUri, objectKey, query, queryStrings,sortDirection);
/* Filter the data
*
@ -135,6 +131,8 @@ class ObjectPropertyStatementDaoFiltering extends BaseFiltering implements Objec
public Map<String, String> getMostSpecificTypesInClassgroupsForIndividual(String subjectUri) {
return innerObjectPropertyStatementDao.getMostSpecificTypesInClassgroupsForIndividual(subjectUri);
}
}

View file

@ -264,29 +264,24 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
* DataPropertyStatementDaoJena returns a List<DataPropertyStatement>. We need to accomodate
* custom queries that could request any data in addition to just the object of the statement.
* However, we do need to get the object of the statement so that we have it to create editing links.
*/
@Override
public List<Map<String, String>> getObjectPropertyStatementsForIndividualByProperty(
String subjectUri,
String propertyUri,
String objectKey, String queryString) {
return getObjectPropertyStatementsForIndividualByProperty(
subjectUri, propertyUri, objectKey, objectKey, null);
}
*/
@Override
public List<Map<String, String>> getObjectPropertyStatementsForIndividualByProperty(
String subjectUri,
String propertyUri,
String propertyUri,
String objectKey,
String queryString, Set<String> constructQueryStrings ) {
String queryString,
Set<String> constructQueryStrings,
String sortDirection) {
Model constructedModel = constructModelForSelectQueries(
subjectUri, propertyUri, constructQueryStrings);
if("desc".equalsIgnoreCase( sortDirection ) ){
queryString = queryString.replaceAll(" ASC\\(", " DESC(");
}
log.debug("Query string for object property " + propertyUri + ": " + queryString);
Query query = null;
@ -301,7 +296,7 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
QuerySolutionMap initialBindings = new QuerySolutionMap();
initialBindings.add("subject", ResourceFactory.createResource(subjectUri));
initialBindings.add("property", ResourceFactory.createResource(propertyUri));
// Run the SPARQL query to get the properties
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
DatasetWrapper w = dwf.getDatasetWrapper();
@ -341,7 +336,7 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
}
private Model constructModelForSelectQueries(String subjectUri,
String propertyUri,
String propertyUri,
Set<String> constructQueries) {
if (constructQueries == null) {
@ -357,7 +352,7 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
queryString = queryString.replace("?subject", "<" + subjectUri + ">");
queryString = queryString.replace("?property", "<" + propertyUri + ">");
// we no longer need this query object, but we might want to do this
// query parse step to improve debugging, depending on the error returned
// through the RDF API

View file

@ -79,6 +79,7 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
private PropertyListConfig config;
private String objectKey;
private String sortDirection;
ObjectPropertyTemplateModel(ObjectProperty op, Individual subject, VitroRequest vreq,
boolean editing)
@ -87,6 +88,8 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
super(op, subject, vreq);
setName(op.getDomainPublic());
sortDirection = op.getDomainEntitySortDirection();
// Get the config for this object property
try {
config = new PropertyListConfig(this, getFreemarkerTemplateLoader(), vreq, op, editing);
@ -144,7 +147,8 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
protected List<Map<String, String>> getStatementData() {
ObjectPropertyStatementDao opDao = vreq.getWebappDaoFactory().getObjectPropertyStatementDao();
return opDao.getObjectPropertyStatementsForIndividualByProperty(subjectUri, propertyUri, objectKey, getSelectQuery(), getConstructQueries());
return opDao.getObjectPropertyStatementsForIndividualByProperty(subjectUri, propertyUri, objectKey, getSelectQuery(), getConstructQueries(), sortDirection);
}
protected abstract boolean isEmpty();