NIHVIVO-2476 Fix bug in which filtering of data and object prop statements was reordering the statements.

This commit is contained in:
ryounes 2011-07-14 23:50:56 +00:00
parent e71628ae6b
commit 2636f464fb
2 changed files with 6 additions and 9 deletions

View file

@ -4,7 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.dao.filtering;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -14,8 +14,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters;
@ -111,10 +109,10 @@ class DataPropertyStatementDaoFiltering extends BaseFiltering implements DataPro
*
* Filtering is applied to a list of DataPropertyStatement. Create these statements, mapped
* to the literal that they are built from, apply filtering to the statements, then get
* the associated literals out of the original list.
* the associated literals out of the original list. Use a LinkedHashMap to preserve the ordering.
*/
Map<DataPropertyStatement, Literal> stmtsToLiterals =
new HashMap<DataPropertyStatement, Literal>(literals.size());
new LinkedHashMap<DataPropertyStatement, Literal>(literals.size());
for (Literal literal : literals) {
String value = literal.getLexicalForm();

View file

@ -3,8 +3,7 @@
package edu.cornell.mannlib.vitro.webapp.dao.filtering;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -102,10 +101,10 @@ class ObjectPropertyStatementDaoFiltering extends BaseFiltering implements Objec
*
* Filtering is applied to a list of ObjectPropertyStatements. Create these statements, mapped
* to the item in data that they are built from, apply filtering to the statements, then get
* the associated data out of the original list.
* the associated data out of the original list. Use a LinkedHashMap to preserve the ordering.
*/
Map<ObjectPropertyStatement, Map<String, String>> stmtsToData =
new HashMap<ObjectPropertyStatement, Map<String, String>>(data.size());
new LinkedHashMap<ObjectPropertyStatement, Map<String, String>>(data.size());
for (Map<String, String> map : data) {
String objectUri = map.get(objectKey);